mirror of https://github.com/fail2ban/fail2ban
- Propagated patches from Yaroslav Halchenko
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_6@449 a942ae1a-1317-0410-a47c-b1dcaea8d6050.6
parent
adf7827efd
commit
8a253db9b5
10
CHANGELOG
10
CHANGELOG
|
@ -4,12 +4,16 @@
|
||||||
|_| \__,_|_|_/___|_.__/\__,_|_||_|
|
|_| \__,_|_|_/___|_.__/\__,_|_||_|
|
||||||
|
|
||||||
=============================================================
|
=============================================================
|
||||||
Fail2Ban (version 0.6.?) 2006/??/??
|
Fail2Ban (version 0.6.2) 2006/??/??
|
||||||
=============================================================
|
=============================================================
|
||||||
|
|
||||||
ver. 0.6.? (2006/??/??) - ???
|
ver. 0.6.2 (2006/??/??) - ???
|
||||||
----------
|
----------
|
||||||
- Fixed UTF-8 log file parsing
|
- Fixed UTF-8 log file parsing
|
||||||
|
- Propagated patches introduced by Debian maintainer
|
||||||
|
(Yaroslav Halchenko):
|
||||||
|
* Made locale configurable
|
||||||
|
* Fixed warning if ignoreip is empty
|
||||||
|
|
||||||
ver. 0.6.1 (2006/03/16) - stable
|
ver. 0.6.1 (2006/03/16) - stable
|
||||||
----------
|
----------
|
||||||
|
@ -26,7 +30,7 @@ ver. 0.6.1 (2006/03/16) - stable
|
||||||
- Added parsing of timestamp in TAI64N format (#1275325).
|
- Added parsing of timestamp in TAI64N format (#1275325).
|
||||||
Thanks to Mark Edgington
|
Thanks to Mark Edgington
|
||||||
- Added patch #1382936 (Default formatted syslog logging).
|
- Added patch #1382936 (Default formatted syslog logging).
|
||||||
Thanks to Patrick Börjesson
|
Thanks to Patrick B<EFBFBD>rjesson
|
||||||
- Removed 192.168.0.0/16 from ignoreip. Attacks could also
|
- Removed 192.168.0.0/16 from ignoreip. Attacks could also
|
||||||
come from the local network.
|
come from the local network.
|
||||||
- Robust startup: if iptables module does not get fully
|
- Robust startup: if iptables module does not get fully
|
||||||
|
|
|
@ -11,6 +11,15 @@
|
||||||
#
|
#
|
||||||
background = false
|
background = false
|
||||||
|
|
||||||
|
# Option: locale
|
||||||
|
# Notes.: global (cannot be redefined per section) locale to use for
|
||||||
|
# timestamp pattern matching by changing LC_TIME for
|
||||||
|
# fail2ban process. Empty entry sets locale to default one
|
||||||
|
# (usually specified by LC_ALL environment variable).
|
||||||
|
# Values: LOCALE Default:
|
||||||
|
#
|
||||||
|
locale =
|
||||||
|
|
||||||
# Option: logtargets
|
# Option: logtargets
|
||||||
# Notes.: log targets. Space separated list of logging targets.
|
# Notes.: log targets. Space separated list of logging targets.
|
||||||
# Values: STDERR SYSLOG file Default: /var/log/fail2ban.log
|
# Values: STDERR SYSLOG file Default: /var/log/fail2ban.log
|
||||||
|
|
|
@ -11,6 +11,15 @@
|
||||||
#
|
#
|
||||||
background = false
|
background = false
|
||||||
|
|
||||||
|
# Option: locale
|
||||||
|
# Notes.: global (cannot be redefined per section) locale to use for
|
||||||
|
# timestamp pattern matching by changing LC_TIME for
|
||||||
|
# fail2ban process. Empty entry sets locale to default one
|
||||||
|
# (usually specified by LC_ALL environment variable).
|
||||||
|
# Values: LOCALE Default:
|
||||||
|
#
|
||||||
|
locale =
|
||||||
|
|
||||||
# Option: logtargets
|
# Option: logtargets
|
||||||
# Notes.: log targets. Space separated list of logging targets.
|
# Notes.: log targets. Space separated list of logging targets.
|
||||||
# Values: STDERR SYSLOG file Default: /var/log/fail2ban.log
|
# Values: STDERR SYSLOG file Default: /var/log/fail2ban.log
|
||||||
|
|
|
@ -11,6 +11,15 @@
|
||||||
#
|
#
|
||||||
background = false
|
background = false
|
||||||
|
|
||||||
|
# Option: locale
|
||||||
|
# Notes.: global (cannot be redefined per section) locale to use for
|
||||||
|
# timestamp pattern matching by changing LC_TIME for
|
||||||
|
# fail2ban process. Empty entry sets locale to default one
|
||||||
|
# (usually specified by LC_ALL environment variable).
|
||||||
|
# Values: LOCALE Default:
|
||||||
|
#
|
||||||
|
locale =
|
||||||
|
|
||||||
# Option: logtargets
|
# Option: logtargets
|
||||||
# Notes.: log targets. Space separated list of logging targets.
|
# Notes.: log targets. Space separated list of logging targets.
|
||||||
# Values: STDERR SYSLOG file Default: /var/log/fail2ban.log
|
# Values: STDERR SYSLOG file Default: /var/log/fail2ban.log
|
||||||
|
|
9
fail2ban
9
fail2ban
|
@ -26,14 +26,7 @@ __date__ = "$Date$"
|
||||||
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
||||||
__license__ = "GPL"
|
__license__ = "GPL"
|
||||||
|
|
||||||
import sys, traceback, logging, locale
|
import sys, traceback, logging
|
||||||
|
|
||||||
# Set the locale with the user's default setting
|
|
||||||
try:
|
|
||||||
locale.setlocale(locale.LC_ALL, '')
|
|
||||||
except Exception:
|
|
||||||
print "Unable to set locale to " + `locale.getdefaultlocale()`
|
|
||||||
sys.exit(-1)
|
|
||||||
|
|
||||||
# Inserts our own modules path first in the list
|
# Inserts our own modules path first in the list
|
||||||
# fix for bug #343821
|
# fix for bug #343821
|
||||||
|
|
20
fail2ban.py
20
fail2ban.py
|
@ -25,7 +25,8 @@ __date__ = "$Date$"
|
||||||
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
||||||
__license__ = "GPL"
|
__license__ = "GPL"
|
||||||
|
|
||||||
import time, sys, getopt, os, string, signal, logging, logging.handlers, copy
|
import time, sys, getopt, os, string, signal, logging, logging.handlers, \
|
||||||
|
copy, locale
|
||||||
from ConfigParser import *
|
from ConfigParser import *
|
||||||
|
|
||||||
from version import version
|
from version import version
|
||||||
|
@ -192,7 +193,7 @@ def main():
|
||||||
# Reads the command line options.
|
# Reads the command line options.
|
||||||
try:
|
try:
|
||||||
cmdOpts = 'hvVbdkc:t:i:r:p:'
|
cmdOpts = 'hvVbdkc:t:i:r:p:'
|
||||||
cmdLongOpts = ['help','version']
|
cmdLongOpts = ['help', 'version']
|
||||||
optList, args = getopt.getopt(sys.argv[1:], cmdOpts, cmdLongOpts)
|
optList, args = getopt.getopt(sys.argv[1:], cmdOpts, cmdLongOpts)
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
dispUsage()
|
dispUsage()
|
||||||
|
@ -217,6 +218,7 @@ def main():
|
||||||
["str", "syslog-target", "/dev/log"],
|
["str", "syslog-target", "/dev/log"],
|
||||||
["int", "syslog-facility", 1],
|
["int", "syslog-facility", 1],
|
||||||
["str", "pidlock", "/var/run/fail2ban.pid"],
|
["str", "pidlock", "/var/run/fail2ban.pid"],
|
||||||
|
["str", "locale", ""],
|
||||||
["int", "maxfailures", 5],
|
["int", "maxfailures", 5],
|
||||||
["int", "bantime", 600],
|
["int", "bantime", 600],
|
||||||
["int", "findtime", 600],
|
["int", "findtime", 600],
|
||||||
|
@ -236,6 +238,14 @@ def main():
|
||||||
# PID lock
|
# PID lock
|
||||||
pidLock.setPath(conf["pidlock"])
|
pidLock.setPath(conf["pidlock"])
|
||||||
|
|
||||||
|
# Set the LC_TIME with the user's default setting
|
||||||
|
try:
|
||||||
|
logSys.info("Setting LC_TIME locale option to '%s'"%conf["locale"])
|
||||||
|
locale.setlocale(locale.LC_TIME, conf["locale"])
|
||||||
|
except Exception:
|
||||||
|
logSys.error("Unable to set locale to '%s'"%conf["locale"])
|
||||||
|
sys.exit(-1)
|
||||||
|
|
||||||
# Now we can kill properly a running instance if needed
|
# Now we can kill properly a running instance if needed
|
||||||
if conf["kill"]:
|
if conf["kill"]:
|
||||||
pid = pidLock.exists()
|
pid = pidLock.exists()
|
||||||
|
@ -284,7 +294,7 @@ def main():
|
||||||
if len(syslogtargets) == 0: # everything default
|
if len(syslogtargets) == 0: # everything default
|
||||||
hdlr = logging.handlers.SysLogHandler()
|
hdlr = logging.handlers.SysLogHandler()
|
||||||
else:
|
else:
|
||||||
if not ( syslogtargets[0] == "" ): # got socket
|
if not (syslogtargets[0] == ""): # got socket
|
||||||
syslogtarget = syslogtargets[0]
|
syslogtarget = syslogtargets[0]
|
||||||
else: # got hostname and maybe a port
|
else: # got hostname and maybe a port
|
||||||
if syslogtargets[3] == "": # no port specified
|
if syslogtargets[3] == "": # no port specified
|
||||||
|
@ -326,7 +336,9 @@ def main():
|
||||||
"ONLY DISPLAYED IN THE LOG MESSAGES")
|
"ONLY DISPLAYED IN THE LOG MESSAGES")
|
||||||
|
|
||||||
# Ignores IP list
|
# Ignores IP list
|
||||||
ignoreIPList = conf["ignoreip"].split(' ')
|
# and filter out empty entries. Otherwise
|
||||||
|
# WARNING: is not a valid IP address
|
||||||
|
ignoreIPList = filter(None, conf["ignoreip"].split(' '))
|
||||||
|
|
||||||
# Checks for root user. This is necessary because log files
|
# Checks for root user. This is necessary because log files
|
||||||
# are owned by root and firewall needs root access.
|
# are owned by root and firewall needs root access.
|
||||||
|
|
Loading…
Reference in New Issue