|
|
@ -63,7 +63,7 @@ def usage(): |
|
|
|
print " -l <FILE> log message in FILE" |
|
|
|
print " -l <FILE> log message in FILE" |
|
|
|
print " -r <VALUE> allow a max of VALUE password failure" |
|
|
|
print " -r <VALUE> allow a max of VALUE password failure" |
|
|
|
print " -t <TIME> ban IP for TIME seconds" |
|
|
|
print " -t <TIME> ban IP for TIME seconds" |
|
|
|
print " -v verbose" |
|
|
|
print " -v verbose. Use twice for greater effect" |
|
|
|
print " -w <FIWA> select the firewall to use. Can be iptables," |
|
|
|
print " -w <FIWA> select the firewall to use. Can be iptables," |
|
|
|
print " ipfwadm or ipfw" |
|
|
|
print " ipfwadm or ipfw" |
|
|
|
print |
|
|
|
print |
|
|
@ -212,7 +212,7 @@ if __name__ == "__main__": |
|
|
|
logSys.set_formatstring("%T %L %M") |
|
|
|
logSys.set_formatstring("%T %L %M") |
|
|
|
|
|
|
|
|
|
|
|
conf = dict() |
|
|
|
conf = dict() |
|
|
|
conf["verbose"] = False |
|
|
|
conf["verbose"] = 0 |
|
|
|
conf["background"] = False |
|
|
|
conf["background"] = False |
|
|
|
conf["debug"] = False |
|
|
|
conf["debug"] = False |
|
|
|
conf["conffile"] = "/etc/fail2ban.conf" |
|
|
|
conf["conffile"] = "/etc/fail2ban.conf" |
|
|
@ -357,7 +357,7 @@ if __name__ == "__main__": |
|
|
|
if opt[0] == "-h": |
|
|
|
if opt[0] == "-h": |
|
|
|
usage() |
|
|
|
usage() |
|
|
|
if opt[0] == "-v": |
|
|
|
if opt[0] == "-v": |
|
|
|
conf["verbose"] = True |
|
|
|
conf["verbose"] = conf["verbose"] + 1 |
|
|
|
if opt[0] == "-b": |
|
|
|
if opt[0] == "-b": |
|
|
|
conf["background"] = True |
|
|
|
conf["background"] = True |
|
|
|
if opt[0] == "-d": |
|
|
|
if opt[0] == "-d": |
|
|
@ -393,8 +393,12 @@ if __name__ == "__main__": |
|
|
|
|
|
|
|
|
|
|
|
# Process some options |
|
|
|
# Process some options |
|
|
|
for c in conf: |
|
|
|
for c in conf: |
|
|
|
if c == "verbose" and conf[c]: |
|
|
|
if c == "verbose": |
|
|
|
logSys.set_loglevel(log4py.LOGLEVEL_VERBOSE) |
|
|
|
logSys.warn("Verbose level is "+`conf[c]`) |
|
|
|
|
|
|
|
if conf[c] == 1: |
|
|
|
|
|
|
|
logSys.set_loglevel(log4py.LOGLEVEL_VERBOSE) |
|
|
|
|
|
|
|
elif conf[c] > 1: |
|
|
|
|
|
|
|
logSys.set_loglevel(log4py.LOGLEVEL_DEBUG) |
|
|
|
elif c == "debug" and conf[c]: |
|
|
|
elif c == "debug" and conf[c]: |
|
|
|
logSys.set_loglevel(log4py.LOGLEVEL_DEBUG) |
|
|
|
logSys.set_loglevel(log4py.LOGLEVEL_DEBUG) |
|
|
|
logSys.set_formatstring(log4py.FMT_DEBUG) |
|
|
|
logSys.set_formatstring(log4py.FMT_DEBUG) |
|
|
|