From 40733cda8cb3600758e09f10ec95cd03b11966cc Mon Sep 17 00:00:00 2001 From: Luis Rebollo Date: Mon, 7 Apr 2025 11:04:51 -0600 Subject: [PATCH] Enables setting a custom password for the SSH honeypot --- auth.go | 6 +++++- config.go | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/auth.go b/auth.go index 4762ce30..4598e082 100644 --- a/auth.go +++ b/auth.go @@ -46,7 +46,11 @@ func (cfg *config) getPasswordCallback() func(conn ssh.ConnMetadata, password [] Password: string(password), }) if !cfg.Auth.PasswordAuth.Accepted { - return nil, errors.New("") + if string(password) == cfg.Auth.PasswordAuth.Password{ + return nil, nil + }else{ + return nil, errors.New("") + } } return nil, nil } diff --git a/config.go b/config.go index 12d780c7..842ef7ea 100644 --- a/config.go +++ b/config.go @@ -37,6 +37,7 @@ type loggingConfig struct { type commonAuthConfig struct { Enabled bool `yaml:"enabled"` Accepted bool `yaml:"accepted"` + Password string `yaml:"password"` } type keyboardInteractiveAuthQuestion struct { @@ -83,6 +84,7 @@ func (cfg *config) setDefaults() { cfg.Logging.Timestamps = true cfg.Auth.PasswordAuth.Enabled = true cfg.Auth.PasswordAuth.Accepted = true + cfg.Auth.PasswordAuth.Password = "abc123" cfg.Auth.PublicKeyAuth.Enabled = true cfg.SSHProto.Version = "SSH-2.0-sshesame" cfg.SSHProto.Banner = "This is an SSH honeypot. Everything is logged and monitored."