initial stub commit
This commit is contained in:
parent
0d98c203f0
commit
07036afafa
5 changed files with 61 additions and 0 deletions
24
config.go
Normal file
24
config.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package ussher
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
|
||||
"golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
HostKeyPath string
|
||||
Keystore Keystore
|
||||
}
|
||||
|
||||
func (c *Config) GetPrivateKey() (ssh.Signer, error) {
|
||||
bytes, err := ioutil.ReadFile(c.HostKeyPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ssh.ParsePrivateKey(bytes)
|
||||
}
|
||||
|
||||
type Keystore interface {
|
||||
CheckPublicKey(user string, key ssh.PublicKey) (*ssh.Permissions, error)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue