Add ServerVersion as an option in the config

This commit is contained in:
Kaleb Elwert 2017-02-03 16:20:43 -08:00
parent 7bc24bc5e0
commit 80be538d5c

@ -15,6 +15,7 @@ type Server struct {
Addr string // TCP address to listen on, ":22" if empty
Handler Handler // handler to invoke, ssh.DefaultHandler if nil
HostSigners []Signer // private keys for the host key, must have at least one
Version string // server version to be sent before the initial handshake
PasswordHandler PasswordHandler // password authentication handler
PublicKeyHandler PublicKeyHandler // public key authentication handler
@ -37,6 +38,9 @@ func (srv *Server) makeConfig() (*gossh.ServerConfig, error) {
if srv.PasswordHandler == nil && srv.PublicKeyHandler == nil {
config.NoClientAuth = true
}
if srv.Version != "" {
config.ServerVersion = "SSH-2.0-" + srv.Version
}
if srv.PasswordHandler != nil {
config.PasswordCallback = func(conn gossh.ConnMetadata, password []byte) (*gossh.Permissions, error) {
perms := &gossh.Permissions{}