Hi,

I made a more complete script based on the one proposed to let
NetworkManager start/stop the firewall when the interface goes up/down
(rename it to 50firestarter, made it executable and copy it to
/etc/NetworkManager/dispatcher.d). Some people tested it on Ubuntu and
gave good feedback, it seems to work.

Hope this help.
Cheers,
Lionel
#!/bin/sh -e
# Script to dispatch NetworkManager events
#
# Starts firestarter when NetworkManager fiddles with interfaces.

if [ -z "$1" ]; then
    echo "$0: called with no interface" 1>&2
    exit 1;
fi

# Check whether firestarter is configured or not
FS_CONFIG=/etc/firestarter/configuration

if [ ! -e $FS_CONFIG ]; then
    echo "$0: firestarter configuration not found" 1>&2
    exit 1;
fi

. $FS_CONFIG 1>&2

# Check whether this interface is defined as protected in firestarter config
if [ "$1" != "$IF" ]; then
    echo "$0: $1 not protected by firestarter" 1>&2
    exit 1;
fi

# Check the current status of firestarter
FS_STATUS=1;
if [ -e /var/lock/subsys/firestarter ] || [ -e /var/lock/firestarter ]; then
    FS_STATUS=0;
fi

case "$2" in
    up)
        if [ "$FS_STATUS" -gt 0 ]; then
             /etc/init.d/firestarter start;
        fi
        ;;
    down)
        if [ "$FS_STATUS" -eq 0 ]; then
             /etc/init.d/firestarter stop;
        fi
        ;;
    pre-up)
        ;;
    post-down)
        ;;
    *)
        echo "$0: called with unknown action \`$2'" 1>&2
        exit 1
        ;;
esac

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to