AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 618953
Accepted
Craig Francis
Craig Francis
Asked: 2014-08-09 02:28:01 +0800 CST2014-08-09 02:28:01 +0800 CST 2014-08-09 02:28:01 +0800 CST

无论客户端密钥如何,都接受任何 SSH 连接

  • 772

想象一下我正在设置一个蜜罐,设置 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
ssh
  • 1 1 个回答
  • 1630 Views

1 个回答

  • Voted
  1. Best Answer
    Craig Francis
    2014-08-09T03:08:56+08:002014-08-09T03:08:56+08:00

    这行得通......但是由于这基本上消除了所有形式的身份验证,所以不要这样做......

    /etc/pam.d/sshd
        auth    required    pam_permit.so
    

    如果任何其他以(又名模块)开头的行auth被注释掉......您还应该检查任何@include行,因为它们可能包含设置更多auth模块的文件,例如

    #@include common-auth
    

    然后我必须确保 SSHD 配置没有设置任何这些:

    /etc/ssh/sshd_config
    
      # PasswordAuthentication no
      # ChallengeResponseAuthentication no
      # GSSAPIAuthentication no
      # UsePAM no
    

    为了更好地衡量,在帐户上设置了密码(否则视为禁用)。

    • 3

相关问题

  • 如何最好地设置 ssh 隧道以访问远程网络 (Linux)

  • SSH 和重定向

  • 通过 SSH 会话使用 NET USER 命令拒绝访问

  • SSH 服务器零日漏洞利用 - 保护自己的建议

  • ubuntu apt-get upgrade - 如何在 shell 中单击确定?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve