mirror of https://github.com/fail2ban/fail2ban
amend to f3dbc9dda10e52610e3de26f538b5581fd905505: change main thread-name back to `fail2ban-server`;
implements new command line option `--pname` to specify it by start of server (default `fail2ban-server`); closes gh-2623 (revert change of main thread-name, because it can affect process-name too, so `pgrep` & co. may be confused)pull/2630/head
parent
9c7bd80807
commit
3f48907064
|
@ -97,6 +97,7 @@ class Fail2banCmdLine():
|
||||||
output(" -c <DIR> configuration directory")
|
output(" -c <DIR> configuration directory")
|
||||||
output(" -s <FILE> socket path")
|
output(" -s <FILE> socket path")
|
||||||
output(" -p <FILE> pidfile path")
|
output(" -p <FILE> pidfile path")
|
||||||
|
output(" --pname <NAME> name of the process (main thread) to identify instance (default fail2ban-server)")
|
||||||
output(" --loglevel <LEVEL> logging level")
|
output(" --loglevel <LEVEL> logging level")
|
||||||
output(" --logtarget <TARGET> logging target, use file-name or stdout, stderr, syslog or sysout.")
|
output(" --logtarget <TARGET> logging target, use file-name or stdout, stderr, syslog or sysout.")
|
||||||
output(" --syslogsocket auto|<FILE>")
|
output(" --syslogsocket auto|<FILE>")
|
||||||
|
@ -185,7 +186,7 @@ class Fail2banCmdLine():
|
||||||
try:
|
try:
|
||||||
cmdOpts = 'hc:s:p:xfbdtviqV'
|
cmdOpts = 'hc:s:p:xfbdtviqV'
|
||||||
cmdLongOpts = ['loglevel=', 'logtarget=', 'syslogsocket=', 'test', 'async',
|
cmdLongOpts = ['loglevel=', 'logtarget=', 'syslogsocket=', 'test', 'async',
|
||||||
'timeout=', 'str2sec=', 'help', 'version', 'dp', '--dump-pretty']
|
'pname=', 'timeout=', 'str2sec=', 'help', 'version', 'dp', '--dump-pretty']
|
||||||
optList, self._args = getopt.getopt(self._argv[1:], cmdOpts, cmdLongOpts)
|
optList, self._args = getopt.getopt(self._argv[1:], cmdOpts, cmdLongOpts)
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
self.dispUsage()
|
self.dispUsage()
|
||||||
|
|
|
@ -80,8 +80,6 @@ class Server:
|
||||||
'Linux': '/dev/log',
|
'Linux': '/dev/log',
|
||||||
}
|
}
|
||||||
self.__prev_signals = {}
|
self.__prev_signals = {}
|
||||||
# replace real thread name with short process name (for top/ps/pstree or diagnostic):
|
|
||||||
prctl_set_th_name('f2b/server')
|
|
||||||
|
|
||||||
def __sigTERMhandler(self, signum, frame): # pragma: no cover - indirect tested
|
def __sigTERMhandler(self, signum, frame): # pragma: no cover - indirect tested
|
||||||
logSys.debug("Caught signal %d. Exiting", signum)
|
logSys.debug("Caught signal %d. Exiting", signum)
|
||||||
|
@ -112,6 +110,9 @@ class Server:
|
||||||
logSys.error(err)
|
logSys.error(err)
|
||||||
raise ServerInitializationError(err)
|
raise ServerInitializationError(err)
|
||||||
# We are daemon.
|
# We are daemon.
|
||||||
|
|
||||||
|
# replace main thread (and process) name to identify server (for top/ps/pstree or diagnostic):
|
||||||
|
prctl_set_th_name(conf.get("pname", "fail2ban-server"))
|
||||||
|
|
||||||
# Set all logging parameters (or use default if not specified):
|
# Set all logging parameters (or use default if not specified):
|
||||||
self.__verbose = conf.get("verbose", None)
|
self.__verbose = conf.get("verbose", None)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4.
|
||||||
.TH FAIL2BAN-CLIENT "1" "January 2020" "fail2ban-client v0.10.5" "User Commands"
|
.TH FAIL2BAN-CLIENT "1" "February 2020" "fail2ban-client v0.10.5" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
fail2ban-client \- configure and control the server
|
fail2ban-client \- configure and control the server
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -19,6 +19,9 @@ socket path
|
||||||
\fB\-p\fR <FILE>
|
\fB\-p\fR <FILE>
|
||||||
pidfile path
|
pidfile path
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-\-pname\fR <NAME>
|
||||||
|
name of the process (main thread) to identify instance (default fail2ban\-server)
|
||||||
|
.TP
|
||||||
\fB\-\-loglevel\fR <LEVEL>
|
\fB\-\-loglevel\fR <LEVEL>
|
||||||
logging level
|
logging level
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4.
|
||||||
.TH FAIL2BAN-SERVER "1" "January 2020" "fail2ban-server v0.10.5" "User Commands"
|
.TH FAIL2BAN-SERVER "1" "February 2020" "fail2ban-server v0.10.5" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
fail2ban-server \- start the server
|
fail2ban-server \- start the server
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -19,6 +19,9 @@ socket path
|
||||||
\fB\-p\fR <FILE>
|
\fB\-p\fR <FILE>
|
||||||
pidfile path
|
pidfile path
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-\-pname\fR <NAME>
|
||||||
|
name of the process (main thread) to identify instance (default fail2ban\-server)
|
||||||
|
.TP
|
||||||
\fB\-\-loglevel\fR <LEVEL>
|
\fB\-\-loglevel\fR <LEVEL>
|
||||||
logging level
|
logging level
|
||||||
.TP
|
.TP
|
||||||
|
|
Loading…
Reference in New Issue