Bläddra i källkod

[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 89648746a5)
tags/v1.9.4
Jakob Ackermann 4 år sedan
förälder
incheckning
d78aa189ec
1 ändrade filer med 2 tillägg och 2 borttagningar
  1. 2
    2
      models/ssh_key.go

+ 2
- 2
models/ssh_key.go Visa fil

@@ -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) {

Laddar…
Avbryt
Spara