stun/rc.stun

Mon, 20 Apr 2009 19:22:00 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 20 Apr 2009 19:22:00 +0200
changeset 178
0ba300bdf30a
permissions
-rw-r--r--

Change unfortunate but partly useful overreaching security tradeoff.
The principle of allocating each running process an individual system
user and group can have security benefits, however maintining a plethora
of users, groups, processes, file modes, file permissions, and even
nonportable file ACLs on a host serving from a hundred processes has
some security disadvantages. This tradeoff is even worse for systems
like OpenPKG which benefit from administration transparency through the
use of minimal system intrusion and only three usage privilege levels.

     1 #!@l_prefix@/bin/openpkg rc
     2 ##
     3 ##  rc.stun -- Run-Commands
     4 ##
     6 %config
     7     stun_enable="$openpkg_rc_def"
     8     stun_bind_addr1="127.0.0.1"
     9     stun_bind_addr2="127.0.0.2"
    10     stun_bind_port1="3478"
    11     stun_bind_port2="3479"
    13 %common
    14     stun_pidfile="@l_prefix@/var/stun/stun.pid"
    15     stun_signal () {
    16         [ -f $stun_pidfile ] && kill -$1 `cat $stun_pidfile`
    17     }
    19 %status -u @l_susr@ -o
    20     stun_usable="unknown"
    21     stun_active="no"
    22     rcService stun enable yes && \
    23         stun_signal 0 && stun_active="yes"
    24     echo "stun_enable=\"$stun_enable\""
    25     echo "stun_usable=\"$stun_usable\""
    26     echo "stun_active=\"$stun_active\""
    28 %start -u @l_susr@
    29     rcService stun enable yes || exit 0
    30     rcService stun active yes && exit 0
    31     @l_prefix@/sbin/stund -b \
    32         -h "${stun_bind_addr1}" \
    33         -a "${stun_bind_addr2}" \
    34         -p "${stun_bind_port1}" \
    35         -o "${stun_bind_port2}" \
    36         -P "${stun_pidfile}"
    38 %stop -u @l_susr@
    39     rcService stun enable yes || exit 0
    40     rcService stun active no  && exit 0
    41     stun_signal TERM
    42     sleep 2
    43     rm -f $stun_pidfile >/dev/null 2>&1 || true
    45 %restart -u @l_susr@
    46     rcService stun enable yes || exit 0
    47     rcService stun active no  && exit 0
    48     rc stun stop start

mercurial