MFH: r503168 security/py-fail2ban: Fix rc script

The rc.d script evaluates fail2ban_pidfile before rc.conf is read.

This change moves those evaluations to the corect place allowing
users to override the values via /etc/rc.conf as expected.

PR:		236017
Reported by:	<epopen gmail com>, Dmitry Wagin <dmitry.wagin ya ru>
Submitted by:	<theis gmx at> (maintainer)

Approved by:	ports-secteam (blanket: bugfix)
This commit is contained in:
Kubilay Kocak 2019-07-01 06:19:57 +00:00
parent 7d1526bbba
commit 6433b76567
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/branches/2019Q2/; revision=505539
2 changed files with 9 additions and 4 deletions

View File

@ -2,6 +2,7 @@
PORTNAME= fail2ban
PORTVERSION= 0.10.4
PORTREVISION= 1
CATEGORIES= security python
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}

View File

@ -8,14 +8,10 @@
# fail2ban_enable="YES"
# fail2ban_flags="<set as needed>"
fail2ban_enable=${fail2ban_enable-"NO"}
fail2ban_pidfile=${fail2ban_pidfile-"/var/run/fail2ban/fail2ban.pid"}
. /etc/rc.subr
name="fail2ban"
rcvar=fail2ban_enable
pidfile="${fail2ban_pidfile}"
command="%%PREFIX%%/bin/fail2ban-server"
command_interpreter="%%PYTHON_CMD%%"
@ -25,6 +21,14 @@ extra_commands="reload jailstatus"
load_rc_config ${name}
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
# SET THEM IN THE /etc/rc.conf FILE
#
fail2ban_enable=${fail2ban_enable-"NO"}
pidfile=${fail2ban_pidfile-"/var/run/fail2ban/fail2ban.pid"}
start_cmd="${client} ${fail2ban_flags} start"
stop_cmd="${client} ${fail2ban_flags} stop"
reload_cmd="${client} ${fail2ban_flags} reload"