From 88a288ccfef2a51e578d5e8c04b2026abc905036 Mon Sep 17 00:00:00 2001 From: Philip Hofstetter Date: Fri, 26 Jul 2019 13:35:43 +0200 Subject: [PATCH] make the server banner configurable --- config/config.go | 1 + sftpd/server.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 345a2b6d..8aeca3e4 100644 --- a/config/config.go +++ b/config/config.go @@ -28,6 +28,7 @@ func init() { // create a default configuration to use if no config file is provided globalConf = globalConfig{ SFTPD: sftpd.Configuration{ + Banner: "SFTPServer", BindPort: 2022, BindAddress: "", IdleTimeout: 15, diff --git a/sftpd/server.go b/sftpd/server.go index fa8b845c..e61bb621 100644 --- a/sftpd/server.go +++ b/sftpd/server.go @@ -27,6 +27,7 @@ import ( // Configuration server configuration type Configuration struct { + Banner string `json:"banner"` BindPort int `json:"bind_port"` BindAddress string `json:"bind_address"` IdleTimeout int `json:"idle_timeout"` @@ -63,7 +64,7 @@ func (c Configuration) Initialize(configDir string) error { return sp, nil }, - ServerVersion: "SSH-2.0-SFTPServer", + ServerVersion: "SSH-2.0-" + c.Banner, } if _, err := os.Stat(filepath.Join(configDir, "id_rsa")); os.IsNotExist(err) {