Thu, 04 Oct 2012 20:30:05 +0200
Correct out of date build configuration, porting to Solaris 11 network
link infrastructure and new libpcap logic. This additionally allows for
device drivers in subdirectories of /dev. Correct packaged nmap
personalities and signatures to work out of the box. Finally, hack
arpd logic to properly close sockets and quit on TERM by repeating
signaling in the run command script. Sadly, all this fails to correct
the run time behaviour of honeyd which fails to bind to the IP layer.
michael@686 | 1 | #!@l_prefix@/bin/openpkg rc |
michael@686 | 2 | ## |
michael@686 | 3 | ## rc.dhcpd -- Run-Commands |
michael@686 | 4 | ## |
michael@686 | 5 | |
michael@686 | 6 | %config |
michael@686 | 7 | dhcpd_enable="$openpkg_rc_def" |
michael@686 | 8 | dhcpd_flags="-q" |
michael@686 | 9 | dhcpd_if="" |
michael@686 | 10 | dhcpd_port="67" |
michael@686 | 11 | dhcpd_log_prolog="true" |
michael@686 | 12 | dhcpd_log_epilog="true" |
michael@686 | 13 | dhcpd_log_numfiles="10" |
michael@686 | 14 | dhcpd_log_minsize="1M" |
michael@686 | 15 | dhcpd_log_complevel="9" |
michael@686 | 16 | |
michael@686 | 17 | %common |
michael@686 | 18 | dhcpd_pidfile="@l_prefix@/var/dhcpd/run/dhcpd.pid" |
michael@686 | 19 | dhcpd_leases="@l_prefix@/var/dhcpd/db/dhcpd.leases" |
michael@686 | 20 | dhcpd_signal () { |
michael@686 | 21 | if [ ! -f $dhcpd_pidfile ]; then return 1; fi |
michael@686 | 22 | kill -$1 `cat $dhcpd_pidfile` |
michael@686 | 23 | } |
michael@686 | 24 | dhcpd_start () { |
michael@686 | 25 | if [ ! -f $dhcpd_leases ]; then |
michael@686 | 26 | touch $dhcpd_leases |
michael@686 | 27 | chmod 644 $dhcpd_leases |
michael@686 | 28 | chown @l_susr@:@l_mgrp@ $dhcpd_leases |
michael@686 | 29 | fi |
michael@686 | 30 | local cmd="@l_prefix@/sbin/dhcpd" |
michael@686 | 31 | cmd="$cmd -f" |
michael@686 | 32 | cmd="$cmd $dhcpd_flags" |
michael@686 | 33 | echo ".$dhcpd_flags" | grep -- -p >/dev/null 2>&1 |
michael@686 | 34 | if [ $? -ne 0 -a ".$dhcpd_port" != . ]; then |
michael@686 | 35 | cmd="$cmd -p $dhcpd_port" |
michael@686 | 36 | fi |
michael@686 | 37 | if [ $# -gt 0 ]; then |
michael@686 | 38 | cmd="$cmd $@" |
michael@686 | 39 | fi |
michael@686 | 40 | ( eval "nohup $cmd </dev/null >/dev/null 2>&1 &" |
michael@686 | 41 | echo $! >$dhcpd_pidfile |
michael@686 | 42 | ) >/dev/null 2>&1 |
michael@686 | 43 | } |
michael@686 | 44 | |
michael@686 | 45 | %status -u @l_susr@ -o |
michael@686 | 46 | dhcpd_usable="unknown" |
michael@686 | 47 | dhcpd_active="no" |
michael@686 | 48 | @l_prefix@/sbin/dhcpd -q -t || dhcpd_usable="no" |
michael@686 | 49 | [ ".$dhcpd_if" = . ] && dhcpd_usable="no" |
michael@686 | 50 | rcService dhcpd enable yes && \ |
michael@686 | 51 | dhcpd_signal 0 && dhcpd_active="yes" |
michael@686 | 52 | echo "dhcpd_enable=\"$dhcpd_enable\"" |
michael@686 | 53 | echo "dhcpd_usable=\"$dhcpd_usable\"" |
michael@686 | 54 | echo "dhcpd_active=\"$dhcpd_active\"" |
michael@686 | 55 | |
michael@686 | 56 | %start -u @l_susr@ |
michael@686 | 57 | rcService dhcpd enable yes || exit 0 |
michael@686 | 58 | rcService dhcpd usable no && exit 0 |
michael@686 | 59 | rcService dhcpd active yes && exit 0 |
michael@686 | 60 | dhcpd_start $dhcpd_if |
michael@686 | 61 | |
michael@686 | 62 | %stop -u @l_susr@ |
michael@686 | 63 | rcService dhcpd enable yes || exit 0 |
michael@686 | 64 | rcService dhcpd active no && exit 0 |
michael@686 | 65 | dhcpd_signal TERM |
michael@686 | 66 | sleep 2 |
michael@686 | 67 | rm -f $dhcpd_pidfile 2>/dev/null || true |
michael@686 | 68 | |
michael@686 | 69 | %restart -u @l_susr@ |
michael@686 | 70 | rcService dhcpd enable yes || exit 0 |
michael@686 | 71 | rcService dhcpd active no && exit 0 |
michael@686 | 72 | rc dhcpd stop start |
michael@686 | 73 | |
michael@686 | 74 | %reload -u @l_susr@ |
michael@686 | 75 | rcService dhcpd enable yes || exit 0 |
michael@686 | 76 | dhcpd_signal HUP |
michael@686 | 77 | |
michael@686 | 78 | %daily -u @l_susr@ |
michael@686 | 79 | rcService dhcpd enable yes || exit 0 |
michael@686 | 80 | rcTmp -i |
michael@686 | 81 | hintfile=`rcTmp -f -n hint` |
michael@686 | 82 | for tool in dhcpd dhclient dhrelay omshell; do |
michael@686 | 83 | shtool rotate -f \ |
michael@686 | 84 | -n $dhcpd_log_numfiles -s $dhcpd_log_minsize -d \ |
michael@686 | 85 | -z $dhcpd_log_complevel -m 644 -o @l_susr@ -g @l_mgrp@ \ |
michael@686 | 86 | -P "$dhcpd_log_prolog" \ |
michael@686 | 87 | -E "$dhcpd_log_epilog; echo 1 >$hintfile" \ |
michael@686 | 88 | @l_prefix@/var/dhcpd/log/$tool.log |
michael@686 | 89 | done |
michael@686 | 90 | if [ -s $hintfile ]; then |
michael@686 | 91 | rc dhcpd restart |
michael@686 | 92 | fi |
michael@686 | 93 | rcTmp -k |
michael@686 | 94 |