想象一下我正在设置一个蜜罐,设置 SSHD 以接受任何连接的最快方法是什么?是的,这真的很不安全,所以请不要复制:-)
可能有用(放在pam_permit
堆栈上auth
)...我对 PAM 没有太多经验,目前正在阅读文档。
https://unix.stackexchange.com/questions/124187/accept-any-private-key-for-authentication
对于实际问题的一些背景,我有一台位于防火墙后面的客户端计算机,它尝试通过首先连接出站来设置反向 SSH 隧道(这样我就可以连接回它)......虽然它确实一直在尝试连接,就好像它使用的密钥不再有效(这很奇怪)或者其他东西失败了。
服务器日志显示客户端关闭连接,其他客户端可以正常连接...
debug1: Forked child 29472.
Set /proc/self/oom_score_adj to 0
debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
debug1: inetd sockets after dupping: 3, 3
Connection from CLIENT_IP port 46186
debug1: Client protocol version 2.0; client software version OpenSSH_6.0p1 Debian-4+deb7u2
debug1: match: OpenSSH_6.0p1 Debian-4+deb7u2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2
debug1: permanently_set_uid: 105/65534 [preauth]
debug1: list_hostkey_types: ssh-rsa,ssh-dss [preauth]
debug1: SSH2_MSG_KEXINIT sent [preauth]
debug1: SSH2_MSG_KEXINIT received [preauth]
debug1: kex: client->server aes128-ctr hmac-md5 none [preauth]
debug1: kex: server->client aes128-ctr hmac-md5 none [preauth]
debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth]
debug1: SSH2_MSG_NEWKEYS sent [preauth]
debug1: expecting SSH2_MSG_NEWKEYS [preauth]
debug1: SSH2_MSG_NEWKEYS received [preauth]
debug1: KEX done [preauth]
debug1: userauth-request for user tunnel service ssh-connection method none [preauth]
debug1: attempt 0 failures 0 [preauth]
debug1: PAM: initializing for "tunnel"
debug1: PAM: setting PAM_RHOST to "server"
debug1: PAM: setting PAM_TTY to "ssh"
debug1: userauth-request for user tunnel service ssh-connection method publickey [preauth]
debug1: attempt 1 failures 0 [preauth]
debug1: test whether pkalg/pkblob are acceptable [preauth]
debug1: Checking blacklist file /usr/share/ssh/blacklist.DSA-1024
debug1: Checking blacklist file /etc/ssh/blacklist.DSA-1024
debug1: temporarily_use_uid: 1001/1001 (e=0/0)
debug1: trying public key file /home/tunnel/.ssh/authorized_keys
debug1: fd 4 clearing O_NONBLOCK
debug1: restore_uid: 0/0
debug1: temporarily_use_uid: 1001/1001 (e=0/0)
debug1: trying public key file /home/tunnel/.ssh/authorized_keys2
debug1: Could not open authorized keys '/home/tunnel/.ssh/authorized_keys2': No such file or directory
debug1: restore_uid: 0/0
Failed publickey for tunnel from CLIENT_IP port 46186 ssh2
Connection closed by CLIENT_IP [preauth]
debug1: do_cleanup [preauth]
debug1: monitor_read_log: child log fd closed
debug1: do_cleanup
debug1: PAM: cleanup
debug1: Killing privsep child 29473
这行得通......但是由于这基本上消除了所有形式的身份验证,所以不要这样做......
如果任何其他以(又名模块)开头的行
auth
被注释掉......您还应该检查任何@include
行,因为它们可能包含设置更多auth
模块的文件,例如然后我必须确保 SSHD 配置没有设置任何这些:
为了更好地衡量,在帐户上设置了密码(否则视为禁用)。