Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 15533 - iptables init script correction
Summary: iptables init script correction
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Daniel Ahlberg (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-11 20:07 UTC by Adam Bolte
Modified: 2003-05-04 11:33 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Bolte 2003-02-11 20:07:57 UTC
In file /etc/init.d/iptables, scroll down to the stop() function.
You'll see the line:
/sbin/iptables-save ${SAVE_RESTORE_OPTIONS} > ${IPTABLES_SAVE}

This looks harmless enough by itself, however take this scenario:
An adminstrator uses "rc-update add iptables default", but doesn't
get around to creating the iptables commands. That's OK - he'll get
an error "Not starting iptables. First create some rules...etc" when
it runs again.

But then he reboots the PC. The line above saves the output of 
iptables-save to ${IPTABLES_SAVE}, regardless of it previously
existing or not. Sure, this won't make any difference to the iptable
setup, however the "Not starting iptables..." message has now vanished,
leaving the forgetful administrator to assume that he already made the
change.

The seemingly easiest solution: In function stop() do:
# This way we don't forget to save changes
if [ -f ${IPTABLES_SAVE} ]; then
   /sbin/iptables-save ${SAVE_RESTORE_OPTIONS} > ${IPTABLES_SAVE}
else
   einfo "You have not yet saved your iptables settings!"
   einfo "You need to run: '/etc/init.d/iptables save'"
fi

...
Comment 1 Aron Griffis (RETIRED) gentoo-dev 2003-02-28 08:54:28 UTC
Here's another problem in the iptables init-script...

# ./iptables start
 * Loading iptables state and starting firewall...
 * Not starting iptables. First create some rules then run
 * /etc/init.d/iptables save                                              [ ok ]

# ./iptables start
 * WARNING:  "iptables" has already been started.

The problem here is that it should be recognizing that the first time
it didn't start successfully.
Comment 2 Daniel Ahlberg (RETIRED) gentoo-dev 2003-05-04 11:33:00 UTC
Updated.