As the Wiki for fail2ban is a little less than explanatory than it could be, here are my own notes on setting up fail2ban to block pop3 attacks.
Have been seeing sample dictionary attacks on some servers for a while now from random ip addresses – eg
Sep 28 13:01:03 www vpopmail[20411]: vchkpw-pop3: vpopmail user not found web@:24.153.205.71
Sep 28 13:01:09 www vpopmail[20417]: vchkpw-pop3: vpopmail user not found web@:24.153.205.71
Sep 28 13:01:11 www vpopmail[20420]: vchkpw-pop3: vpopmail user not found web@:24.153.205.71
Annoying, but not realistically going to provide much of a security issue – most of the user names are the generic ones which aren’t actually in use on the servers.
As we already use fail2ban to perform basic service blocks against naughty script kiddie wannabee’s, why not have it block vpopmail attacks also.
Our mail error logs are located in /var/log/mail.log
As you saw above, the logs show the same common text for each failed login –
A simple regex to identify that in the logs would look like this (as per the fail2ban wiki)
First step is to create a filter for fail2ban.
Create /etc/fail2ban/filter.d/vpopmail.conf as below:
#
# Author: Lawrence Sheed
#
# $Revision: 1.0 $
#
[Definition]
# Option: failregex
# Notes.: regex to match the password failures messages in the logfile.
# Values: TEXT
#
failregex = vchkpw-pop3: vpopmail user not found .*@:<HOST>$
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
Second step is to add our filter to the fail2ban setup
Add this to the bottom of /etc/fail2ban/jail.conf
enabled = true
port = pop3
filter = vpopmail
logpath = /var/log/mail.log
maxretry = 3
logpath should be amended to whatever your mail logs for vpopmail appear.
maxretry should be set to a value that you agree with.
Restart fail2ban with a: /etc/init.d/fail2ban restart
and check that it has added the filter.
tail /var/log/fail2ban.log
You should see a line like this:
If so, you’re all set!
Post comment
Archives
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
Categories
- Apple
- Badges
- China Related
- Cool Hunting
- Exploits
- Food
- General Talk
- IP Cam
- iPhone
- MySQL
- Service Issues
- Tao Bao
- Technical Mumbo Jumbo
- Things that will get me censored
- Travel
- Uncategorized
- Useful Info
Most Popular Posts
- Samsung N310 (Samsung Go) Hackintosh Installation on Snow Leopard (20842)
- T60 screen upgrade (they just don't make things like they used to...) (9559)
- Hacker attacks on the rise (Its those damn American's mostly, attacking us poor Chinese users) (5987)
- CSR (Corporate Social Responsibility) (5158)
- How to make biltong (1685)
Tags
Recent Comments
-
jocc: finally. I done the installation properly. I made a USB drive (at less 8GB) formatted wih GUID labelled...
-
Lawrence Sheed: It gets an ip address via DHCP, so you need to provide DHCP service on something like a router or...
-
Denis: I Can noit connected to cam after RESET! What is my ip by factory ?
-
Lawrence Sheed: Yes, you need to have had a license for at least one year. Thats correct. When I’m back...
-
Lawrence Sheed: First off, do a list of your partitions. in the boot loader – ls If you really have erased...



ICP Permit
Webmail
Newsletters
Support

















