#!/bin/sh #--------------------------------------------------------------- # Project : Mandriva Linux # Module : share # File : msec # Version : $Id$ # Author : Frederic Lepied # Created On : Thu Dec 13 11:36:50 2001 # Purpose : entry script to run hardness script or change # the security level. #--------------------------------------------------------------- if [ "`whoami`" != "root" ]; then echo 'msec: sorry, you must be root !' exit 1 fi LCK=/var/run/msec.pid function cleanup() { rm -f $LCK } if [ -f $LCK ]; then if [ -d /proc/`cat $LCK` ]; then exit 0 else rm -f $LCK fi fi echo -n $$ > $LCK trap cleanup 0 MSEC=/usr/share/msec/msec.py OPT="" for a in "$@"; do if [ "$a" = '-o' ]; then OPT="$OPT -o" NEXT=1 else if [ "$NEXT" = 1 ]; then OPT="$OPT $a" else last="$a" fi NEXT=0 fi done if [ -n "$last" ]; then CHANGE=-c case "$last" in [0-5]) ;; *) [ -x /usr/share/msec/$last.py ] && MSEC=/usr/share/msec/$last.py;; esac else # no args so try to guess if a custom msec is needed . /etc/sysconfig/msec case "$SECURE_LEVEL" in [0-5]) ;; *) MSEC=/usr/share/msec/$SECURE_LEVEL.py;; esac fi if [ ! -x "$MSEC" ]; then echo "$MSEC not found or not executable. Aborting" 1>&2 exit 1 fi if $MSEC "$@"; then . /etc/sysconfig/msec [ -z "$PERM_LEVEL" ] && PERM_LEVEL=$SECURE_LEVEL LOCAL= [ -f /etc/security/msec/perm.local ] && LOCAL=/etc/security/msec/perm.local /usr/share/msec/Perms.py $CHANGE $OPT /usr/share/msec/perm.$PERM_LEVEL $LOCAL fi # msec ends here