diff --git a/server.go b/server.go index be4355e..d017269 100644 --- a/server.go +++ b/server.go @@ -37,6 +37,7 @@ type Server struct { 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 + Banner string // server banner KeyboardInteractiveHandler KeyboardInteractiveHandler // keyboard-interactive authentication handler PasswordHandler PasswordHandler // password authentication handler @@ -132,6 +133,11 @@ func (srv *Server) config(ctx Context) *gossh.ServerConfig { if srv.Version != "" { config.ServerVersion = "SSH-2.0-" + srv.Version } + if srv.Banner != "" { + config.BannerCallback = func(conn gossh.ConnMetadata) string { + return srv.Banner + } + } if srv.PasswordHandler != nil { config.PasswordCallback = func(conn gossh.ConnMetadata, password []byte) (*gossh.Permissions, error) { applyConnMetadata(ctx, conn)