Default port to 2022, updating documentation to match new default. Addresses nice to have in #76.

Also print bind information on startup. An alternative to this approach would be to use info level logging, but the issue makes me think we want it all the time. I altered the README to show use of non-default port 22 which makes the note about root/sudo below still make sense.
This commit is contained in:
Matt Croydon 2015-01-04 21:57:22 -06:00
parent d0e442a647
commit 492d50d521
3 changed files with 6 additions and 4 deletions

View File

@ -26,7 +26,7 @@ Usage:
Application Options:
-v, --verbose Show verbose logging.
-i, --identity= Private key to identify server with. (~/.ssh/id_rsa)
--bind= Host and port to listen on. (0.0.0.0:22)
--bind= Host and port to listen on. (0.0.0.0:2022)
--admin= Fingerprint of pubkey to mark as admin.
--whitelist= Optional file of pubkey fingerprints that are allowed to connect
--motd= Message of the Day file (optional)
@ -40,7 +40,7 @@ After doing `go get github.com/shazow/ssh-chat` on this repo, you should be able
to run a command like:
```
$ ssh-chat --verbose --bind ":2022" --identity ~/.ssh/id_dsa
$ ssh-chat --verbose --bind ":22" --identity ~/.ssh/id_dsa
```
To bind on port 22, you'll need to make sure it's free (move any other ssh

4
cmd.go
View File

@ -27,7 +27,7 @@ import _ "net/http/pprof"
type Options struct {
Verbose []bool `short:"v" long:"verbose" description:"Show verbose logging."`
Identity string `short:"i" long:"identity" description:"Private key to identify server with." default:"~/.ssh/id_rsa"`
Bind string `long:"bind" description:"Host and port to listen on." default:"0.0.0.0:22"`
Bind string `long:"bind" description:"Host and port to listen on." default:"0.0.0.0:2022"`
Admin []string `long:"admin" description:"Fingerprint of pubkey to mark as admin."`
Whitelist string `long:"whitelist" description:"Optional file of pubkey fingerprints who are allowed to connect."`
Motd string `long:"motd" description:"Optional Message of the Day file."`
@ -106,6 +106,8 @@ func main() {
}
defer s.Close()
fmt.Printf("Listening for connections on %v\n", options.Bind)
host := NewHost(s)
host.auth = &auth

View File

@ -7,7 +7,7 @@ package sshd
config := MakeNoAuth()
config.AddHostKey(signer)
s, err := ListenSSH("0.0.0.0:22", config)
s, err := ListenSSH("0.0.0.0:2022", config)
if err != nil {
// Handle opening socket error
}