From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Feb 6 16:40:02 2013 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1E5D0626 for ; Wed, 6 Feb 2013 16:40:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id F0F08831 for ; Wed, 6 Feb 2013 16:40:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r16Ge1eZ064904 for ; Wed, 6 Feb 2013 16:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r16Ge1EE064903; Wed, 6 Feb 2013 16:40:01 GMT (envelope-from gnats) Resent-Date: Wed, 6 Feb 2013 16:40:01 GMT Resent-Message-Id: <201302061640.r16Ge1EE064903@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Mark Felder Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4C692FBB for ; Wed, 6 Feb 2013 16:32:14 +0000 (UTC) (envelope-from feld@feld.me) Received: from feld.me (unknown [IPv6:2607:f4e0:100:300::2]) by mx1.freebsd.org (Postfix) with ESMTP id 2C7D779D for ; Wed, 6 Feb 2013 16:32:11 +0000 (UTC) Received: from feld by feld.me with local (Exim 4.80.1 (FreeBSD)) (envelope-from ) id 1U37um-000Aig-Is; Wed, 06 Feb 2013 10:32:04 -0600 Message-Id: Date: Wed, 06 Feb 2013 10:32:04 -0600 From: Mark Felder To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: ports/175890: [PATCH] net-mgmt/p0f2: add rc script Cc: catone@cpan.org X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 16:40:02 -0000 >Number: 175890 >Category: ports >Synopsis: [PATCH] net-mgmt/p0f2: add rc script >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Feb 06 16:40:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: feld >Release: FreeBSD 9.1-RELEASE amd64 >Organization: >Environment: System: FreeBSD mwi1.coffeenet.org 9.1-RELEASE FreeBSD 9.1-RELEASE #6 r243808: Mon Dec 3 07:51:34 >Description: Added rc script that is useful for maia/amavis users or anyone who needs p0f to start reliably on boot. -Updated Makefile header format -PORTDOCS converted to optionsng DOCS Added file(s): - files/p0f2.in Port maintainer (catone@cpan.org) is cc'd. Generated with FreeBSD Port Tools 0.99_6 (mode: change, diff: suffix) >How-To-Repeat: >Fix: --- p0f2-2.0.8_1.patch begins here --- diff -ruN --exclude=CVS ../p0f2.orig/Makefile ./Makefile --- ../p0f2.orig/Makefile 2012-11-17 00:00:35.000000000 -0600 +++ ./Makefile 2013-02-06 10:24:42.149322886 -0600 @@ -1,12 +1,8 @@ -# New ports collection makefile for: p0f2 -# Date created: 2012-07-30 -# Whom: Denis Pokataev -# # $FreeBSD: ports/net-mgmt/p0f2/Makefile,v 1.2 2012/11/17 06:00:35 svnexp Exp $ -# PORTNAME= p0f2 PORTVERSION= 2.0.8 +PORTREVISION= 1 CATEGORIES= net-mgmt security MASTER_SITES= http://lcamtuf.coredump.cx/p0f/ \ http://farrokhi.net/distfiles/ @@ -18,12 +14,15 @@ CONFLICTS= p0f-3.* +USE_RC_SUBR= p0f2 USE_GMAKE= yes ALL_TARGET= all p0fq tools PORTDOCS= COPYING CREDITS ChangeLog KNOWN_BUGS README TODO win-memleak.txt MAN1= p0f.1 WRKSRC= ${WRKDIR}/p0f +.include + post-patch: .for f in config.h doc/README @${REINPLACE_CMD} -e 's|/etc|${PREFIX}/etc|g' ${WRKSRC}/${f} @@ -40,7 +39,7 @@ .endfor ${INSTALL_MAN} ${WRKSRC}/${MAN1} ${MANPREFIX}/man/man1 -.if !defined(NOPORTDOCS) +.if ${PORT_OPTIONS:MDOCS} ${MKDIR} ${DOCSDIR} .for ii in ${PORTDOCS} ${INSTALL_DATA} ${WRKSRC}/doc/${ii} ${DOCSDIR} diff -ruN --exclude=CVS ../p0f2.orig/files/p0f2.in ./files/p0f2.in --- ../p0f2.orig/files/p0f2.in 1969-12-31 18:00:00.000000000 -0600 +++ ./files/p0f2.in 2013-02-06 10:30:33.235340909 -0600 @@ -0,0 +1,78 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: p0f2 +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# p0f_enable (bool): Set to NO by default. +# +# p0f_user: User to drop privileges and change to +# +# p0f_int: Network interface to listen on +# +# p0f_sock (path): Path to socket used to communicate with p0f +# +# p0f_args: Additonal options passed to the p0f daemon +# +# p0f_log (path): File where p0f logs matches +# +# p0f_db (path): Location of fingerprint db. +# Defaults to %%PREFIX%%/p0f/p0f.fp + +. /etc/rc.subr + +name="p0f" +rcvar=p0f_enable + +load_rc_config ${name} + +: ${p0f_enable:="NO"} +: ${p0f_user:="root"} +: ${p0f_sock:="/var/run/${name}.sock"} +: ${p0f_log:="/var/log/p0f.log"} +: ${p0f_db:="%%PREFIX%%/etc/p0f/p0f.fp"} + +stop_cmd="${name}_stopcmd" +status_cmd="${name}_statuscmd" + +pidfile=/var/run/${name}.pid +p0f_command="%%PREFIX%%/bin/${name} -i ${p0f_int} -u ${p0f_user} -Q ${p0f_sock} -o ${p0f_log} -f ${p0f_db} ${p0f_args}" +command="/usr/sbin/daemon" +command_args="-f -p ${pidfile} ${p0f_command}" + +p0f_statuscmd() +{ + if [ ! -e $pidfile ]; + then + echo "pidfile does not exist. $name is not running?"; + exit 1; + fi + + if pgrep -F $pidfile >/dev/null; + then + echo "$name is running."; + else + echo "$name is not running."; + exit 1; + fi +} + +p0f_stopcmd() +{ + if pgrep -F $pidfile >/dev/null; + then + p0fpid=`cat $pidfile`; + kill $sig_stop ${p0fpid}; + wait_for_pids ${p0fpid}; + else + echo "$name is not running."; + exit 1; + fi +} + +run_rc_command "$1" --- p0f2-2.0.8_1.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: