Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.

Commit f6f771b

Browse files
authored
Merge pull request #31 from cloudflare/bugfix/nomatchingkey
Fix broken bypass of ssh key (#30)
2 parents f4b055a + bfba869 commit f6f771b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cmd/gortr/gortr.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,9 @@ func main() {
546546
if !*SSHAuthKeysBypass {
547547
var noKeys bool
548548
for i, k := range sshClientKeys {
549+
if k == "" {
550+
continue
551+
}
549552
if strings.HasPrefix(fmt.Sprintf("%v %v", key.Type(), keyBase64), k) {
550553
log.Infof("Connected (ssh-key): %v/%v with key %v %v (matched with line %v)",
551554
conn.User(), conn.RemoteAddr(), key.Type(), keyBase64, i+1)
@@ -555,6 +558,7 @@ func main() {
555558
}
556559
if !noKeys {
557560
log.Warnf("No key for %v/%v %v %v. Disconnecting.", conn.User(), conn.RemoteAddr(), key.Type(), keyBase64)
561+
return nil, errors.New("Key not found")
558562
}
559563
} else {
560564
log.Infof("Connected (ssh-key): %v/%v with key %v %v", conn.User(), conn.RemoteAddr(), key.Type(), keyBase64)

0 commit comments

Comments
 (0)