adjusted to have proper description / actions for debug option

debian-releases/etch
Yaroslav Halchenko 2005-09-29 05:26:18 +00:00
parent 802dbea036
commit a1d7835cb6
4 changed files with 48 additions and 25 deletions

View File

@ -11,8 +11,19 @@
# #
background = true background = true
# Option: verbose
# Notes.: verbosity of the output.
# 0 - regular level
# 1 - INFO level
# 2 - DEBUG level (but commands get executed as opposed to
# debug option)
# Values: NUM Default: 0
#
verbose = 1
# Option: debug # Option: debug
# Notes.: enable debug mode. More verbose output and bypass root user test. # Notes.: enable debug mode. No real commands gets executed but only
# reported, more verbose output, bypass root user test.
# Values: [true | false] Default: false # Values: [true | false] Default: false
# #
debug = false debug = false

View File

@ -20,4 +20,4 @@
# Command line options for Fail2Ban. Refer to "fail2ban -h" for # Command line options for Fail2Ban. Refer to "fail2ban -h" for
# valid options. # valid options.
FAIL2BAN_OPTS="-v" FAIL2BAN_OPTS=""

10
debian/changelog vendored
View File

@ -1,3 +1,13 @@
fail2ban (0.5.4-3) unstable; urgency=low
* Resolved the mistery of debug mode in which commands are not really
executed: added verbose option to config file, removed -v from
/etc/default/fail2ban, reordered code a bit so that log targets are
setup right after background and then only loglevel (verbose,debug) is
processed, so the warning could be seen in the logs
-- Yaroslav Halchenko <debian@onerussian.com> Thu, 29 Sep 2005 00:20:43 -1000
fail2ban (0.5.4-2) unstable; urgency=low fail2ban (0.5.4-2) unstable; urgency=low
* Now exporting PATH explicitely in init.d/fail2ban script, to avoid * Now exporting PATH explicitely in init.d/fail2ban script, to avoid

View File

@ -180,6 +180,7 @@ def main():
["str", "syslog-target", "/dev/log"], ["str", "syslog-target", "/dev/log"],
["int", "syslog-facility", 1], ["int", "syslog-facility", 1],
["bool", "debug", False], ["bool", "debug", False],
["int", "verbose", conf["verbose"]],
["str", "pidlock", "/var/run/fail2ban.pid"], ["str", "pidlock", "/var/run/fail2ban.pid"],
["int", "maxfailures", 5], ["int", "maxfailures", 5],
["int", "bantime", 600], ["int", "bantime", 600],
@ -220,26 +221,7 @@ def main():
logSys.error("Unable to start daemon") logSys.error("Unable to start daemon")
sys.exit(-1) sys.exit(-1)
# Verbose level # First setup Log targets
if conf["verbose"]:
logSys.warn("Verbose level is "+`conf["verbose"]`)
if conf["verbose"] == 1:
logSys.setLevel(logging.INFO)
elif conf["verbose"] > 1:
logSys.setLevel(logging.DEBUG)
# Set debug log level
if conf["debug"]:
logSys.setLevel(logging.DEBUG)
formatterstring = ('%(levelname)s: [%(filename)s (%(lineno)d)] ' +
'%(message)s')
formatter = logging.Formatter("%(asctime)s " + formatterstring)
stdout.setFormatter(formatter)
logSys.warn("DEBUG MODE: FIREWALL COMMANDS ARE _NOT_ EXECUTED BUT " +
"ONLY DISPLAYED IN THE LOG MESSAGES")
# Process some options
# Log targets
# Bug fix for #1234699 # Bug fix for #1234699
os.umask(0077) os.umask(0077)
for target in conf["logtargets"].split(): for target in conf["logtargets"].split():
@ -290,6 +272,26 @@ def main():
hdlr.setFormatter(tformatter) hdlr.setFormatter(tformatter)
logSys.addHandler(hdlr) logSys.addHandler(hdlr)
# Process some options
# Verbose level
if conf["verbose"]:
logSys.warn("Verbose level is "+`conf["verbose"]`)
if conf["verbose"] == 1:
logSys.setLevel(logging.INFO)
elif conf["verbose"] > 1:
logSys.setLevel(logging.DEBUG)
# Set debug log level
if conf["debug"]:
logSys.setLevel(logging.DEBUG)
formatterstring = ('%(levelname)s: [%(filename)s (%(lineno)d)] ' +
'%(message)s')
formatter = logging.Formatter("%(asctime)s " + formatterstring)
stdout.setFormatter(formatter)
logSys.warn("DEBUG MODE: FIREWALL COMMANDS ARE _NOT_ EXECUTED BUT " +
"ONLY DISPLAYED IN THE LOG MESSAGES")
# Ignores IP list # Ignores IP list
ignoreIPList = conf["ignoreip"].split(' ') ignoreIPList = conf["ignoreip"].split(' ')