#!/bin/bash
#If you change this, make sure an identical value is placed in mason as well.
POLICYFILE="/tmp/current_policy"

if [ -L ${POLICYFILE} ]; then
#Hmmm... is someone trying to get us to overwrite /etc/passwd?  Tsk, tsk.
    rm -f ${POLICYFILE}
fi


unset POLICY
POLICY=`echo ${1} | sed -e 's/[^acdejnprty]//g'`

case ${POLICY} in
accept|reject|deny)
    echo -n "${POLICY}" >${POLICYFILE}
    chmod og-rwx ${POLICYFILE}

    echo -n "Policy for any rules created from this point on is set to "
    echo `cat ${POLICYFILE}`
    ;;
*)
    #Display help
    echo This program sets the policy used for the Mason firewall creator.
    echo There are three possible parameters: accept, reject, or deny.  To
    echo implement a new policy, type:
    echo ${0} accept
    echo 	or
    echo ${0} reject
    echo 	or
    echo ${0} deny
    echo
    ;;
esac
