首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在一些SSH登录尝试失败后,IP被阻塞了几分钟

在一些SSH登录尝试失败后,IP被阻塞了几分钟
EN

Ask Ubuntu用户
提问于 2020-08-25 13:06:26
回答 1查看 4.5K关注 0票数 -4

在几次错误的登录尝试之后(使用密码),我的IP会被阻塞,我无法在几分钟内将SSH登录到Ubuntu服务器。

我不希望这种情况发生(至少对我的IP来说是这样)。事实上,我想在我的服务器上白名单我的IP。但我不知道该在哪里做。我有不明飞行物残疾。我不使用fail2ban,也不使用pam_tallypam_faillock。我已经安装了用于2因素身份验证的libpam-google-authenticator和用于强密码策略的pam_cracklib.so。事实上,我甚至不知道是什么阻碍了我的IP的失败尝试。我的/etc/pam.d中有以下文件

代码语言:javascript
运行
复制
 atd
 chfn
 chpasswd
 chsh
 common-account
 common-auth
 common-password
 common-session
 common-session-noninteractive
 cron
 login
 newusers
 other
 passwd
 polkit-1
 runuser
 runuser-l
 sshd
 su
 sudo
 systemd-user
 vmtoolsd

有谁能告诉我,我该怎么做才能使我的IP不因身份验证失败而被阻止?

sshd_config文件中,我设置了MaxAuthTries 20。但ssh在8次错误尝试中失败。也没有什么关于封锁时间或白名单。

上次发生这种情况时,/var/log/auth.log中的最后几个条目如下所示。

代码语言:javascript
运行
复制
Aug 26 15:04:24 Bastion sshd(pam_google_authenticator)[2661]: Did not receive verification code from user
Aug 26 15:04:24 Bastion-ip-10-0-1-45 sshd(pam_google_authenticator)[2661]: Invalid verification code for username
Aug 26 15:04:26 Bastion sshd[2657]: error: PAM: Authentication failure for username from xxx.xxx.xxx.xxx
Aug 26 15:04:27 Bastion sshd(pam_google_authenticator)[3247]: Did not receive verification code from user
Aug 26 15:04:27 Bastion sshd(pam_google_authenticator)[3247]: Invalid verification code for username
Aug 26 15:04:29 Bastion sshd[2657]: error: PAM: Authentication failure for username from xxx.xxx.xxx.xxx

Xxx.xxx是被封锁的IP。

EN

回答 1

Ask Ubuntu用户

发布于 2020-09-10 07:41:30

我解决了这个问题。是OSSEC。我在服务器上也安装了一个ossec-hids代理。ossec中的主动响应功能是阻止ssh故障的IP。通过在ossec管理器中的ossec.conf文件中添加全局块1.2.3.4中要忽略的IP来修正该问题。谢谢所有有用的建议伙计们。

票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1269998

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档