Skip to content
This repository has been archived by the owner on Aug 17, 2024. It is now read-only.

Commit

Permalink
fix: 监控时增加只读模式参数, 提升安全性 (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
zx06 authored Oct 26, 2022
1 parent 320eecd commit f87d44d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/api/guacamole.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ func (api GuacamoleApi) GuacamoleMonitor(c echo.Context) error {
configuration.SetParameter("width", strconv.Itoa(s.Width))
configuration.SetParameter("height", strconv.Itoa(s.Height))
configuration.SetParameter("dpi", "96")
configuration.SetReadOnlyMode()

addr := config.GlobalCfg.Guacd.Hostname + ":" + strconv.Itoa(config.GlobalCfg.Guacd.Port)

Expand Down
5 changes: 5 additions & 0 deletions server/common/guacamole/guacd.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const (
SwapRedBlue = "swap-red-blue"
DestHost = "dest-host"
DestPort = "dest-port"
ReadOnly = "read-only"

UsernameRegex = "username-regex"
PasswordRegex = "password-regex"
Expand Down Expand Up @@ -83,6 +84,10 @@ func NewConfiguration() (config *Configuration) {
return config
}

func (opt *Configuration) SetReadOnlyMode() {
opt.Parameters[ReadOnly] = "true"
}

func (opt *Configuration) SetParameter(name, value string) {
opt.Parameters[name] = value
}
Expand Down

0 comments on commit f87d44d

Please sign in to comment.