Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sasl-iptables startup error v0.8.7.1 #83

Closed
AlexanderSk opened this issue Nov 1, 2012 · 5 comments
Closed

sasl-iptables startup error v0.8.7.1 #83

AlexanderSk opened this issue Nov 1, 2012 · 5 comments
Milestone

Comments

@AlexanderSk
Copy link

Hello,
I just upgraded from version 8.4 into v0.8.7.1 and everything went ok except

i am running 13 rules successfully but this one wont start anymore.

The error is:

2012-11-01 18:22:51,721 fail2ban.jail   : INFO   Creating new jail 'sasl-iptables'
2012-11-01 18:22:51,721 fail2ban.comm   : WARNING Command ['add', 'sasl-iptables', 'polling'] has failed. Received  <exceptions.AttributeError instance at 0x2ae329a9c518>

Do you have any idea what it might be!

info:
python -V
Python 2.4.3

The rule:

[sasl-iptables]

enabled  = true
filter = sasl
backend  = polling
action   = iptables[name=sasl, port=smtp, protocol=tcp]
#sendmail-whois[name=sasl, dest=xxx@email.com]
logpath  = /var/log/maillog
maxretry = 3
bantime = -1

The sasl.conf

# Fail2Ban configuration file
#
# Author: Yaroslav Halchenko
#
# $Revision$
#

[Definition]

# Option: failregex
# Notes.: regex to match the password failures messages in the logfile. The
#          host must be matched by a group named "host". The tag "<HOST>" can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
# Values: TEXT
#
failregex = (?i): warning: [-._\w]+\[<HOST>\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed(: [ A-Za-z0-9+/]*={0,2})?\s*$

# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =
@yarikoptic
Copy link
Member

Provide please entire jails file

Would you have a chance to try with freshier python?

Sent from a phone which beats iPhone.

@AlexanderSk
Copy link
Author

Hi i did not test with latest python i am on centos 5.4... i thing this is the lattest version from of repos.
This is the jail.conf file ( a bit edited for email info)

# Fail2Ban jail specifications file
#
# Comments: use '#' for comment lines and ';' for inline comments
#
# Changes:  in most of the cases you should not modify this
#           file, but provide customizations in jail.local file, e.g.:
#
# [DEFAULT]
# bantime = 3600
#
# [ssh-iptables]
# enabled = true
#

# The DEFAULT allows a global definition of the options. They can be overridden
# in each jail afterwards.

[DEFAULT]

# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
# ban a host which matches an address in this list. Several addresses can be
# defined using space separator.
ignoreip = 127.0.0.1/8 myserverip

# "bantime" is the number of seconds that a host is banned.

bantime  = 9600

# A host is banned if it has generated "maxretry" during the last "findtime"
# seconds.
findtime  = 10800

# "maxretry" is the number of failures before a host get banned.
maxretry = 3

# "backend" specifies the backend used to get files modification.
# Available options are "pyinotify", "gamin", "polling" and "auto".
# This option can be overridden in each jail as well.
#
# pyinotify: requires pyinotify (a file alteration monitor) to be installed.
#              If pyinotify is not installed, Fail2ban will use auto.
# gamin:     requires Gamin (a file alteration monitor) to be installed.
#              If Gamin is not installed, Fail2ban will use auto.
# polling:   uses a polling algorithm which does not require external libraries.
# auto:      will try to use the following backends, in order:
#              pyinotify, gamin, polling.
backend = auto

# "usedns" specifies if jails should trust hostnames in logs,
#   warn when reverse DNS lookups are performed, or ignore all hostnames in logs
#
# yes:   if a hostname is encountered, a reverse DNS lookup will be performed.
# warn:  if a hostname is encountered, a reverse DNS lookup will be performed, 
#        but it will be logged as a warning.
# no:    if a hostname is encountered, will not be used for banning,
#        but it will be logged as info.
usedns = warn


# This jail corresponds to the standard configuration in Fail2ban 0.6.
# The mail-whois action send a notification e-mail with a whois request
# in the body.

[ssh-iptables]

enabled = true 
filter = sshd
action = iptables[name=SSH, port=ssh, protocol=tcp]
sendmail-whois[name=SSH, dest=myemail.com, sender=me@myserver.com]
logpath  = /var/log/secure
maxretry = 4
bantime = 86400

[Pure-FTPd-iptables]

enabled = true
filter = pure-ftpd
action = iptables[name=PureFTPD, port=ftp, protocol=tcp]
#sendmail-whois[name=PureFTPD, dest=myemail.com]
logpath = /var/log/messages
maxretry = 5

[proftpd-iptables]

enabled  = false
filter   = proftpd
action   = iptables[name=ProFTPD, port=ftp, protocol=tcp]
           sendmail-whois[name=ProFTPD, dest=you@example.com]
logpath  = /var/log/proftpd/proftpd.log
maxretry = 6

# This jail forces the backend to "polling".

[sasl-iptables]

enabled  = true
filter = sasl
backend  = polling
action   = iptables[name=sasl, port=smtp, protocol=tcp]
#sendmail-whois[name=sasl, dest=myemail.com]
logpath  = /var/log/maillog
maxretry = 3
bantime = -1

# Here we use TCP-Wrappers instead of Netfilter/Iptables. "ignoreregex" is
# used to avoid banning the user "myuser".

[ssh-tcpwrapper]

enabled     = false
filter      = sshd
action      = hostsdeny
              sendmail-whois[name=SSH, dest=you@example.com]
ignoreregex = for myuser from
logpath     = /var/log/sshd.log

[squirrelmail-iptables]
enabled  = true
filter   = squirrelmail
action   = iptables-multiport[name=SquirrelMail, port="http,https", protocol=tcp]
#sendmail-whois[name=SquirrelMail, dest=myemail.com, sender=fail2ban@digi-web.gr]
logpath  = /var/lib/squirrelmail/prefs/squirrelmail_access_log
maxretry = 4

[dovecot-pop3imap]

enabled  = true
filter   = dovecot-pop3imap
action   = iptables-multiport[name=dovecot-pop3imap, port="pop3,pop3s,imap,imaps", protocol=tcp]
#action = iptables-allports[name=dovecot-pop3imap]
#sendmail-whois[name=dovecot-pop3imap, dest=root, sender=fail2ban@digi-web.gr]
logpath  = /var/log/maillog
#/var/log/secure
maxretry = 5
findtime = 1200
bantime  = 1200

[dovecot-iptables]

enabled = false
filter = dovecot
action = iptables[name=Dovecot, port=110, protocol=tcp]
#sendmail-whois[name=Dovecot, dest=you@yourdomain.com, sender=fail2ban@yourdomain.com]
logpath = /var/log/secure
maxretry = 5

[postfix]

enabled  = true
filter   = postfix
action   = iptables[name=Postfix, port=smtp, protocol=tcp]
#sendmail-whois[name=Postfix, dest=myemail.com, sender=fail2ban@digi-web.gr]
logpath  = /var/log/maillog
#/var/log/secure
maxretry = 5
bantime = 1200

# The hosts.deny path can be defined with the "file" argument if it is
# not in /etc.

[postfix-tcpwrapper]

enabled  = false
filter   = postfix
action   = hostsdeny[file=/not/a/standard/path/hosts.deny]
           sendmail[name=Postfix, dest=you@example.com]
logpath  = /var/log/postfix.log
bantime  = 300

# Do not ban anybody. Just report information about the remote host.
# A notification is sent at most every 600 seconds (bantime).

[vsftpd-notification]

enabled  = false
filter   = vsftpd
action   = sendmail-whois[name=VSFTPD, dest=you@example.com]
logpath  = /var/log/vsftpd.log
maxretry = 5
bantime  = 1800

# Same as above but with banning the IP address.

[vsftpd-iptables]

enabled  = false
filter   = vsftpd
action   = iptables[name=VSFTPD, port=ftp, protocol=tcp]
           sendmail-whois[name=VSFTPD, dest=you@example.com]
logpath  = /var/log/vsftpd.log
maxretry = 5
bantime  = 1800

# Ban hosts which agent identifies spammer robots crawling the web
# for email addresses. The mail outputs are buffered.

[apache-badbots]

enabled  = true
filter = apache-badbots
action = iptables-multiport[name=apacheBadbods, port="http,https"]
#action = iptables-allports[name=apacheBadbots]
#sendmail-buffered[name=BadBots, lines=5, dest=myemail.com]
logpath = /var/log/httpd/*access_log
bantime  = 172800
maxretry = 1

[apache-tcpwrapper]

enabled  = true
filter = apache-auth
action =  iptables-multiport[name=apache-auth, port="http,https"]
#sendmail-whois[name=Apache-tcpwrap, dest=myemail.com]
logpath = /var/log/httpd/*error_log
maxretry = 5

[apache-pma]

enabled = true
filter = apache-pma
action = iptables-multiport[name=apacePma, port="http,https"]
#action = iptables-allports[name=apachePma]
#sendmail-whois[name=apachepma, dest=myemail.com]
logpath = /var/log/httpd/*access_log
bantime = 19600
maxretry = 2

[apache-logins]

enabled = false
filter = apache-logins
action = iptables-multiport[name=apachelogin, port="http,https", protocol=tcp]
         sendmail-whois[name=apachelogin, dest=myemail.com]
#logpath = /var/log/ispconfig/httpd/*/error.log
logpath = /var/log/httpd/*error_log
bantime = 600
maxretry = 3

[apache-badURLs]

enabled = false
filter = apache-badURLs
action = iptables-multiport[name=badURLs, port="http,https", protocol=tcp]
#sendmail-whois[name=badURLs, dest=myemail.com, sender=me@myserver.com]
logpath = /var/log/httpd/*access_log
maxretry = 3

[apache-monit]

enabled = true
filter = apache-monit
action =  iptables-multiport[name=apache-monit, port="http,https"]
#sendmail-whois[name=Apache-monit, dest=myemail.com]
logpath = /var/log/monit.log
maxretry = 3

[apache-w00tw00t]
enabled  = true
filter = apache-w00tw00t
action =  iptables-multiport[name=w00tw00t, port="http,https"]
#action = iptables-allports[name=w00tw00t]
#sendmail-whois[name=w00tw00t, dest=myemail.com, sender=me@myserver.com]
logpath = /var/log/httpd/*access_log
maxretry = 3
## -- don't unban
bantime  = -1

# Use shorewall instead of iptables.

[apache-shorewall]

enabled  = false
filter   = apache-noscript
action   = shorewall
           sendmail[name=Postfix, dest=you@example.com]
logpath  = /var/log/apache2/error_log

[fail2ban]
enabled = false
filter = fail2ban
action = iptables-allports[name=fail2ban]
#sendmail-whois[name=myemail.com]
logpath = /var/log/fail2ban.log*
# findtime: 1 week
findtime = 604800
# bantime: 1 week
bantime = 604800

# Ban attackers that try to use PHP's URL-fopen() functionality
# through GET/POST variables. - Experimental, with more than a year
# of usage in production environments.

[php-url-fopen]

enabled = true
#port    = http,https
filter  = php-url-fopen
action =  iptables-multiport[name=phpUrlFopen, port="http,https"]
#action = iptables-allports[name=phpUrlFopen]
logpath = /var/log/httpd/*access_log
maxretry = 1


# A simple PHP-fastcgi jail which works with lighttpd.
# If you run a lighttpd server, then you probably will
# find these kinds of messages in your error_log:
# ALERT – tried to register forbidden variable ‘GLOBALS’
# through GET variables (attacker '1.2.3.4', file '/var/www/default/htdocs/index.php')
# This jail would block the IP 1.2.3.4.

[lighttpd-fastcgi]

enabled = false
port    = http,https
filter  = lighttpd-fastcgi
# adapt the following two items as needed
logpath = /var/log/lighttpd/error.log
maxretry = 2

# Same as above for mod_auth
# It catches wrong authentifications

[lighttpd-auth]

enabled = false
port    = http,https
filter  = lighttpd-auth
# adapt the following two items as needed
logpath = /var/log/lighttpd/error.log
maxretry = 2

# This jail uses ipfw, the standard firewall on FreeBSD. The "ignoreip"
# option is overridden in this jail. Moreover, the action "mail-whois" defines
# the variable "name" which contains a comma using "". The characters '' are
# valid too.

[ssh-ipfw]

enabled  = false
filter   = sshd
action   = ipfw[localhost=192.168.0.1]
           sendmail-whois[name="SSH,IPFW", dest=you@example.com]
logpath  = /var/log/auth.log
ignoreip = 168.192.0.1

# These jails block attacks against named (bind9). By default, logging is off
# with bind9 installation. You will need something like this:
#
# logging {
#     channel security_file {
#         file "/var/log/named/security.log" versions 3 size 30m;
#         severity dynamic;
#         print-time yes;
#     };
#     category security {
#         security_file;
#     };
# };
#
# in your named.conf to provide proper logging.
# This jail blocks UDP traffic for DNS requests.

# !!! WARNING !!!
#   Since UDP is connection-less protocol, spoofing of IP and imitation
#   of illegal actions is way too simple.  Thus enabling of this filter
#   might provide an easy way for implementing a DoS against a chosen
#   victim. See
#    http://nion.modprobe.de/blog/archives/690-fail2ban-+-dns-fail.html
#   Please DO NOT USE this jail unless you know what you are doing.
#
# [named-refused-udp]
#
# enabled  = false
# filter   = named-refused
# action   = iptables-multiport[name=Named, port="domain,953", protocol=udp]
#            sendmail-whois[name=Named, dest=you@example.com]
# logpath  = /var/log/named/security.log
# ignoreip = 168.192.0.1

# This jail blocks TCP traffic for DNS requests.

[named-refused-tcp]

enabled  = true
filter   = named-refused
action   = iptables-multiport[name=Named, port="domain,953", protocol=tcp]
sendmail-whois[name=Named, dest=myemail.com]
logpath  = /var/log/messages
ignoreip =  78.46.65.234


# Multiple jails, 1 per protocol, are necessary ATM:
# see https://github.com/fail2ban/fail2ban/issues/37
[asterisk-tcp]

enabled  = false
filter   = asterisk
action   = iptables-multiport[name=asterisk-tcp, port="5060,5061", protocol=tcp]
           sendmail-whois[name=Asterisk, dest=you@example.com, sender=fail2ban@example.com]
logpath  = /var/log/asterisk/messages
maxretry = 10

[asterisk-udp]

enabled  = false
filter   = asterisk
action   = iptables-multiport[name=asterisk-udp, port="5060,5061", protocol=udp]
           sendmail-whois[name=Asterisk, dest=you@example.com, sender=fail2ban@example.com]
logpath  = /var/log/asterisk/messages
maxretry = 10

# Jail for more extended banning of persistent abusers
# !!! WARNING !!!
#   Make sure that your loglevel specified in fail2ban.conf/.local
#   is not at DEBUG level -- which might then cause fail2ban to fall into
#   an infinite loop constantly feeding itself with non-informative lines
[recidive]

enabled  = true
filter   = recidive
logpath  = /var/log/fail2ban.log
action   = iptables-allports[name=recidive]
           sendmail-whois-lines[name=recidive, logpath=/var/log/fail2ban.log]
bantime  = 604800  ; 1 week
findtime = 86400   ; 1 day
maxretry = 5

Thank you for your time :)

@yarikoptic
Copy link
Member

so -- works now?

On Thu, 01 Nov 2012, ASklepas wrote:

Hi i did not test with latest python i am on centos 5.4... i thing this is
the lattest version from of repos.

This is the jail.conf file ( a bit edited for email info)

Yaroslav O. Halchenko
Postdoctoral Fellow, Department of Psychological and Brain Sciences
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419
WWW: http://www.linkedin.com/in/yarik

@AlexanderSk
Copy link
Author

Hello,
I have re-installed the fail2ban with the new files and there is no problem.
Best Regards!

@riddertommie
Copy link

there is a error in the jail.conf

[sasl-iptables]

logpath = /var/log/maillog >>>>>> logpath = /var/log/mail.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants