diff --git a/fail2ban-client b/fail2ban-client index d4ae216b..a5fd4eb7 100755 --- a/fail2ban-client +++ b/fail2ban-client @@ -58,17 +58,36 @@ class Fail2banClient: self.conf["force"] = False self.conf["verbose"] = 2 self.conf["interactive"] = False + + def dispVersion(self): + print "Fail2Ban v" + version + print + print "Copyright (c) 2004-2006 Cyril Jaquier" + print "Copyright of modifications held by their respective authors." + print "Licensed under the GNU General Public License v2 (GPL)." + print + print "Written by Cyril Jaquier <lostcontrol@users.sourceforge.net>." + print "Many contributions by Yaroslav O. Halchenko <debian@onerussian.com>." def dispUsage(self): """ Prints Fail2Ban command line options and exits """ - print "Usage: "+self.argv[0]+" [OPTIONS] <COMMAND>" + print "Usage: "+self.argv[0]+" [OPTIONS]... <COMMAND>" 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 " <COMMAND>" + print "Options:" + print " -c <DIR> configuration directory" + print " -d dump configuration. For debugging" + print " -i interactive mode" + print " -v increase verbosity" + print " -q decrease verbosity" + print " -x force execution of the server" + print " -h, --help display this help message" + print " -V, --version print the version" print + print "Command:" print " start start the server and the jails" print " reload reload the configuration" print " stop stop all jails and terminate the server" @@ -86,16 +105,6 @@ class Fail2banClient: print " stop <JAIL> stop <JAIL>. The jail is removed" print " status <JAIL> get the current status of <JAIL>" print - print " [OPTIONS]" - print - print " -c <DIR> configuration directory" - print " -d dump configuration. For debugging" - print " -i interactive mode" - print " -v increase verbosity" - print " -q decrease verbosity" - print " -x force execution of the server" - print " -h display this help message" - print print "Report bugs to <lostcontrol@users.sourceforge.net>" def dispInteractive(self): @@ -122,6 +131,9 @@ class Fail2banClient: elif opt[0] in ["-h", "--help"]: self.dispUsage() sys.exit(0) + elif opt[0] in ["-V", "--version"]: + self.dispVersion() + sys.exit(0) def ping(self): return self.processCmd([["ping"]], False) @@ -232,8 +244,8 @@ class Fail2banClient: # Reads the command line options. try: - cmdOpts = 'hc:xdviq' - cmdLongOpts = ['help'] + cmdOpts = 'hc:xdviqV' + cmdLongOpts = ['help', 'version'] optList, args = getopt.getopt(self.argv[1:], cmdOpts, cmdLongOpts) except getopt.GetoptError: self.dispUsage() diff --git a/fail2ban-server b/fail2ban-server index 67a14144..e3f91162 100755 --- a/fail2ban-server +++ b/fail2ban-server @@ -51,6 +51,16 @@ class Fail2banServer: self.conf["background"] = True self.conf["force"] = False + def dispVersion(self): + print "Fail2Ban v" + version + print + print "Copyright (c) 2004-2006 Cyril Jaquier" + print "Copyright of modifications held by their respective authors." + print "Licensed under the GNU General Public License v2 (GPL)." + print + print "Written by Cyril Jaquier <lostcontrol@users.sourceforge.net>." + print "Many contributions by Yaroslav O. Halchenko <debian@onerussian.com>." + def dispUsage(self): """ Prints Fail2Ban command line options and exits """ @@ -59,13 +69,16 @@ class Fail2banServer: print "Fail2Ban v" + version + " reads log file that contains password failure report" print "and bans the corresponding IP addresses using firewall rules." print + print "Only use this command for debugging purpose. Start the server with" + print "fail2ban-client instead." + print + print "Options:" print " -b start in background" print " -f start in foreground" print " -x force execution of the server" print " -h display this help message" print print "Report bugs to <lostcontrol@users.sourceforge.net>" - sys.exit(0) def getCmdLineOptions(self, optList): """ Gets the command line options @@ -79,6 +92,10 @@ class Fail2banServer: self.conf["force"] = True if opt[0] in ["-h", "--help"]: self.dispUsage() + sys.exit(0) + if opt[0] in ["-V", "--version"]: + self.dispVersion() + sys.exit(0) #def sigTERMhandler(signum, frame): # """ Handles the TERM signal when in daemon mode in order to @@ -93,8 +110,8 @@ class Fail2banServer: # Reads the command line options. try: - cmdOpts = 'bfxh' - cmdLongOpts = ['help'] + cmdOpts = 'bfxhV' + cmdLongOpts = ['help', 'version'] optList, args = getopt.getopt(self.argv[1:], cmdOpts, cmdLongOpts) except getopt.GetoptError: self.dispUsage() diff --git a/man/fail2ban-client.1 b/man/fail2ban-client.1 new file mode 100644 index 00000000..da6ca5bc --- /dev/null +++ b/man/fail2ban-client.1 @@ -0,0 +1,94 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. +.TH FAIL2BAN-CLIENT "1" "September 2006" "fail2ban-client v0.7.2" "User Commands" +.SH NAME +fail2ban-client \- configure and control the server +.SH SYNOPSIS +.B fail2ban-client +[\fIOPTIONS\fR]... \fI<COMMAND>\fR +.SH DESCRIPTION +Fail2Ban v0.7.2 reads log file that contains password failure report +and bans the corresponding IP addresses using firewall rules. +.SH OPTIONS +.TP +\fB\-c\fR <DIR> +configuration directory +.TP +\fB\-d\fR +dump configuration. For debugging +.TP +\fB\-i\fR +interactive mode +.TP +\fB\-v\fR +increase verbosity +.TP +\fB\-q\fR +decrease verbosity +.TP +\fB\-x\fR +force execution of the server +.TP +\fB\-h\fR, \fB\-\-help\fR +display this help message +.TP +\fB\-V\fR, \fB\-\-version\fR +print the version +.SH COMMAND +.SS "Command:" +.TP +start +start the server and the jails +.TP +reload +reload the configuration +.TP +stop +stop all jails and terminate the server +.TP +status +get the current status +.TP +set loglevel <LEVEL> +set loglevel to <LEVEL> +.TP +get loglevel +get loglevel +.TP +set logtarget <TARGET> +set log target to <TARGET> +.TP +get logtarget +get log target +.TP +add <JAIL> +create <JAIL> +.TP +set <JAIL> <CMD> +set the <CMD> value for <JAIL> +.TP +get <JAIL> <CMD> +get the <CMD> value for <JAIL> +.TP +start <JAIL> +start <JAIL> +.TP +stop <JAIL> +stop <JAIL>. The jail is removed +.TP +status <JAIL> +get the current status of <JAIL> +.SH FILES +\fI/etc/fail2ban/*\fR +.SH AUTHOR +Written by Cyril Jaquier <lostcontrol@users.sourceforge.net>. +Many contributions by Yaroslav O. Halchenko <debian@onerussian.com>. +.SH "REPORTING BUGS" +Report bugs to <lostcontrol@users.sourceforge.net> +.SH COPYRIGHT +Copyright \(co 2004-2006 Cyril Jaquier +.br +Copyright of modifications held by their respective authors. +Licensed under the GNU General Public License v2 (GPL). +.SH "SEE ALSO" +.br +fail2ban-server(1) diff --git a/man/fail2ban-client.h2m b/man/fail2ban-client.h2m new file mode 100644 index 00000000..eedb7eb5 --- /dev/null +++ b/man/fail2ban-client.h2m @@ -0,0 +1,15 @@ +Include file for help2man man page +$Id: $ + +[name] +fail2ban-client \- configure and control the server + +/print the version/ +.SH COMMAND + +[files] +\fI/etc/fail2ban/*\fR + +[see also] +.br +fail2ban-server(1) diff --git a/man/fail2ban-client.man b/man/fail2ban-client.man new file mode 100644 index 00000000..c390c2f9 --- /dev/null +++ b/man/fail2ban-client.man @@ -0,0 +1,94 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. +.TH FAIL2BAN-CLIENT "1" "September 2006" "fail2ban-client v0.7.2" "User Commands" +.SH NAME +fail2ban-client \- Ban IPs that make too many password failure +.SH SYNOPSIS +.B fail2ban-client +[\fIOPTIONS\fR]... \fI<COMMAND>\fR +.SH DESCRIPTION +Fail2Ban v0.7.2 reads log file that contains password failure report +and bans the corresponding IP addresses using firewall rules. +.SH OPTIONS +.TP +\fB\-c\fR <DIR> +configuration directory +.TP +\fB\-d\fR +dump configuration. For debugging +.TP +\fB\-i\fR +interactive mode +.TP +\fB\-v\fR +increase verbosity +.TP +\fB\-q\fR +decrease verbosity +.TP +\fB\-x\fR +force execution of the server +.TP +\fB\-h\fR, \fB\-\-help\fR +display this help message +.TP +\fB\-V\fR, \fB\-\-version\fR +print the version +.SH COMMAND +.SS "Command:" +.TP +start +start the server and the jails +.TP +reload +reload the configuration +.TP +stop +stop all jails and terminate the server +.TP +status +get the current status +.TP +set loglevel <LEVEL> +set loglevel to <LEVEL> +.TP +get loglevel +get loglevel +.TP +set logtarget <TARGET> +set log target to <TARGET> +.TP +get logtarget +get log target +.TP +add <JAIL> +create <JAIL> +.TP +set <JAIL> <CMD> +set the <CMD> value for <JAIL> +.TP +get <JAIL> <CMD> +get the <CMD> value for <JAIL> +.TP +start <JAIL> +start <JAIL> +.TP +stop <JAIL> +stop <JAIL>. The jail is removed +.TP +status <JAIL> +get the current status of <JAIL> +.SH FILES +\fI/etc/fail2ban/*\fR +.SH AUTHOR +Written by Cyril Jaquier <lostcontrol@users.sourceforge.net>. +Many contributions by Yaroslav O. Halchenko <debian@onerussian.com>. +.SH "REPORTING BUGS" +Report bugs to <lostcontrol@users.sourceforge.net> +.SH COPYRIGHT +Copyright \(co 2004-2006 Cyril Jaquier +.br +Copyright of modifications held by their respective authors. +Licensed under the GNU General Public License v2 (GPL). +.SH "SEE ALSO" +.br +fail2ban-server(1x) diff --git a/man/fail2ban-server.1 b/man/fail2ban-server.1 new file mode 100644 index 00000000..a7743a0c --- /dev/null +++ b/man/fail2ban-server.1 @@ -0,0 +1,41 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. +.TH FAIL2BAN-SERVER "1" "September 2006" "fail2ban-server v0.7.2" "User Commands" +.SH NAME +fail2ban-server \- start the server +.SH SYNOPSIS +.B fail2ban-server +[\fIOPTIONS\fR] +.SH DESCRIPTION +Fail2Ban v0.7.2 reads log file that contains password failure report +and bans the corresponding IP addresses using firewall rules. +.PP +Only use this command for debugging purpose. Start the server with +fail2ban\-client instead. +.SH OPTIONS +.TP +\fB\-b\fR +start in background +.TP +\fB\-f\fR +start in foreground +.TP +\fB\-x\fR +force execution of the server +.TP +\fB\-h\fR +display this help message +.SH FILES +\fI/etc/fail2ban/*\fR +.SH AUTHOR +Written by Cyril Jaquier <lostcontrol@users.sourceforge.net>. +Many contributions by Yaroslav O. Halchenko <debian@onerussian.com>. +.SH "REPORTING BUGS" +Report bugs to <lostcontrol@users.sourceforge.net> +.SH COPYRIGHT +Copyright \(co 2004-2006 Cyril Jaquier +.br +Copyright of modifications held by their respective authors. +Licensed under the GNU General Public License v2 (GPL). +.SH "SEE ALSO" +.br +fail2ban-client(1) diff --git a/man/fail2ban-server.h2m b/man/fail2ban-server.h2m new file mode 100644 index 00000000..d58a00f1 --- /dev/null +++ b/man/fail2ban-server.h2m @@ -0,0 +1,15 @@ +Include file for help2man man page +$Id: $ + +[name] +fail2ban-server \- start the server + +/print the version/ +.SH COMMAND + +[files] +\fI/etc/fail2ban/*\fR + +[see also] +.br +fail2ban-client(1) diff --git a/man/generate-man b/man/generate-man new file mode 100755 index 00000000..7794b556 --- /dev/null +++ b/man/generate-man @@ -0,0 +1,5 @@ +#!/bin/bash + +help2man --section=1 --no-info --include=fail2ban-client.h2m --output fail2ban-client.1 ../fail2ban-client +help2man --section=1 --no-info --include=fail2ban-server.h2m --output fail2ban-server.1 ../fail2ban-server +