aboutsummaryrefslogtreecommitdiff
path: root/routes/install.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2018-03-30 01:32:18 -0400
committerUnknwon <u@gogs.io>2018-03-30 01:32:18 -0400
commit932490d7f137a2adf896e4e9326f4e8f2b9a2b54 (patch)
tree764f1619de5711fa2c56c00e8ede6c6971591ffd /routes/install.go
parenta855abf8c0de73fb3a9913000e1eb8d8ea9840ff (diff)
conf: add option to rewrite authorized_keys file at start (#4435)
Added config option '[server] REWRITE_AUTHORIZED_KEYS_AT_START'.
Diffstat (limited to 'routes/install.go')
-rw-r--r--routes/install.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/routes/install.go b/routes/install.go
index 948c67c2..2c50f1b3 100644
--- a/routes/install.go
+++ b/routes/install.go
@@ -84,11 +84,21 @@ func GlobalInit() {
}
checkRunMode()
- if setting.InstallLock && setting.SSH.StartBuiltinServer {
+ if !setting.InstallLock {
+ return
+ }
+
+ if setting.SSH.StartBuiltinServer {
ssh.Listen(setting.SSH.ListenHost, setting.SSH.ListenPort, setting.SSH.ServerCiphers)
log.Info("SSH server started on %s:%v", setting.SSH.ListenHost, setting.SSH.ListenPort)
log.Trace("SSH server cipher list: %v", setting.SSH.ServerCiphers)
}
+
+ if setting.SSH.RewriteAuthorizedKeysAtStrat {
+ if err := models.RewriteAuthorizedKeys(); err != nil {
+ log.Warn("Fail to rewrite authorized_keys file: %v", err)
+ }
+ }
}
func InstallInit(c *context.Context) {