Add SSH Key Management
This commit is contained in:
parent
ef76844922
commit
bcd1805001
62 changed files with 1004 additions and 188 deletions
|
|
@ -1,34 +1,24 @@
|
|||
package ssh2
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/auth"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/instances"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/sshx"
|
||||
"github.com/gliderlabs/ssh"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/sql"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/ssh2/sshkeys"
|
||||
)
|
||||
|
||||
type SSH2 struct {
|
||||
component.Base
|
||||
Dependencies struct {
|
||||
SQL *sql.SQL
|
||||
Instances *instances.Instances
|
||||
Auth *auth.Auth
|
||||
Keys *sshkeys.SSHKeys
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
_ component.Installable = (*SSH2)(nil)
|
||||
_ component.Routeable = (*SSH2)(nil)
|
||||
)
|
||||
|
||||
// GlobalKeys returns the global authorized keys
|
||||
func (s *SSH2) GlobalKeys() ([]ssh.PublicKey, error) {
|
||||
file, err := s.Environment.Open(s.Config.GlobalAuthorizedKeysFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
bytes, err := io.ReadAll(file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return sshx.ParseAllKeys(bytes), nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue