diff options
author | Unknwon <u@gogs.io> | 2018-03-30 01:32:18 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2018-03-30 01:32:18 -0400 |
commit | 932490d7f137a2adf896e4e9326f4e8f2b9a2b54 (patch) | |
tree | 764f1619de5711fa2c56c00e8ede6c6971591ffd /pkg/setting/setting.go | |
parent | a855abf8c0de73fb3a9913000e1eb8d8ea9840ff (diff) |
conf: add option to rewrite authorized_keys file at start (#4435)
Added config option '[server] REWRITE_AUTHORIZED_KEYS_AT_START'.
Diffstat (limited to 'pkg/setting/setting.go')
-rw-r--r-- | pkg/setting/setting.go | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index f206592d..c78b689b 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -82,18 +82,19 @@ var ( } SSH struct { - Disabled bool `ini:"DISABLE_SSH"` - StartBuiltinServer bool `ini:"START_SSH_SERVER"` - Domain string `ini:"SSH_DOMAIN"` - Port int `ini:"SSH_PORT"` - ListenHost string `ini:"SSH_LISTEN_HOST"` - ListenPort int `ini:"SSH_LISTEN_PORT"` - RootPath string `ini:"SSH_ROOT_PATH"` - ServerCiphers []string `ini:"SSH_SERVER_CIPHERS"` - KeyTestPath string `ini:"SSH_KEY_TEST_PATH"` - KeygenPath string `ini:"SSH_KEYGEN_PATH"` - MinimumKeySizeCheck bool `ini:"MINIMUM_KEY_SIZE_CHECK"` - MinimumKeySizes map[string]int `ini:"-"` + Disabled bool `ini:"DISABLE_SSH"` + StartBuiltinServer bool `ini:"START_SSH_SERVER"` + Domain string `ini:"SSH_DOMAIN"` + Port int `ini:"SSH_PORT"` + ListenHost string `ini:"SSH_LISTEN_HOST"` + ListenPort int `ini:"SSH_LISTEN_PORT"` + RootPath string `ini:"SSH_ROOT_PATH"` + RewriteAuthorizedKeysAtStrat bool `ini:"REWRITE_AUTHORIZED_KEYS_AT_START"` + ServerCiphers []string `ini:"SSH_SERVER_CIPHERS"` + KeyTestPath string `ini:"SSH_KEY_TEST_PATH"` + KeygenPath string `ini:"SSH_KEYGEN_PATH"` + MinimumKeySizeCheck bool `ini:"MINIMUM_KEY_SIZE_CHECK"` + MinimumKeySizes map[string]int `ini:"-"` } // Security settings @@ -486,6 +487,7 @@ func NewContext() { } SSH.RootPath = path.Join(homeDir, ".ssh") + SSH.RewriteAuthorizedKeysAtStrat = sec.Key("REWRITE_AUTHORIZED_KEYS_AT_START").MustBool() SSH.ServerCiphers = sec.Key("SSH_SERVER_CIPHERS").Strings(",") SSH.KeyTestPath = os.TempDir() if err = Cfg.Section("server").MapTo(&SSH); err != nil { @@ -504,6 +506,10 @@ func NewContext() { } } + if SSH.StartBuiltinServer { + SSH.RewriteAuthorizedKeysAtStrat = false + } + // Check if server is eligible for minimum key size check when user choose to enable. // Windows server and OpenSSH version lower than 5.1 (https://github.com/gogits/gogs/issues/4507) // are forced to be disabled because the "ssh-keygen" in Windows does not print key type. |