Forward ssh2 ports into docker

This commit is contained in:
Tom Wiesing 2022-11-11 16:06:59 +01:00
parent 45f63935cd
commit 5bceaa0d47
No known key found for this signature in database
24 changed files with 745 additions and 117 deletions

View file

@ -0,0 +1,28 @@
package ssh2
import (
"io"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/instances"
"github.com/FAU-CDI/wisski-distillery/pkg/sshx"
"github.com/gliderlabs/ssh"
)
type SSH2 struct {
component.Base
Instances *instances.Instances
}
// 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
}