Skip to content

Commit

Permalink
[ssh] fix the config specification in the authorized_keys template (#…
Browse files Browse the repository at this point in the history
…8031) (#8193)

The gitea flags must appear in front of the gitea command. Otherwise
 they are ignored.

Signed-off-by: Jakob Ackermann <[email protected]>
(cherry picked from commit 8964874)
  • Loading branch information
das7pad authored and lunny committed Sep 16, 2019
1 parent 6883c00 commit d78aa18
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models/ssh_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit d78aa18

Please sign in to comment.