parent
88fa53fd16
commit
db14517499
|
@ -30,7 +30,7 @@ var Version string = "dev"
|
|||
type Options struct {
|
||||
Admin string `long:"admin" description:"File of public keys who are admins."`
|
||||
Bind string `long:"bind" description:"Host and port to listen on." default:"0.0.0.0:2022"`
|
||||
Identity string `short:"i" long:"identity" description:"Private key to identify server with." default:"~/.ssh/id_rsa"`
|
||||
Identity []string `short:"i" long:"identity" description:"Private key to identify server with." default:"~/.ssh/id_rsa"`
|
||||
Log string `long:"log" description:"Write chat log to this file."`
|
||||
Motd string `long:"motd" description:"Optional Message of the Day file."`
|
||||
Pprof int `long:"pprof" description:"Enable pprof http server for profiling."`
|
||||
|
@ -102,7 +102,12 @@ func main() {
|
|||
message.SetLogger(os.Stderr)
|
||||
}
|
||||
|
||||
privateKeyPath := options.Identity
|
||||
auth := sshchat.NewAuth()
|
||||
config := sshd.MakeAuth(auth)
|
||||
config.ServerVersion = "SSH-2.0-Go ssh-chat"
|
||||
// FIXME: Should we be using config.NoClientAuth = true by default?
|
||||
|
||||
for _, privateKeyPath := range options.Identity {
|
||||
if strings.HasPrefix(privateKeyPath, "~/") {
|
||||
user, err := user.Current()
|
||||
if err == nil {
|
||||
|
@ -115,11 +120,9 @@ func main() {
|
|||
fail(3, "Failed to read identity private key: %v\n", err)
|
||||
}
|
||||
|
||||
auth := sshchat.NewAuth()
|
||||
config := sshd.MakeAuth(auth)
|
||||
config.AddHostKey(signer)
|
||||
config.ServerVersion = "SSH-2.0-Go ssh-chat"
|
||||
// FIXME: Should we be using config.NoClientAuth = true by default?
|
||||
fmt.Printf("Added server identity: %s\n", sshd.Fingerprint(signer.PublicKey()))
|
||||
}
|
||||
|
||||
s, err := sshd.ListenSSH(options.Bind, config)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue