Wed, 08 Feb 2012 20:07:00 +0200
Update version, adapt patch, correct PID writing, correct build on newer
FreeBSD releases, and most importantly introduce new patch to try to
avoid segfault caused by multiple network interfaces with the same (or
no) address. This is common when configuring bridges and tunnels.
michael@574 | 1 | #!@l_prefix@/bin/openpkg rc |
michael@574 | 2 | ## |
michael@574 | 3 | ## rc.honeyd -- Run-Commands |
michael@574 | 4 | ## |
michael@574 | 5 | |
michael@574 | 6 | %config |
michael@574 | 7 | honeyd_enable="$openpkg_rc_def" |
michael@574 | 8 | honeyd_log_prolog="true" |
michael@574 | 9 | honeyd_log_epilog="true" |
michael@574 | 10 | honeyd_log_numfiles="10" |
michael@574 | 11 | honeyd_log_minsize="1M" |
michael@574 | 12 | honeyd_log_complevel="9" |
michael@574 | 13 | honeyd_ip_network="192.168.100.0/24" |
michael@574 | 14 | honeyd_if="" |
michael@574 | 15 | |
michael@574 | 16 | %common |
michael@574 | 17 | honeyd_pidfile="@l_prefix@/var/honeyd/honeyd.pid" |
michael@574 | 18 | honeyd_cfgfile="@l_prefix@/etc/honeyd/honeyd.conf" |
michael@574 | 19 | honeyd_prnfile="@l_prefix@/share/honeyd/nmap.prints" |
michael@574 | 20 | honeyd_xpbfile="@l_prefix@/share/honeyd/xprobe2.conf" |
michael@574 | 21 | honeyd_assfile="@l_prefix@/share/honeyd/nmap.assoc" |
michael@574 | 22 | honeyd_signal () { |
michael@574 | 23 | [ -f $honeyd_pidfile ] && kill -$1 `cat $honeyd_pidfile` |
michael@574 | 24 | } |
michael@574 | 25 | |
michael@574 | 26 | %status -u @l_susr@ -o |
michael@574 | 27 | honeyd_usable="no" |
michael@574 | 28 | honeyd_active="no" |
michael@574 | 29 | rcService honeyd enable yes && \ |
michael@574 | 30 | honeyd_chroot && honeyd_usable="yes" |
michael@574 | 31 | rcService honeyd enable yes && \ |
michael@574 | 32 | honeyd_signal 0 && honeyd_active="yes" |
michael@574 | 33 | echo "honeyd_enable=\"$honeyd_enable\"" |
michael@574 | 34 | echo "honeyd_usable=\"$honeyd_usable\"" |
michael@574 | 35 | echo "honeyd_active=\"$honeyd_active\"" |
michael@574 | 36 | |
michael@574 | 37 | %start -u @l_susr@ |
michael@574 | 38 | rcService honeyd enable yes || exit 0 |
michael@574 | 39 | rcService honeyd active yes && exit 0 |
michael@574 | 40 | if [ ".$honeyd_if" != . ]; then |
michael@574 | 41 | arpd_interface="-i $honeyd_if" |
michael@574 | 42 | fi |
michael@574 | 43 | @l_prefix@/bin/honeyd \ |
michael@574 | 44 | -p $honeyd_prnfile \ |
michael@574 | 45 | -x $honeyd_xpbfile \ |
michael@574 | 46 | -a $honeyd_assfile \ |
michael@574 | 47 | -f $honeyd_cfgfile \ |
michael@574 | 48 | $honeyd_interface \ |
michael@574 | 49 | $honeyd_ip_network \ |
michael@574 | 50 | >/dev/null 2>&1 |
michael@574 | 51 | |
michael@574 | 52 | %stop -u @l_susr@ |
michael@574 | 53 | rcService honeyd enable yes || exit 0 |
michael@574 | 54 | rcService honeyd active no && exit 0 |
michael@574 | 55 | honeyd_signal TERM |
michael@574 | 56 | |
michael@574 | 57 | %restart -u @l_susr@ |
michael@574 | 58 | rcService honeyd enable yes || exit 0 |
michael@574 | 59 | rcService honeyd active no && exit 0 |
michael@574 | 60 | rc honeyd stop |
michael@574 | 61 | sleep 2 |
michael@574 | 62 | rc honeyd start |
michael@574 | 63 | |
michael@574 | 64 | %reload -u @l_susr@ |
michael@574 | 65 | rcService honeyd enable yes || exit 0 |
michael@574 | 66 | rcService honeyd active no && exit 0 |
michael@574 | 67 | honeyd_signal HUP |
michael@574 | 68 | |
michael@574 | 69 | %daily -u @l_susr@ |
michael@574 | 70 | rcService honeyd enable yes || exit 0 |
michael@574 | 71 | shtool rotate -f \ |
michael@574 | 72 | -n ${honeyd_log_numfiles} -s ${honeyd_log_minsize} -d \ |
michael@574 | 73 | -z ${honeyd_log_complevel} -o @l_susr@ -g @l_mgrp@ -m 644 \ |
michael@574 | 74 | -P "${honeyd_log_prolog}" \ |
michael@574 | 75 | -E "${honeyd_log_epilog}; rc honeyd restart" \ |
michael@574 | 76 | @l_prefix@/var/honeyd/honeyd.log |
michael@574 | 77 |