Skip to content

Commit 3c20372

Browse files
authored
Merge pull request #19 from atlassian/belak/add-server-version
Add ServerVersion as an option in the config
2 parents d6ddd5d + 80be538 commit 3c20372

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

server.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type Server struct {
1515
Addr string // TCP address to listen on, ":22" if empty
1616
Handler Handler // handler to invoke, ssh.DefaultHandler if nil
1717
HostSigners []Signer // private keys for the host key, must have at least one
18+
Version string // server version to be sent before the initial handshake
1819

1920
PasswordHandler PasswordHandler // password authentication handler
2021
PublicKeyHandler PublicKeyHandler // public key authentication handler
@@ -37,6 +38,9 @@ func (srv *Server) makeConfig() (*gossh.ServerConfig, error) {
3738
if srv.PasswordHandler == nil && srv.PublicKeyHandler == nil {
3839
config.NoClientAuth = true
3940
}
41+
if srv.Version != "" {
42+
config.ServerVersion = "SSH-2.0-" + srv.Version
43+
}
4044
if srv.PasswordHandler != nil {
4145
config.PasswordCallback = func(conn gossh.ConnMetadata, password []byte) (*gossh.Permissions, error) {
4246
perms := &gossh.Permissions{}

0 commit comments

Comments
 (0)