Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
iptables script won't start on boot
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
jkcunningham
l33t
l33t


Joined: 28 Apr 2003
Posts: 649
Location: 47.49N 121.79W

PostPosted: Fri Jun 18, 2004 3:34 pm    Post subject: iptables script won't start on boot Reply with quote

I installed arno's iptables script sometime ago: http://rocky.molphys.leidenuniv.nl/iptables-firewall/arno-iptables-firewall.tgz
It is configured and operates as expected, once it is started. I can start it by
Code:
/etc/init.d/rc.iptables start
And I set it up to autostart with
Code:
rc-update add rc.iptables default
But it doesn't start on boot and there is nothing in the log to indicate why. The only thing out of the ordinary is that when I run rc-update, it gives two messages:
    /var/lib/init.d/depcache: line 5: server: command not found
    /var/lib/init.d/depcache: line 8: server: command not found
I don't know if those messages are relevant, but I've run out of ideas on how to get this to autostart. Any ideas? Has anyone had a similar problem?

Thanks
-Jeff
Back to top
View user's profile Send private message
SilveRo
Tux's lil' helper
Tux's lil' helper


Joined: 13 Oct 2003
Posts: 147
Location: Milan (Italy)

PostPosted: Sat Jun 19, 2004 1:39 pm    Post subject: Reply with quote

Did you make it executable (with chmod)? Do an 'ls -l rc.iptables' to check....

I got my firewall (a custum script, /etc/filter) to start at boot and to stop at shutdown adding to /etc/conf.d/local.start :

./etc/filter start

and to /etc/conf.d/local.stop :

./etc/filter stop
_________________
Think Gray
(things aren't all black or all white)
Back to top
View user's profile Send private message
boroshan
l33t
l33t


Joined: 16 Apr 2003
Posts: 730
Location: upside down

PostPosted: Sat Jun 19, 2004 2:21 pm    Post subject: Reply with quote

Its still worth getting /etc/init.d/iptables to work since you can get them loaded at boot. If you load them from local, there's a window of vulnerability between the network coming up and the firewall kicking in.

Probably not long enough to matter, but if you're going to do a job...
_________________
Don't let THEM immanentize the Eschaton!
Back to top
View user's profile Send private message
jkcunningham
l33t
l33t


Joined: 28 Apr 2003
Posts: 649
Location: 47.49N 121.79W

PostPosted: Sat Jun 19, 2004 3:30 pm    Post subject: Reply with quote

Thanks for the responses. Yes, its executable. And I can execute it manually.

It is very strange. 'rc-update --show' lists it under 'default', so it thinks it's ready to go. It just doesn't work on boot.

So, basically, every time there's a power failure I have a wide open firewall.

:evil:
Back to top
View user's profile Send private message
boroshan
l33t
l33t


Joined: 16 Apr 2003
Posts: 730
Location: upside down

PostPosted: Sat Jun 19, 2004 4:05 pm    Post subject: Reply with quote

just to be sure - you did load a ruleset to be restored on boot up, didn't you? The idea is you establish the set using a script and then use
Code:
/etc/init.d/iptables save
to store the rules.
_________________
Don't let THEM immanentize the Eschaton!
Back to top
View user's profile Send private message
jkcunningham
l33t
l33t


Joined: 28 Apr 2003
Posts: 649
Location: 47.49N 121.79W

PostPosted: Sat Jun 19, 2004 4:11 pm    Post subject: Reply with quote

Ahhh - no. I missed that part.
I have now :-)
Thank you.

It still bothers me that the script won't autostart.
Back to top
View user's profile Send private message
bin-doph
Guru
Guru


Joined: 23 May 2003
Posts: 302

PostPosted: Mon Jun 21, 2004 9:17 am    Post subject: Reply with quote

well I dont know arno's script but maybe the handbook-ref will help u get ur script a bit more gentoo-like and finally to start up

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=5#doc_chap4

to prevent ur firewall from being open after a system-reboot u should consider puting your script-call into /etc/conf.d/local.start

if it is a shell-script put set -x in it and redirect the output somewhere for debugging. maybe you'll catch it that way

hth
-fe
_________________
perl -e '$_=q;4a75737420616e6f74686572205065726c204861636b65720as;;for(s;s;s;s;s;s;s;s;s;s;s;s){s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'
Back to top
View user's profile Send private message
spudicus
Apprentice
Apprentice


Joined: 05 Dec 2002
Posts: 177
Location: Geraldton, Australia

PostPosted: Mon Jun 21, 2004 9:34 am    Post subject: Reply with quote

boroshan wrote:
Its still worth getting /etc/init.d/iptables to work since you can get them loaded at boot. If you load them from local, there's a window of vulnerability between the network coming up and the firewall kicking in.


/etc/init.d/iptables still loads after net.eth0.
Unless, you set /etc/init.d/net.eth0's dependencies to "need firewall/iptables",
and iptables/firewall/<insert scriptname> dependencies to "before net"
Back to top
View user's profile Send private message
boroshan
l33t
l33t


Joined: 16 Apr 2003
Posts: 730
Location: upside down

PostPosted: Mon Jun 21, 2004 10:05 am    Post subject: Reply with quote

That may well be the case. I use speedtouch to connect, and that happens after the firewall gets loaded.

I wonder if it's worth raising a bug obout this. If you connect on boot up, you should have your loaded first. On the other hand if you don't connect automatically, it makes sense to load the scripts in isolation... so maybe not.

Is there any reason why one shouldn't add iptables to the boot runlevel? That would solve the problem once and for all...
_________________
Don't let THEM immanentize the Eschaton!
Back to top
View user's profile Send private message
spudicus
Apprentice
Apprentice


Joined: 05 Dec 2002
Posts: 177
Location: Geraldton, Australia

PostPosted: Mon Jun 21, 2004 12:08 pm    Post subject: Reply with quote

Quote:
boroshan wrote:
Is there any reason why one shouldn't add iptables to the boot runlevel?


If there is, I don't know it. If the dependencies in the start up script were altered to reflect the change, it should run OK. However, there's no reason why it can't run in the default runlevel but before the network is brought up.

It's possible that it's started after the net is brought up by default to allow for iptable scripts that rely on dns resolution, dhcp assignment etc. Considering the small timeframe the network is open, it may have been acceptable to compromise slight security for greater (general) usability (or I could just be full of sh!t :p).

I don't think this is would warrant a bug report.
Back to top
View user's profile Send private message
jkcunningham
l33t
l33t


Joined: 28 Apr 2003
Posts: 649
Location: 47.49N 121.79W

PostPosted: Mon Jun 21, 2004 3:21 pm    Post subject: Reply with quote

Thank you, gentlemen - your discussion has proven provocative. I just realized that what I should have been doing was letting arno's script generate the iptables script, and starting iptables the usual way: 'rc-update add iptables boot'. There's no need to regenerate the script each time. It confused me because the script also starts iptables.

I am trying it at the boot level - I think in this case it will work, and if so, there's no security hole, however short. But if it doesn't, I'll put it back at the default level.

It turns out that the symptom I posted at the top here:
    /var/lib/init.d/depcache: line 5: server: command not found
    /var/lib/init.d/depcache: line 8: server: command not found

is unrelated. It shows up everytime rc-update is run, even when I've taken out arno's script. I've done some googling around on it, and I think there's a missing dependency for something called 'server'. This is a minimal system firewall box. It doesn't have X or anything beyond what it takes to be a firewall and dhcp server. On one of my desktops, 'server -h' comes up with stuff that looks like this:

    > server
    Usage: server -n rsa_nickname -p port [-3RFrf] [-w password]
    [-c ciphers] [-d dbdir]
    -3 means disable SSL v3
    -r means request certificate on first handshake.
    -f means require certificate on first handshake.
    -R means request certificate on all handshakes.
    -F means require certificate on all handshakes.
    -c ciphers Letter(s) chosen from the following list
    A SSL2 RC4 128 WITH MD5
    B SSL2 RC4 128 EXPORT40 WITH MD5
    C SSL2 RC2 128 CBC WITH MD5
    D SSL2 RC2 128 CBC EXPORT40 WITH MD5
    E SSL2 DES 64 CBC WITH MD5
    F SSL2 DES 192 EDE3 CBC WITH MD5

    a SSL3 FORTEZZA DMS WITH FORTEZZA CBC SHA
    b SSL3 FORTEZZA DMS WITH RC4 128 SHA
    c SSL3 RSA WITH RC4 128 MD5
    d SSL3 RSA WITH 3DES EDE CBC SHA
    <snip more lines of similar nature>

When I run 'qpkg -f server' it shows up in mozilla !?. I don't know what to make of it. Something I've installed is confusing depcache?
I'll probably start a different thread on it.

-Jeff
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum