# This file is part of Fail2Ban. # # Fail2Ban is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Fail2Ban is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Fail2Ban; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Author: Cyril Jaquier # Modified by: Yaroslav Halchenko (SYSLOG, findtime, and oth) # # $Revision: 1.24 $ __author__ = "Cyril Jaquier" __version__ = "$Revision: 1.24 $" __date__ = "$Date: 2006/01/22 11:10:29 $" __copyright__ = "Copyright (c) 2004 Cyril Jaquier" __license__ = "GPL" import time, sys, getopt, os, string, signal, logging, logging.handlers, copy from ConfigParser import * from version import version from firewall.firewall import Firewall from logreader.logreader import LogReader from confreader.configreader import ConfigReader from utils.mail import Mail from utils.pidlock import PIDLock from utils.dns import * from utils.process import * # Get the instance of the logger. logSys = logging.getLogger("fail2ban") # Get PID lock file instance pidLock = PIDLock() # Global variables logFwList = list() conf = dict() def dispUsage(): """ Prints Fail2Ban command line options and exits """ print "Usage: "+sys.argv[0]+" [OPTIONS]" print print "Fail2Ban v"+version+" reads log file that contains password failure report" print "and bans the corresponding IP addresses using firewall rules." print print " -b start in background" print " -d start in debug mode" print " -c read configuration file FILE" print " -p create PID lock in FILE" print " -h display this help message" print " -i IP(s) to ignore" print " -k kill a currently running instance" print " -r allow a max of VALUE password failures [maxfailures]" print " -t