Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 May 2012 16:58:42 GMT
From:      julien tayon <julien@tayon.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/167530: [fix included] fail2ban will never ever start with the given rc.d script
Message-ID:  <201205021658.q42Gwgg3044524@red.freebsd.org>
Resent-Message-ID: <201205021700.q42H0Psr043549@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         167530
>Category:       ports
>Synopsis:       [fix included] fail2ban will never ever start with the given rc.d script
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 02 17:00:24 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     julien tayon
>Release:        8.3
>Organization:
me myself & I 
>Environment:
FreeBSD lupin 8.3-RELEASE FreeBSD 8.3-RELEASE #0: Mon Apr  9 21:23:18 UTC 2012     root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
fail2ban dont start 

because  /usr/local/etc/rc.d/fail2ban  never could have ever worked 

(anyone has ever tried to make it start ? )
>How-To-Repeat:
service fail2ban start
Ctrl+C (service is not backgrounded :/)


ps aux | grep fail[2] &> /dev/null && echo "QA tested!" || echo "Baka!"


>Fix:


vi /usr/local/etc/rc.d/fail2ban

#!/bin/sh
#
# PROVIDE: fail2ban
# REQUIRE: DAEMON
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable fail2ban:
# 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}"

server="/usr/local/bin/fail2ban-server"
command_interpreter="/usr/local/bin/python2.7"
client="/usr/local/bin/fail2ban-client"

extra_commands="reload jailstatus"

load_rc_config ${name}

start_cmd="${server} -b ${fail2ban_flags} start"
stop_cmd="${server} ${fail2ban_flags} stop"
reload_cmd="${server} ${fail2ban_flags} reload"
jailstatus_cmd="${server} ${fail2ban_flags} status"

run_rc_command "$1"


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205021658.q42Gwgg3044524>