ssh: Implement authentication for new ssh server

This commit is contained in:
Tom Wiesing 2022-11-11 14:47:10 +01:00
parent 66b397e9da
commit 45f63935cd
No known key found for this signature in database
10 changed files with 259 additions and 1 deletions

17
pkg/sshx/sshx.go Normal file
View file

@ -0,0 +1,17 @@
package sshx
import "github.com/gliderlabs/ssh"
// ParseAllKeys parses all keys from the list of bytes
func ParseAllKeys(bytes []byte) (keys []ssh.PublicKey) {
var key ssh.PublicKey
var err error
for {
key, _, _, bytes, err = ssh.ParseAuthorizedKey(bytes)
if err != nil {
break
}
keys = append(keys, key)
}
return
}