diff options
author | swills <swills@FreeBSD.org> | 2013-02-18 03:55:16 +0800 |
---|---|---|
committer | swills <swills@FreeBSD.org> | 2013-02-18 03:55:16 +0800 |
commit | 8f6d14ab6cfefdbf7ad19bc22c46a46d851020f1 (patch) | |
tree | 27bdf56c99431d8c6bf8fb84a0a0d3edda88c0b3 /net-mgmt/p0f2 | |
parent | c9a61a5355fa13c6be654bb00d07c0c349593d6d (diff) | |
download | freebsd-ports-gnome-8f6d14ab6cfefdbf7ad19bc22c46a46d851020f1.tar.gz freebsd-ports-gnome-8f6d14ab6cfefdbf7ad19bc22c46a46d851020f1.tar.zst freebsd-ports-gnome-8f6d14ab6cfefdbf7ad19bc22c46a46d851020f1.zip |
- Add rc script
- Convert to OptionsNG
- Trim header while here
PR: ports/175890
Submitted by: Mark Felder <feld@feld.me>
Approved by: Denis Pokataev <catone@cpan.org> (maintainer)
Diffstat (limited to 'net-mgmt/p0f2')
-rw-r--r-- | net-mgmt/p0f2/Makefile | 11 | ||||
-rw-r--r-- | net-mgmt/p0f2/files/p0f2.in | 78 |
2 files changed, 83 insertions, 6 deletions
diff --git a/net-mgmt/p0f2/Makefile b/net-mgmt/p0f2/Makefile index f116b71bc2eb..646683742a6c 100644 --- a/net-mgmt/p0f2/Makefile +++ b/net-mgmt/p0f2/Makefile @@ -1,12 +1,8 @@ -# New ports collection makefile for: p0f2 -# Date created: 2012-07-30 -# Whom: Denis Pokataev <catone@cpan.org> -# # $FreeBSD$ -# 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 @@ COMMENT= Passive OS fingerprinting tool 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 <bsd.port.options.mk> + post-patch: .for f in config.h doc/README @${REINPLACE_CMD} -e 's|/etc|${PREFIX}/etc|g' ${WRKSRC}/${f} @@ -40,7 +39,7 @@ do-install: .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 --git a/net-mgmt/p0f2/files/p0f2.in b/net-mgmt/p0f2/files/p0f2.in new file mode 100644 index 000000000000..620643e3cef1 --- /dev/null +++ b/net-mgmt/p0f2/files/p0f2.in @@ -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" |