samurai/main.go
2021-02-10 10:29:25 +01:00

35 lines
621 B
Go

package main
import (
"io/ioutil"
"log"
"go.xsfx.dev/samurai/internal/auth"
"go.xsfx.dev/samurai/internal/router"
gossh "golang.org/x/crypto/ssh"
"github.com/gliderlabs/ssh"
)
func main() {
privBytes, err := ioutil.ReadFile("/home/marv/.ssh/id_rsa")
if err != nil {
log.Fatal(err)
}
privKey, err := gossh.ParsePrivateKey(privBytes)
if err != nil {
log.Fatal(err)
}
s := ssh.Server{
Addr: ":2222",
HostSigners: []ssh.Signer{privKey},
PasswordHandler: auth.Auth,
}
ssh.Handle(router.Router)
log.Println("starting ssh server on port 2222...")
log.Fatal(s.ListenAndServe())
}