V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
通过以下 Referral 链接购买 DigitalOcean 主机,你将可以帮助 V2EX 持续发展
DigitalOcean - SSD Cloud Servers
Kuso
V2EX  ›  VPS

求教 DO 设置 SSH Key 后爆破问题

  •  
  •   Kuso · 2015-05-19 11:49:50 +08:00 · 310 次点击
    这是一个创建于 3288 天前的主题,其中的信息可能已经有所发展或是发生改变。
    先设置好带passphrase的SSH Key,然后才开的Droplet,所以从一开始就是用key登录,DO也没有给我发root密码邮件。后来我又设置了PermitRootLogin without-password。自以为安全了,但日志里还是有大量爆破,看得眼花。

    有帖子说,要设置成下面那样。但我压根就没有密码啊。
    ChallengeResponseAuthentication no
    PasswordAuthentication no
    UsePAM no

    其实最大的问题是UsePAM的设置:
    # Set this to 'yes' to enable PAM authentication, account processing,
    # and session processing. If this is enabled, PAM authentication will
    # be allowed through the ChallengeResponseAuthentication and
    # PasswordAuthentication. Depending on your PAM configuration,
    # PAM authentication via ChallengeResponseAuthentication may bypass
    # the setting of "PermitRootLogin without-password".
    # If you just want the PAM account and session checks to run without
    # PAM authentication, then enable this but set PasswordAuthentication
    # and ChallengeResponseAuthentication to 'no'.
    我心想那就UsePAM no吧,但又看到有人说「设置问UsePAM no后无法通过key登陆。原来新建账户的时候没有给该账户设置密码,导致无法通过登陆。给账户设置一个密码后就可以通过key登陆了(因为是通过key登陆,所以建立账户没设置密码,但是UsePAM设置成no后,如果账户密码是空是无法通过key登陆的。)」。

    我就属于没密码的,怕设置完进不去,又要通过DO的网页控制台再去设置密码?而且我好奇的是,压根没密码,怎么爆破都没意义吧。到底用不用设置UsePAM no呢?求教。
    6 条回复    2015-05-19 13:07:25 +08:00
    clino
        1
    clino  
       2015-05-19 11:59:14 +08:00
    换端口应该不会这么多攻击了吧
    Kuso
        2
    Kuso  
    OP
       2015-05-19 12:10:19 +08:00
    @clino 在公司也要用,所以不能换陌生端口。其实他们实际爆破也无所谓,日志太长不看就是了。我是想知道,我目前的设置足够安全了么?用不用设置成ChallengeResponseAuthentication no PasswordAuthentication no UsePAM no ?
    clino
        3
    clino  
       2015-05-19 12:14:35 +08:00 via Android
    用denyhosts或者类似的工具?
    clino
        4
    clino  
       2015-05-19 12:41:32 +08:00 via Android
    @Kuso 公司其他人用也没关系,加上 ssh config 相关配置用起来其实不麻烦
    jianshu
        5
    jianshu  
       2015-05-19 13:03:59 +08:00
    PasswordAuthentication no
    PermitEmptyPasswords no
    PermitRootLogin no
    UsePAM no

    UsePAM和PasswordAuthentication肯定要禁,然后随他扫吧。
    jianshu
        6
    jianshu  
       2015-05-19 13:07:25 +08:00
    你还是给你的账号设置个密码吧,KEY也要。端口可以改高一点,2W+。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2211 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 10:19 · PVG 18:19 · LAX 03:19 · JFK 06:19
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.