2017-11-05 14:43:22,901 fail2ban.server [7141]: INFO Changed logging target to /var/log/fail2ban.log for Fail2ban v0.9.6 2017-11-05 14:43:22,987 fail2ban.database [7141]: INFO Connected to fail2ban persistent database '/var/lib/fail2ban/fail2ban.sqlite3' 2017-11-05 14:43:22,996 fail2ban.database [7141]: WARNING New database created. Version '2' 2017-11-05 14:43:22,998 fail2ban.jail [7141]: INFO Creating new jail 'sshd' 2017-11-05 14:43:23,002 fail2ban.jail [7141]: INFO Jail 'sshd' uses poller {} 2017-11-05 14:43:23,019 fail2ban.jail [7141]: INFO Initiated 'polling' backend 2017-11-05 14:43:23,019 fail2ban.filter [7141]: INFOSet maxRetry = 5 2017-11-05 14:43:23,020 fail2ban.filter [7141]: INFOSet jail log file encoding to UTF-8 2017-11-05 14:43:23,020 fail2ban.filter [7141]: INFO Added logfile = /var/log/auth.log 2017-11-05 14:43:23,021 fail2ban.actions [7141]: INFOSet banTime = 600 2017-11-05 14:43:23,021 fail2ban.filter [7141]: INFOSet findtime = 600 2017-11-05 14:43:23,022 fail2ban.filter [7141]: INFOSet maxlines = 10 2017-11-05 14:43:23,070 fail2ban.server [7141]: INFO Jail sshd is not a JournalFilter instance 2017-11-05 14:43:23,081 fail2ban.jail [7141]: INFO Jail 'sshd' started 2017-11-05 14:43:23,763 fail2ban.filter [7141]: INFO [sshd] Found 103.5.134.167 2017-11-05 14:43:23,763 fail2ban.filter [7141]: INFO [sshd] Found 103.5.134.167 2017-11-05 14:43:23,764 fail2ban.filter [7141]: INFO [sshd] Found 181.129.54.170 2017-11-05 14:43:23,764 fail2ban.filter [7141]: INFO [sshd] Found 181.129.54.170 2017-11-05 14:43:23,765 fail2ban.filter [7141]: INFO [sshd] Found 181.129.54.170 2017-11-05 14:43:23,765 fail2ban.filter [7141]: INFO [sshd] Found 181.129.54.170 2017-11-05 15:19:06,192 fail2ban.server [7141]: INFO Stopping all jails 2017-11-05 15:19:06,874 fail2ban.jail [7141]: INFO Jail 'sshd' stopped 2017-11-05 15:19:06,879 fail2ban.server [7141]: INFO Exiting Fail2ban 2017-11-05 15:19:07,123 fail2ban.server [8528]: INFO Changed logging target to /var/log/fail2ban.log for Fail2ban v0.9.6 2017-11-05 15:19:07,123 fail2ban.database [8528]: INFO Connected to fail2ban persistent database '/var/lib/fail2ban/fail2ban.sqlite3' 2017-11-05 15:19:07,126 fail2ban.jail [8528]: INFO Creating new jail 'sshd' 2017-11-05 15:19:07,129 fail2ban.jail [8528]: INFO Jail 'sshd' uses poller {} 2017-11-05 15:19:07,141 fail2ban.jail [8528]: INFO Initiated 'polling' backend 2017-11-05 15:19:07,142 fail2ban.actions [8528]: INFOSet banTime = 60 2017-11-05 15:19:07,142 fail2ban.filter [8528]: INFOSet findtime = 60 2017-11-05 15:19:07,142 fail2ban.filter [8528]: INFOSet jail log file encoding to UTF-8 2017-11-05 15:19:07,143 fail2ban.filter [8528]: INFOSet maxRetry = 3 2017-11-05 15:19:07,144 fail2ban.filter [8528]: INFO Added logfile = /var/log/auth.log 2017-11-05 15:19:07,144 fail2ban.filter [8528]: INFOSet maxlines = 10 2017-11-05 15:19:07,189 fail2ban.server [8528]: INFO Jail sshd is not a JournalFilter instance 2017-11-05 15:19:07,195 fail2ban.jail [8528]: INFO Jail 'sshd' started 2017-11-05 15:20:03,263 fail2ban.filter [8528]: INFO [sshd] Found 103.5.134.167 2017-11-05 15:20:05,267 fail2ban.filter [8528]: INFO [sshd] Found 103.5.134.167 2017-11-05 15:20:12,276 fail2ban.filter [8528]: INFO [sshd] Found 103.5.134.167 2017-11-05 15:20:12,380 fail2ban.actions [8528]: NOTICE [sshd] Ban 103.5.134.167 2017-11-05 15:21:12,659 fail2ban.actions [8528]: NOTICE [sshd] Unban 103.5.134.167
要查看启用的监狱列表,请运行以下命令。
1 2 3 4 5
# fail2ban-client status Status |- Number of jail: 2 `- Jail list: apache-auth, sshd
通过运行以下命令来获取禁止的 IP 地址。
1 2 3 4 5 6 7 8 9 10 11
# fail2ban-client status ssh Status for the jail: ssh |- filter ||- File list: /var/log/auth.log ||- Currently failed: 1 | `- Total failed: 3 `- action |- Currently banned: 1 | `- IP list: 192.168.1.115 `- Total banned: 1