[Techtalk] Ubuntu /etc/network/if-up.d script not being run

Mary Gardiner mary-linuxchix at puzzling.org
Fri Apr 28 09:17:25 EST 2006


Hi all,

I have a script in /etc/network/if-up.d which is meant to start my
firewall. My understanding is that scripts in /etc/network/if-up.d
should run whenever a network interface comes up.

Here's the permissions:

# ls -l
-rwxr-xr-x  1 root root 1528 2006-04-28 09:08 00-firewall.sh

Here's a snippet of the script:

    $ cat 00-firewall.sh
    #!/bin/sh -e

    # Firewall startup script by Mary Gardiner

    PATH=/usr/sbin:/sbin:/bin:/usr/bin
    IPTABLES=/sbin/iptables

    # Testing command
    /bin/echo | /usr/bin/mail mary -s "Firewall up"

    # Flush existing rules
    $IPTABLES -F
    $IPTABLES -t nat -F

    # Allow all local connections
    $IPTABLES -A INPUT -i lo -j ACCEPT

    # snip rules

    exit 0

(There's much more to it, but I choose not to make my firewall rules
public right now.)

Here's /etc/network/interfaces:
    # Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
    # /usr/share/doc/ifupdown/examples for more information.

    # The loopback interface
    auto lo
    iface lo inet loopback

    # The first network card - this entry was created during the Debian
    # installation
    # (network, broadcast and gateway are optional)
    auto eth0
    iface eth0 inet dhcp

The script executes successfully when run from the commandline as root,
in particular, I receive the testing mail. However, when "ifup eth0" is
run, the script does not run. There are no changes to my firewall rules
and I never receive the testing mail.

Other scripts in that directory (the "postfix" and
"clamav-freshclam-ifupdown", both of which are installed by distro
packages) DO run when "ifup eth0" is run. Can anyone see what I'm
missing with my script?

-Mary


More information about the Techtalk mailing list