diff options
| author | Paul Bütow <pbuetow@mimecast.com> | 2020-01-20 18:41:05 +0000 |
|---|---|---|
| committer | Paul Bütow <pbuetow@mimecast.com> | 2020-01-21 14:35:23 +0000 |
| commit | c128865c4c7411c29a59fca9a3a2f95537686d7b (patch) | |
| tree | 193bccc70d942c8b70cc93fae2670263701e43aa /config/server.go | |
| parent | 3755a9911ecb05886577095f2b8cc8b9e4066a3a (diff) | |
Move commands to cmd/ and move internal dependencies to internal/
Diffstat (limited to 'config/server.go')
| -rw-r--r-- | config/server.go | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/config/server.go b/config/server.go deleted file mode 100644 index 7883b33..0000000 --- a/config/server.go +++ /dev/null @@ -1,66 +0,0 @@ -package config - -import ( - "errors" -) - -// Permissions map. Each SSH user has a list of permissions which -// log files it is allowed to follow and which ones not. -type Permissions struct { - // The default user permissions. - Default []string - // The per user special permissions. - Users map[string][]string -} - -// ServerConfig represents the server configuration. -type ServerConfig struct { - // The SSH server bind port. - SSHBindAddress string - // The max amount of concurrent user connection allowed to connect to the server. - MaxConnections int - // The max amount of concurrent cats per server. - MaxConcurrentCats int - // The max amount of concurrent tails per server. - MaxConcurrentTails int - // The user permissions. - Permissions Permissions `json:",omitempty"` - // The mapr log format - MapreduceLogFormat string `json:",omitempty"` - // The default path of the server host key - HostKeyFile string - // The host key size in bits - HostKeyBits int -} - -// Create a new default server configuration. -func newDefaultServerConfig() *ServerConfig { - defaultPermissions := []string{"^/.*"} - defaultBindAddress := "0.0.0.0" - - return &ServerConfig{ - SSHBindAddress: defaultBindAddress, - MaxConnections: 10, - MaxConcurrentCats: 2, - MaxConcurrentTails: 50, - HostKeyFile: "./cache/ssh_host_key", - HostKeyBits: 4096, - Permissions: Permissions{ - Default: defaultPermissions, - }, - } -} - -// ServerUserPermissions retrieves the permission set of a given user. -func ServerUserPermissions(userName string) (permissions []string, err error) { - permissions = Server.Permissions.Default - if p, ok := Server.Permissions.Users[userName]; ok { - permissions = p - } - - if len(permissions) == 0 { - err = errors.New("Empty set of permission, user won't be able to open any files") - } - - return -} |
