Code Monkey home page Code Monkey logo

fail2ban-blacklist-jail-for-repeat-offenders-with-perma-extended-banning's Introduction

Fail2Ban Blacklist JAIL for Repeat Offenders

with Perma / Extended Banning Across Reboots

If this helped you

Buy me Coffee

A customised jail with action and filter file for Fail2Ban. This jail is based on the recidive jail but makes use of a simple text file to enable extended and permanent bans even across reboots.

This is intended to replace the recidive filter so make sure that recidive is set to enabled = false do not have both this jail and recidive running at the same time

SETUP INSTRUCTIONS:

  • STEP 1: requires blacklist.conf in /etc/fail2ban/filter.d folder

cd /etc/fail2ban/filter.d

sudo wget https://raw.githubusercontent.com/mitchellkrogza/Fail2Ban-Blacklist-JAIL-for-Repeat-Offenders-with-Perma-Extended-Banning/master/filter.d/blacklist.conf -O blacklist.conf

  • STEP 2: requires blacklist.conf in /etc/fail2ban/action.d folder

cd /etc/fail2ban/action.d

sudo wget https://raw.githubusercontent.com/mitchellkrogza/Fail2Ban-Blacklist-JAIL-for-Repeat-Offenders-with-Perma-Extended-Banning/master/action.d/blacklist.conf -O blacklist.conf

  • STEP 3: requires jail settings called [blacklist]

sudo nano /etc/fail2ban/jail.local

add this to the bottom of the file

[DEFAULT]
port = 0:65535
filter = %(__name__)s

[blacklist]
enabled = true
logpath  = /var/log/fail2ban.*
filter = blacklist
banaction = blacklist
bantime  = 31536000   ; 1 year
findtime = 31536000   ; 1 year
maxretry = 10

❗ To stop all email notifications of bans, especially after a server reboot, add the jail as follows:

[DEFAULT]
port = 0:65535
filter = %(__name__)s

[blacklist]
enabled = true
logpath  = /var/log/fail2ban.*
filter = blacklist
banaction = blacklist
action = %(action_)s
bantime  = 31536000   ; 1 year
findtime = 31536000   ; 1 year
maxretry = 10
  • STEP 4: requires ip.blacklist file in /etc/fail2ban

create the file

sudo touch /etc/fail2ban/ip.blacklist

make the file writable

sudo chmod 755 /etc/fail2ban/ip.blacklist

  • STEP 5: recidive filter must be disabled (do not run both at same time)

###Drawbacks:

Only works with IPTables

###Based on:

the Recidive Jail from Fail2Ban (do not run both at same time please)

How it works / Concepts:

This jail monitors all your Fail2Ban log files including any rotated log files because the log file location setting in the jail is wild-carded

It requires an action.d file called blacklist.conf in your /etc/fail2ban/action.d folder It requires an filter.d file called blacklist.conf in your /etc/fail2ban/filter.d folder It requires the jail [blacklist] settings in your jail.local file

In my jail settings I have set a findtime of 1 year (31536000 seconds) bantime of 1 year (31536000 seconds) maxretry of 10 attempts

This means Fail2Ban will scan through it's log files over a full year's period. If it finds the same attack pattern, let's say an SSH attack for instance, from the same IP address on 10 different occasions anywhere within 1 year, that IP address is then regarded as a repeat offender and can very well be blacklisted for the 1 year period or even forever.

This is done through a very simple text based file called ip.blacklist Follow the Setup Instructions Above

The Startup Action:

The startup action checks the existing ip.blacklist file for any duplicates and automatically removes them. It also sorts the file into numbered order which makes looking through the file later a breeze. The startup action then adds all IP's contained in the blacklist file into your IPTables with a DROP command. This happens every time Fail2Ban starts or even after a server reboot. This means this truly works across reboots unlike other repeat offender jails out there.

It also effectively deals with any chance of duplicates. A really simple sort commandline used to sort and clear the file of dupes.

The Ban Action:

The ban action takes a new IP address which was found to match our rules and writes this new entry into the ip.blacklist file and it then adds this new IP to the IPTables rules and the new repeat offender is immediately blocked with a DROP command.

The UnBan Action:

The unban action removes the IP address from the ip.blacklist file and deletes the IPTables firewall entry. If the same offending IP address comes back and tries an attack again even just once, he will probably satisfy the 1 year rule again and will be blocked again for another entire year. A really simple sed commandline used to delete the IP entry from the ip.blocklist file.

Other Comments:

Some may think this is harsh but if someone really tries 10 times they must be banned it's as simple as that.

If a rogue IP address really has not been dealt with by the network manager of the company owning the IP address (in an entire year), then it's unlikely they will ever deal with it or simply are being hacked to death themselves and don't even know how to stop it.

Then it is time to even consider using -1 as your bantime so these BAD IP's are blocked forever.

I based this on the recidive filter which comes with Fail2Ban but I found this a better method at making sure bans are persistent across reboots and it's fool proof. It's also very fast and does not slow down Fail2Ban whatsoever.

It is suggested to also modify your Fail2Ban log rotation settings to have logrotate retain Fail2Ban logs for at least 13 months. (see below for logrotate settings for Fail2Ban)

It has only been tested on the 0.91 version of Fail2Ban on Ubuntu 16.04 but it should work perfectly for any previous versions too but there is no guarantee of this until I can test myself.

If you are new to Fail2Ban go read my tutorial at https://ubuntu101.co.za/security/fail2ban/fail2ban-persistent-bans-ubuntu/

LogRotate Settings for Fail2Ban:

edit this file at /etc/logrotate.d/fail2ban

This is set to rotate the log file monthly and delete any log files older than 13 months, assuring you, you always have a full 1 year of log's to reference for Repeat Offenders

/var/log/fail2ban.log {
    			monthly
    			rotate 13
    			compress
				delaycompress
    			missingok
    			notifempty
    			postrotate
				fail2ban-client flushlogs 1>/dev/null
    			endscript
    			create 640 root adm
				}

Some Good Advice For You:

In my time working with Fail2Ban I have had to rely on many forums for help and guidance with problems I ran into. Almost every time I found out my problems were all merely syntax related problems in my jail.local file so ALWAYS make sure your syntax is correct by starting the fail2ban client as follows after you have made ANY modifications to your jail.local file. sudo fail2ban-client -vvv -x start This will give you a verbose output for debugging purposes.

Finally and please pay attention to this. I have seen a lot of people on forums who have had problems getting Fail2Ban to work properly receiving advice from strangers telling them to do silly things like disabling Ubuntu's SELinux / AppArmor module. This really is bad advice because I can assure you Fail2Ban works 100% perfectly with Apparmor / SELinux in it's default unmodified state.

Don't place yourself in a situation of going through the effort of installing Fail2Ban for added security measures while at the same time disabling other security measures.

A Personal Comment on Country Blocking:

Be careful of following advice of blocking entire country IP blocks. It's just in my opinion a really bad network practice to block an entire country simply because one or two networks are badly managed.

You may be hosting web sites for clients who are losing potential business from other countries simply because you have set rules to prevent that entire country from even seeing their web site or reaching your server.

Fail2Ban and this custom Jail will work perfectly for you at dealing with individual repeat offender IP addresses and dealing with them permanently.

If you really must block an entire country, make sure you are 100% aware of the implications.

If someone really wants to hack your servers though, they will just jump to another country .... and another ..... and another .... and another ..... are you going to block the entire world eventually?

Disclaimer:

This software comes with no warranty of any sort and you use this at your own risk. The author will not be held responsible for any failures through the use of this software add on for the popular Fail2Ban plugin.

This plugin / custom jail for Fail2Ban is also NOT official, it is customised by myself for my own server environment and I have made it available on Github as open source software.

While this software has been thoroughly tested on the server environment and software versions listed in this readme file, the author can not offer any guarantee that it will work on your server.

The most common reason should this not work for you is that your file permissions have been fiddled with or your server has been modified in other non-standard ways. Fail2Ban requires root access to all it's files and folders.

Free to Use - Free to Change:

This is open source software and 100% free to use. You can modify it to your liking if you don't like the way I have done something, but if you break it you fix it yourself. This workign and tested version is truly all you should ever need.

Issues:

Feel free to log any issues using the issue logging system here on GitHub. I will do my best to help you if I can find any free time to do so.

Thanks to all the really good folks out there who contribute to Fail2Ban and who write add ons and modules for it.

Buy me Coffee

fail2ban-blacklist-jail-for-repeat-offenders-with-perma-extended-banning's People

Contributors

brigslabs avatar mitchellkrogza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fail2ban-blacklist-jail-for-repeat-offenders-with-perma-extended-banning's Issues

client working fine, but server won't start

I have tried it without the code but still see it failing. I am running this:
service fail2ban start
and I get:
Job for fail2ban.service failed because the control process exited with error code. See "systemctl status fail2ban.service" and "journalctl -xe" for details.
running:
systemctl status fail2ban.service
gives me:

● fail2ban.service - Fail2Ban Service
   Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; vendor preset: enabled)
   Active: inactive (dead) (Result: exit-code) since Fri 2018-05-11 16:50:07 UTC; 3min 23s ago
     Docs: man:fail2ban(1)
  Process: 30896 ExecStop=/usr/bin/fail2ban-client stop (code=exited, status=0/SUCCESS)
  Process: 32080 ExecStart=/usr/bin/fail2ban-client -x start (code=exited, status=255)
 Main PID: 30778 (code=killed, signal=TERM)

May 11 16:50:07 lists.pocketmud.com systemd[1]: fail2ban.service: Control process exited, code=exited status=255
May 11 16:50:07 lists.pocketmud.com systemd[1]: Failed to start Fail2Ban Service.
May 11 16:50:07 lists.pocketmud.com systemd[1]: fail2ban.service: Unit entered failed state.
May 11 16:50:07 lists.pocketmud.com systemd[1]: fail2ban.service: Failed with result 'exit-code'.
May 11 16:50:07 lists.pocketmud.com systemd[1]: fail2ban.service: Service hold-off time over, scheduling restart.
May 11 16:50:07 lists.pocketmud.com systemd[1]: Stopped Fail2Ban Service.
May 11 16:50:07 lists.pocketmud.com systemd[1]: fail2ban.service: Start request repeated too quickly.
May 11 16:50:07 lists.pocketmud.com systemd[1]: Failed to start Fail2Ban Service.```

Any ideas where to look?

empty /etc/fail2ban/ip.blacklist

Hello,
I know you have tested your jail on Fail2ban 0.9.1, I just want to report that with version 0.9.6 ip.blacklist file remains empty after max retry attempts are reached
2017-03-22 19:18:06,519 fail2ban.filter [914]: INFO [apache] Found 10.64.64.64
2017-03-22 19:18:09,536 fail2ban.filter [914]: INFO [apache] Found 10.64.64.64
2017-03-22 19:18:12,552 fail2ban.filter [914]: INFO [apache] Found 10.64.64.64
2017-03-22 19:18:13,287 fail2ban.actions [914]: NOTICE [apache] Ban 10.64.64.64
2017-03-22 19:18:13,425 fail2ban.filter [914]: INFO [blacklist] Found 10.64.64.64

IPs on ip.blacklist not getting banned

I'm running Fail2Ban v0.9.3

I've followed the script as described in the instructions & for some reason, the IPs on /etc/fail2ban/ip.blacklist are not getting banned.

After reviewing the fail2ban.log, it looks like asterisk is unbanning IPs that are on the ip.blacklist. The asterisk ban time works perfectly, but after their ban time expires, they unban the IP on the ip.blacklist.

Can you tell me how to troubleshoot, why they are not getting unbanned or how to keep them permanently banned?

error-log or access-log for [apache-noscript]?

Hi

I am not sure if it is correct place to post but this is the best I can come up with. Sorry if it is inappropriate.

I follow your post here https://ubuntu101.co.za/security/fail2ban/fail2ban-persistent-bans- and left a comment but I think you haven't seen it yet. The main point is I got the recommendation from fail2ban that it is supposed to be logpath = %(apache_error_log)s in [apache-noscript] config file.

Here is the link to the issue I posted. fail2ban/fail2ban#2344

Can you kindly help? Thank you so much.

banaction seems to be ignored

I doubt it's a problem with your jail, so sorry I am spamming your issues with this. But maybe you could help me figuring this one out:
I set up everything exactly as instructed (apart from customized retry values). Unfortunately, the banaction doesn't seem to be executed. I got a message from fail2ban saying

The IP 223.197.XXX.XX has just been banned by Fail2Ban after 5 attempts against blacklist (X inserted by me)

So the jail seems to be reacting to the log entries, but the ip.blacklist isn't modified and sudo iptables -S doesn't show any related entries. BTW I didn't forget to chmod 755 the ip.blacklist. Do you have any idea what I could look at next to find the reason for this? Thanks for your help!

Edit: Also, the fail2ban.log says [blacklist] Found ... and [blacklist] Ban ..., but still no ban via blacklist jail and no modification of ip.blacklist.

Unbanning

Is removing from the black list and iptables sufficient? Will the ip not get re-blacklisted if it's in the fail2ban log files?

Also, what stops the emails for this jail? I don't quite understand the magic.

blacklist jail and .gz format logfiles

Thanks for developing this. I've installed, following the instructions. Restarting fail2ban gives an error when it tries to read the compressed .gz format fail2ban logfiles:

2020-07-08 17:50:07,085 fail2ban.jail [13557]: INFO Creating new jail 'blacklist'
2020-07-08 17:50:07,085 fail2ban.jail [13557]: INFO Jail 'blacklist' uses pyinotify {}
2020-07-08 17:50:07,092 fail2ban.jail [13557]: INFO Initiated 'pyinotify' backend
2020-07-08 17:50:07,101 fail2ban.server [13557]: INFO Jail blacklist is not a JournalFilter instance
2020-07-08 17:50:07,102 fail2ban.filter [13557]: INFO Added logfile: '/var/log/fail2ban.log.2.gz' (pos = 581, hash = 52530769d6b9cdd90d587f3503622347572c9120)
2020-07-08 17:50:07,103 fail2ban.filter [13557]: WARNING Error decoding line from '/var/log/fail2ban.log.2.gz' with 'UTF-8'. Consider setting logencoding=utf-8 (or another appropriate encoding) for this jail. Continuing to process line ignoring invalid characters: b'\xb5\xfa\xf1\xcb\ etc etc ... lots more escaped characters.

It then goes on to add the non-compressed fail2ban logfiles and throws no errors.

Changes to logrotate were made as instructed.
Any suggestions?
With thanks.

action.d/Blacklist.conf cannot create new chain in IpTables

Hi,

Thanks for sharing this.

I am having issue with iptables. The new chain for 'blacklist' won't get created. I cannot find any detail error message. There is only a very vague one in Fail2Ban.log file:

fail2ban.actions.action[24130]: ERROR iptables -N fail2ban- ...

I know there is not enough here, but that's all I got. I have changed the loglevel to 4, but got some useless information in fail2ban.log file.

Please can you advise?

Kind regards,
Saeed

Error during configuration at startup

First of all thank you very much for the configuration.
It is exactly what i was missing.

Unfortunately i have an error when reloading fail2ban

+ 95 7FC5BEC2B700 fail2ban ERROR Failed during configuration: Bad value substitution: section: [blacklist] option : action key : port rawval : ", protocol="%(protocol)s", chain="%(chain)s"]
I hope you can help me with this error.

Thank you!

/etc/fail2ban/ip.blacklist not getting banned IPs

Hi, I have followed the instruction carefully but I have no IPs in /etc/fail2ban/ip.blacklist

I am running: Fail2Ban v0.10.2 on: Debian/Raspbian GNU/Linux 10 (buster)

The log doesn't show anything special. I can find after restarting fail2ban:

[...]
NOTICE [blacklist] Flush ticket(s) with blacklist
[...]
INFO Jail 'blacklist' started
[...]
INFO [blacklist] Found 116.110.253.171 - 2019-11-19 17:41:19

I am not sure what additional info I can provide. Why would ip.blacklist no record banned IPs?

Thank you

I got blocked out.

Hi @mitchellkrogza

I cannot ssh to my server and I check my iptables and found I got blocked by myself. 😢

How to avoid this in future? Whitelist my ip? What if I on travel, I will have different ip? Thank you.

Chain f2b-nginxrepeatoffender (1 references)
pkts bytes target prot opt in out source destination
88 5804 DROP all -- any any 121-254-111-144.veetime.com anywhere

After removing the rule and then I just got banned again. I am doing experiment with Fail2Ban and your add-on. So weird.

Blacklist JAIL for Repeat Offenders

Hello,

I’m having problem with repeats offenders. I’m using fail2ban 0.9.6 on Debian 8. flowed this link https://github.com/mitchellkrogza/Fail2Ban-Blacklist-JAIL-for-Repeat-Offenders-with-Perma-Extended-Banning
But iptable are allowing after blacklist IP. I don’t know how to diagnose this problem any advice will be appreciate.

This is just one IP From fail2ban.log

:226: 2017-05-10 20:41:56,473 fail2ban.filter [660]: INFO [asterisk] Found 95.141.35.200
:274: 2017-05-10 20:46:39,665 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:278: 2017-05-10 20:51:26,037 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:279: 2017-05-10 20:56:06,140 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:280: 2017-05-10 20:56:06,797 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:281: 2017-05-10 20:56:06,802 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:293: 2017-05-10 21:06:07,047 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:294: 2017-05-10 21:10:26,835 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:299: 2017-05-10 21:15:08,719 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:308: 2017-05-10 21:19:53,933 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:309: 2017-05-10 21:19:54,535 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:310: 2017-05-10 21:19:54,539 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:323: 2017-05-10 21:29:54,584 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:330: 2017-05-10 21:34:01,234 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:341: 2017-05-10 21:38:45,376 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:346: 2017-05-10 21:43:26,882 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:347: 2017-05-10 21:43:27,051 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:348: 2017-05-10 21:43:27,055 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:349: 2017-05-10 21:43:27,425 fail2ban.actions [1590]: NOTICE [blacklist] Ban 95.141.35.200
:357: 2017-05-10 21:53:27,099 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:359: 2017-05-10 21:57:39,762 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:364: 2017-05-10 22:02:26,486 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:379: 2017-05-10 22:07:09,948 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:380: 2017-05-10 22:07:10,584 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:381: 2017-05-10 22:07:10,587 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:391: 2017-05-10 22:17:10,619 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:396: 2017-05-10 22:21:32,252 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:399: 2017-05-10 22:26:16,130 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:406: 2017-05-10 22:31:06,550 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:407: 2017-05-10 22:31:07,117 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:408: 2017-05-10 22:31:07,121 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:415: 2017-05-10 22:41:07,157 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:428: 2017-05-10 22:45:16,255 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:435: 2017-05-10 22:49:59,264 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:438: 2017-05-10 22:54:39,769 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:439: 2017-05-10 22:54:40,588 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:440: 2017-05-10 22:54:40,593 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:441: 2017-05-10 22:54:41,086 fail2ban.actions [1590]: NOTICE [blacklist] 95.141.35.200 already banned
:461: 2017-05-10 23:04:40,834 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:465: 2017-05-10 23:08:56,267 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:477: 2017-05-10 23:13:38,831 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:485: 2017-05-10 23:18:20,771 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:486: 2017-05-10 23:18:21,305 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:487: 2017-05-10 23:18:21,308 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:511: 2017-05-10 23:28:21,355 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:518: 2017-05-10 23:32:30,408 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:523: 2017-05-10 23:37:18,397 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:527: 2017-05-10 23:42:02,893 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:528: 2017-05-10 23:42:03,626 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:529: 2017-05-10 23:42:03,630 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:538: 2017-05-10 23:52:03,862 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:541: 2017-05-10 23:56:23,004 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:557: 2017-05-11 00:02:22,012 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:566: 2017-05-11 00:10:17,283 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:586: 2017-05-11 00:15:16,818 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:593: 2017-05-11 00:20:07,366 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:594: 2017-05-11 00:20:07,610 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:595: 2017-05-11 00:20:07,614 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:596: 2017-05-11 00:20:08,278 fail2ban.actions [1590]: NOTICE [blacklist] 95.141.35.200 already banned
:602: 2017-05-11 00:30:07,638 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:609: 2017-05-11 00:34:16,129 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:611: 2017-05-11 00:39:06,425 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:623: 2017-05-11 00:43:46,923 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:624: 2017-05-11 00:43:47,076 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:625: 2017-05-11 00:43:47,079 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:636: 2017-05-11 00:53:47,101 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:641: 2017-05-11 00:59:01,587 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:648: 2017-05-11 01:04:06,496 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:651: 2017-05-11 01:09:06,732 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:662: 2017-05-11 01:13:58,104 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:669: 2017-05-11 01:19:04,142 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:670: 2017-05-11 01:19:04,709 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:671: 2017-05-11 01:19:04,712 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:678: 2017-05-11 01:29:04,735 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:682: 2017-05-11 01:33:45,960 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:687: 2017-05-11 01:38:30,066 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:690: 2017-05-11 01:43:09,534 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:691: 2017-05-11 01:43:10,022 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:692: 2017-05-11 01:43:10,026 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:693: 2017-05-11 01:43:10,380 fail2ban.actions [1590]: NOTICE [blacklist] 95.141.35.200 already banned
:704: 2017-05-11 01:53:10,290 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:707: 2017-05-11 01:57:32,331 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:712: 2017-05-11 02:02:17,842 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:719: 2017-05-11 02:06:59,171 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:720: 2017-05-11 02:06:59,770 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:721: 2017-05-11 02:06:59,774 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:726: 2017-05-11 02:16:59,820 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:731: 2017-05-11 02:21:05,402 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:734: 2017-05-11 02:25:45,477 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:737: 2017-05-11 02:30:27,965 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:738: 2017-05-11 02:30:28,251 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:739: 2017-05-11 02:30:28,255 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:750: 2017-05-11 02:40:28,290 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:751: 2017-05-11 02:44:35,868 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:757: 2017-05-11 02:49:35,626 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:764: 2017-05-11 02:54:20,159 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:765: 2017-05-11 02:54:20,766 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:766: 2017-05-11 02:54:20,769 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:767: 2017-05-11 02:54:21,740 fail2ban.actions [1590]: NOTICE [blacklist] 95.141.35.200 already banned
:774: 2017-05-11 03:04:20,790 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:779: 2017-05-11 03:08:28,679 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:789: 2017-05-11 03:13:10,301 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:795: 2017-05-11 03:17:55,999 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:796: 2017-05-11 03:17:56,229 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:797: 2017-05-11 03:17:56,232 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:823: 2017-05-11 03:27:56,244 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:838: 2017-05-11 03:32:11,619 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:843: 2017-05-11 03:37:00,855 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:847: 2017-05-11 03:41:42,698 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:848: 2017-05-11 03:41:42,718 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:849: 2017-05-11 03:41:42,721 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:858: 2017-05-11 03:51:42,983 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:860: 2017-05-11 03:56:07,988 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:864: 2017-05-11 04:00:49,297 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:873: 2017-05-11 04:05:33,522 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:874: 2017-05-11 04:05:34,453 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:875: 2017-05-11 04:05:34,457 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:876: 2017-05-11 04:05:35,043 fail2ban.actions [1590]: NOTICE [blacklist] 95.141.35.200 already banned
:880: 2017-05-11 04:15:34,501 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:885: 2017-05-11 04:19:39,824 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:903: 2017-05-11 04:24:22,187 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:905: 2017-05-11 04:29:05,431 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:906: 2017-05-11 04:29:05,961 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:907: 2017-05-11 04:29:05,965 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:924: 2017-05-11 04:39:06,605 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:927: 2017-05-11 04:43:13,709 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:933: 2017-05-11 04:47:57,274 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:940: 2017-05-11 04:52:42,933 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:941: 2017-05-11 04:52:43,293 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:942: 2017-05-11 04:52:43,296 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:950: 2017-05-11 05:02:43,337 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:966: 2017-05-11 05:06:55,354 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:978: 2017-05-11 05:11:39,330 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:983: 2017-05-11 05:16:24,645 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:984: 2017-05-11 05:16:24,812 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:985: 2017-05-11 05:16:24,816 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:986: 2017-05-11 05:16:25,361 fail2ban.actions [1590]: NOTICE [blacklist] 95.141.35.200 already banned
:1006: 2017-05-11 05:26:24,844 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:1008: 2017-05-11 05:30:35,724 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1014: 2017-05-11 05:35:27,067 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1022: 2017-05-11 05:40:14,507 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1023: 2017-05-11 05:40:15,307 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:1024: 2017-05-11 05:40:15,311 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:1030: 2017-05-11 05:50:15,341 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:1035: 2017-05-11 05:54:37,603 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1038: 2017-05-11 05:59:22,218 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1042: 2017-05-11 06:04:04,460 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1043: 2017-05-11 06:04:04,819 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:1044: 2017-05-11 06:04:04,823 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:1054: 2017-05-11 06:14:04,839 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:1058: 2017-05-11 06:18:20,420 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1066: 2017-05-11 06:23:05,279 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1076: 2017-05-11 06:27:49,850 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1077: 2017-05-11 06:27:50,313 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:1078: 2017-05-11 06:27:50,317 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:1079: 2017-05-11 06:27:50,713 fail2ban.actions [1590]: NOTICE [blacklist] 95.141.35.200 already banned
:1106: 2017-05-11 06:37:50,568 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:1109: 2017-05-11 06:42:08,040 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1123: 2017-05-11 06:46:49,694 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1138: 2017-05-11 06:51:32,175 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1139: 2017-05-11 06:51:32,809 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:1140: 2017-05-11 06:51:32,813 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:1186: 2017-05-11 07:01:32,838 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:1193: 2017-05-11 07:05:40,292 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1203: 2017-05-11 07:10:21,348 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1216: 2017-05-11 07:15:10,147 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1217: 2017-05-11 07:15:10,276 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:1218: 2017-05-11 07:15:10,279 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:1230: 2017-05-11 07:25:10,524 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:1231: 2017-05-11 07:29:19,711 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1237: 2017-05-11 07:34:12,721 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1244: 2017-05-11 07:38:55,952 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1245: 2017-05-11 07:38:55,996 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:1246: 2017-05-11 07:38:55,999 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:1247: 2017-05-11 07:38:56,579 fail2ban.actions [1590]: NOTICE [blacklist] 95.141.35.200 already banned
:1253: 2017-05-11 07:48:56,033 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:1258: 2017-05-11 07:53:06,829 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1265: 2017-05-11 07:57:47,579 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1267: 2017-05-11 08:02:28,374 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1268: 2017-05-11 08:02:29,278 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:1269: 2017-05-11 08:02:29,282 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:1279: 2017-05-11 08:12:29,532 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:1280: 2017-05-11 08:16:36,899 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1284: 2017-05-11 08:21:24,903 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1290: 2017-05-11 08:26:10,291 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1291: 2017-05-11 08:26:11,007 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:1292: 2017-05-11 08:26:11,011 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:1298: 2017-05-11 08:36:11,055 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:1305: 2017-05-11 08:40:21,920 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1307: 2017-05-11 08:45:09,530 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1310: 2017-05-11 08:49:53,938 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1311: 2017-05-11 08:49:54,539 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:1312: 2017-05-11 08:49:54,542 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:1313: 2017-05-11 08:49:54,937 fail2ban.actions [1590]: NOTICE [blacklist] 95.141.35.200 already banned
:1324: 2017-05-11 08:59:54,576 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:1326: 2017-05-11 09:04:10,387 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1331: 2017-05-11 09:08:53,483 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1336: 2017-05-11 09:13:37,176 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1337: 2017-05-11 09:13:38,056 fail2ban.actions [1590]: NOTICE [asterisk] Ban 95.141.35.200
:1338: 2017-05-11 09:13:38,060 fail2ban.filter [1590]: INFO [blacklist] Found 95.141.35.200
:1354: 2017-05-11 09:23:38,096 fail2ban.actions [1590]: NOTICE [asterisk] Unban 95.141.35.200
:1361: 2017-05-11 09:27:45,638 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200
:1365: 2017-05-11 09:32:28,673 fail2ban.filter [1590]: INFO [asterisk] Found 95.141.35.200

Regards
Sathees

A couple issues

ip.blacklist has duplicated every IP the filter has put on it and when I remove the dupes, they come back after a reboot. Consequently, every IP has been duped on IPtables as well. Everything works as intended other than this.

Is there a way to get this to watch other filters than just SSH? Like say [Postfix-Auth] or any other custom filter? So far this filter seems to only care about SSH.

Ubuntu Server 18.04 - F2B 10

Thank so much

Receive Email of Banned IP's on Fail2Ban Restart

I was trying out your code (works very well, btw!) however I've found that if I restart Fail2Ban I receive an email for each banned IP, as if it's rescanning/processing all of the logs at startup and not excluding notifications for those in the ip.blacklist file.

Is this expected behavior?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.