moved ssh code to separate pacakge.
This commit is contained in:
parent
781c14dcf4
commit
35beb19c2d
@ -4,6 +4,7 @@ import (
|
||||
"bufio"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"git.wamblee.org/converge/pkg/agent/service"
|
||||
"git.wamblee.org/converge/pkg/agent/session"
|
||||
"git.wamblee.org/converge/pkg/comms"
|
||||
"git.wamblee.org/converge/pkg/support/iowrappers"
|
||||
@ -205,7 +206,7 @@ func main() {
|
||||
|
||||
// Authentiocation
|
||||
|
||||
authorizedKeys, err := NewAuthorizedPublicKeys(authorizedKeysFile)
|
||||
authorizedKeys, err := service.NewAuthorizedPublicKeys(authorizedKeysFile)
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
@ -253,13 +254,10 @@ func main() {
|
||||
|
||||
go comms.ListenForServerEvents(commChannel)
|
||||
|
||||
var service AgentService
|
||||
var agentService AgentService
|
||||
|
||||
agentService = service.NewSshAgentService(registration.HostPrivateKey, shell, authorizedKeys)
|
||||
|
||||
service = SshAgentService{
|
||||
hostPrivateKey: registration.HostPrivateKey,
|
||||
shellCommand: shell,
|
||||
authorizedKeys: authorizedKeys,
|
||||
}
|
||||
//service = ConnectionServer(netCatServer)
|
||||
//service = ConnectionServer(echoServer)
|
||||
log.Println()
|
||||
@ -290,7 +288,7 @@ func main() {
|
||||
|
||||
listener := comms.NewAgentListener(commChannel.Session)
|
||||
|
||||
service.Run(listener)
|
||||
agentService.Run(listener)
|
||||
}
|
||||
|
||||
func chooseShell(shells []string) string {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package main
|
||||
package service
|
||||
|
||||
import (
|
||||
"git.wamblee.org/converge/pkg/agent/session"
|
@ -1 +0,0 @@
|
||||
package service
|
@ -1,4 +1,4 @@
|
||||
package main
|
||||
package service
|
||||
|
||||
import (
|
||||
"bufio"
|
@ -1,4 +1,4 @@
|
||||
package main
|
||||
package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@ -21,6 +21,15 @@ type SshAgentService struct {
|
||||
authorizedKeys *AuthorizedPublicKeys
|
||||
}
|
||||
|
||||
func NewSshAgentService(hostPrivateKey []byte, shellCommand string,
|
||||
authorizedKeys *AuthorizedPublicKeys) SshAgentService {
|
||||
return SshAgentService{
|
||||
hostPrivateKey: hostPrivateKey,
|
||||
shellCommand: shellCommand,
|
||||
authorizedKeys: authorizedKeys,
|
||||
}
|
||||
}
|
||||
|
||||
func (s SshAgentService) Run(listener net.Listener) {
|
||||
s.sshServer().Serve(listener)
|
||||
}
|
Loading…
Reference in New Issue
Block a user