initial stub commit
This commit is contained in:
parent
0d98c203f0
commit
07036afafa
5 changed files with 61 additions and 0 deletions
17
ssh_server.go
Normal file
17
ssh_server.go
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package ussher
|
||||
|
||||
import "golang.org/x/crypto/ssh"
|
||||
|
||||
func RunSSHServer(config *Config) error {
|
||||
sshConfig := &ssh.ServerConfig{
|
||||
PublicKeyCallback: func(conn ssh.ConnMetadata, key ssh.PublicKey) (*ssh.Permissions, error) {
|
||||
return config.Keystore.CheckPublicKey(conn.User(), key)
|
||||
},
|
||||
}
|
||||
|
||||
private, err := config.GetPrivateKey()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sshConfig.AddHostKey(private)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue