From owner-svn-ports-head@freebsd.org Tue Nov 21 18:55:29 2017 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 819BEDF6CC8; Tue, 21 Nov 2017 18:55:29 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E1107BA7F; Tue, 21 Nov 2017 18:55:29 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vALItSaZ022192; Tue, 21 Nov 2017 18:55:28 GMT (envelope-from zeising@FreeBSD.org) Received: (from zeising@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vALItSGT022190; Tue, 21 Nov 2017 18:55:28 GMT (envelope-from zeising@FreeBSD.org) Message-Id: <201711211855.vALItSGT022190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zeising set sender to zeising@FreeBSD.org using -f From: Niclas Zeising Date: Tue, 21 Nov 2017 18:55:28 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r454649 - in head/security/suricata: . files X-SVN-Group: ports-head X-SVN-Commit-Author: zeising X-SVN-Commit-Paths: in head/security/suricata: . files X-SVN-Commit-Revision: 454649 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Nov 2017 18:55:29 -0000 Author: zeising Date: Tue Nov 21 18:55:28 2017 New Revision: 454649 URL: https://svnweb.freebsd.org/changeset/ports/454649 Log: Fix suricata failing to start if there is a stale pid file laying around. This can happen if suricata is ungracefully shut down. PR: 223052, 223322 Submitted by: Reshad Patuck, Franco Fichtner Approved by: Franco Fichtner (maintainer) MFH: 2017Q4 Modified: head/security/suricata/Makefile head/security/suricata/files/suricata.in Modified: head/security/suricata/Makefile ============================================================================== --- head/security/suricata/Makefile Tue Nov 21 18:50:58 2017 (r454648) +++ head/security/suricata/Makefile Tue Nov 21 18:55:28 2017 (r454649) @@ -3,6 +3,7 @@ PORTNAME= suricata PORTVERSION= 4.0.0 +PORTREVISION= 1 CATEGORIES= security MASTER_SITES= http://www.openinfosecfoundation.org/download/ Modified: head/security/suricata/files/suricata.in ============================================================================== --- head/security/suricata/files/suricata.in Tue Nov 21 18:50:58 2017 (r454648) +++ head/security/suricata/files/suricata.in Tue Nov 21 18:55:28 2017 (r454649) @@ -19,13 +19,17 @@ # Default: 8000 # suricata_netmap (str): Set to YES to enable netmap (Inline Mode) # Default: NO +# suricata_user (str): Set the user to run suricata as +# Default: root +# suricata_pidfile (str): Pidfile to store pid of suricata process +# Default: /var/run/suricata.pid - . /etc/rc.subr name="suricata" rcvar=suricata_enable +start_precmd="suricata_prestart" command="%%PREFIX%%/bin/suricata" load_rc_config $name @@ -35,6 +39,8 @@ load_rc_config $name [ -z "$suricata_flags" ] && suricata_flags="-D" [ -z "$suricata_divertport" ] && suricata_divertport="8000" [ -z "$suricata_netmap" ] && suricata_netmap="NO" +[ -z "$suricata_user" ] && suricata_user="root" +[ -z "$suricata_pidfile" ] && suricata_pidfile="/var/run/suricata.pid" if [ -n "$suricata_interface" ]; then for interface in $suricata_interface; do @@ -47,9 +53,16 @@ else info "Inline Mode on divert port $suricata_divertport (suricata_interface not defined)" fi -pidfile="/var/run/suricata.pid" +pidfile=$suricata_pidfile suricata_flags="$suricata_flags --pidfile $pidfile" [ -n "$suricata_conf" ] && suricata_flags="$suricata_flags -c $suricata_conf" + +suricata_prestart() +{ + if ! run_rc_command status > /dev/null; then + rm -f "$pidfile" + fi +} run_rc_command "$1"