fix: 监控时增加只读模式参数, 提升安全性 (#290)

看参考 https://guacamole.apache.org/doc/gug/configuring-guacamole.html
read-only参数
This commit is contained in:
x_zhuo 2022-10-26 22:27:13 +08:00 committed by GitHub
parent 320eecdfd1
commit f87d44d38b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -224,6 +224,7 @@ func (api GuacamoleApi) GuacamoleMonitor(c echo.Context) error {
configuration.SetParameter("width", strconv.Itoa(s.Width)) configuration.SetParameter("width", strconv.Itoa(s.Width))
configuration.SetParameter("height", strconv.Itoa(s.Height)) configuration.SetParameter("height", strconv.Itoa(s.Height))
configuration.SetParameter("dpi", "96") configuration.SetParameter("dpi", "96")
configuration.SetReadOnlyMode()
addr := config.GlobalCfg.Guacd.Hostname + ":" + strconv.Itoa(config.GlobalCfg.Guacd.Port) addr := config.GlobalCfg.Guacd.Hostname + ":" + strconv.Itoa(config.GlobalCfg.Guacd.Port)

View File

@ -52,6 +52,7 @@ const (
SwapRedBlue = "swap-red-blue" SwapRedBlue = "swap-red-blue"
DestHost = "dest-host" DestHost = "dest-host"
DestPort = "dest-port" DestPort = "dest-port"
ReadOnly = "read-only"
UsernameRegex = "username-regex" UsernameRegex = "username-regex"
PasswordRegex = "password-regex" PasswordRegex = "password-regex"
@ -83,6 +84,10 @@ func NewConfiguration() (config *Configuration) {
return config return config
} }
func (opt *Configuration) SetReadOnlyMode() {
opt.Parameters[ReadOnly] = "true"
}
func (opt *Configuration) SetParameter(name, value string) { func (opt *Configuration) SetParameter(name, value string) {
opt.Parameters[name] = value opt.Parameters[name] = value
} }