aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Ackermann2019-09-16 03:41:30 +0200
committerLunny Xiao2019-09-16 09:41:30 +0800
commitd78aa189ec1d0467efe5e0b2450b40e01677cc27 (patch)
treeba966691fa1bb7de33bd59c265fb84edfd907f20
parent6883c007d3993416cdb38692cd5d5faa333046de (diff)
[ssh] fix the config specification in the authorized_keys template (#8031) (#8193)
The gitea flags must appear in front of the gitea command. Otherwise they are ignored. Signed-off-by: Jakob Ackermann <das7pad@outlook.com> (cherry picked from commit 89648746a5acd4892a026d2962ff217280dbdf5b)
-rw-r--r--models/ssh_key.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/models/ssh_key.go b/models/ssh_key.go
index 79e936fdc..9ad9a45bf 100644
--- a/models/ssh_key.go
+++ b/models/ssh_key.go
@@ -32,7 +32,7 @@ import (
const (
tplCommentPrefix = `# gitea public key`
- tplPublicKey = tplCommentPrefix + "\n" + `command="%s serv key-%d --config='%s'",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n"
+ tplPublicKey = tplCommentPrefix + "\n" + `command="%s --config='%s' serv key-%d",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n"
)
var sshOpLocker sync.Mutex
@@ -77,7 +77,7 @@ func (key *PublicKey) OmitEmail() string {
// AuthorizedString returns formatted public key string for authorized_keys file.
func (key *PublicKey) AuthorizedString() string {
- return fmt.Sprintf(tplPublicKey, setting.AppPath, key.ID, setting.CustomConf, key.Content)
+ return fmt.Sprintf(tplPublicKey, setting.AppPath, setting.CustomConf, key.ID, key.Content)
}
func extractTypeFromBase64Key(key string) (string, error) {