linux – 更改ssh端口后的Fail2ban设置

前端之家收集整理的这篇文章主要介绍了linux – 更改ssh端口后的Fail2ban设置前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我将我的ssh端口切换到22000并更改了/etc/fail2ban/jail.local中的端口设置以指定禁止22和22000但是当我尝试无法登录6次时,我的连接被切断但是能够尝试立即再次登录.

根据我设置的默认bantime,我的IP似乎没有被禁止一小时.

我如何配置这个有什么问题吗?

  1. # "bantime" is the number of seconds that a host is banned.
  2. bantime = 3600
  3.  
  4. [ssh]
  5.  
  6. enabled = true
  7. port = ssh,22000
  8. filter = sshd
  9. logpath = /var/log/auth.log
  10. maxretry = 6

谢谢.

编辑:

每个请求的Netstat输出.

  1. Active Internet connections (only servers)
  2. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
  3. tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1061/master
  4. tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 940/mongod
  5. tcp 0 0 0.0.0.0:22000 0.0.0.0:* LISTEN 1377/sshd
  6. tcp 0 0 0.0.0.0:28017 0.0.0.0:* LISTEN 940/mongod
  7. tcp 0 0 0.0.0.0:8787 0.0.0.0:* LISTEN 951/rserver
  8. tcp6 0 0 :::25 :::* LISTEN 1061/master
  9. tcp6 0 0 :::22000 :::* LISTEN 1377/sshd

解决方法

我通过尝试自己看到的是,重新启动fail2ban守护程序并不会使其重新加载其配置文件. (与linux下的大多数其他守护进程不同……我甚至不知道它在停止时如何设法保存其配置.我想是临时文件)

以下命令将解决您的问题:

  1. fail2ban-client reload

此可执行文件可用于轮询状态以及与守护程序的其他交互.

猜你在找的Linux相关文章