Interesting changes

For discussions about security.
Message
Author
User avatar
Smithy
Posts: 1151
Joined: Mon 12 Dec 2011, 11:17

#16 Post by Smithy »

rcrsn51 wrote:Stealthing is a feature provided by some firewall products. I'm surprised that the Linux firewall in Puppy appears to do it.

Smithy: Is your Puppy machine behind a router? Does it have a local IP address like 192.168.x.y?
No RcRn51, this one isn't, it is a mobile and has dynamic addresses.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#17 Post by SFR »

Hey Smithy et all

I'm having exactly the same issue from some time...
Previously all ports were stealth, but since many months I'm getting very similar results as on your screenshot in the first post.
Perhaps it's related to the fact that my modem was replaced with a router, more or less at that time (but my IP remained within "normal" range (dynamic); also, router is locked by my ISP and I have no access to its settings)..?

Anyway, today I found this:
http://www.linuxquestions.org/questions ... post352329
I did apply those rules and all ports are stealth back again!

But, since my knowledge regarding networking/iptables is almost non-existant and that thread is quite old, it'd be reasonable to ask:
Are these rules still ok?
Do they have any major disadvantages in comparsion to standard (automagic) rules?

BTW, I'm not running any server or sth, only basic network usage, so there's no need for extended features.

Greetings!
Attachments
Before.jpg
(64.7 KiB) Downloaded 341 times
After.jpg
(60.35 KiB) Downloaded 337 times
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
Smithy
Posts: 1151
Joined: Mon 12 Dec 2011, 11:17

#18 Post by Smithy »

hI SFR, I put that code in and I can't even get on the interweb now.
Had to boot up again.
That's stealth!

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#19 Post by SFR »

Hey Smithy

Looks like these settings are hardcoded for eth0, so if you're on, eg. wlan0, then 4th line must be amended:
iptables -P INPUT DROP
iptables -F INPUT
iptables -N inbound
iptables -A INPUT -i wlan0 -j inbound
iptables -A INPUT -i lo -j ACCEPT

iptables -A inbound -m state --state ESTABLISHED -j ACCEPT
iptables -A inbound -m state --state RELATED -j ACCEPT
(Or maybe it'd be enough to add new line with a second interface..? I still know too little about this stuff...)

BTW, when I tried those rules on my second laptop (on which I'm using WiFi only) for the first time, I 'stealthed' myself completely too, but simple reinitialization via 'Tray -> Firewall -> Automagic' did the job without need to reboot.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
Smithy
Posts: 1151
Joined: Mon 12 Dec 2011, 11:17

#20 Post by Smithy »

That's a powerful snippet of code SFR, I have not seen the stealth mode on for a long time, now it's back up, thanks for that.

If I wanted to open up a port or two, would you know how to do that easily?

I guess if I reran the Puppy firewall setup (either automagic or custom) it might lose the stealth settings that the snippet of code provides?

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#21 Post by SFR »

Glad it works for you, too!
If I wanted to open up a port or two, would you know how to do that easily?
I have no idea. Best if someone who knows anything about iptables could take the floor...
I guess if I reran the Puppy firewall setup (either automagic or custom) it might lose the stealth settings that the snippet of code provides?
Yep, and additionally firewall settings get resetted to defaults at boot time by /etc/rc.d/rc.firewall script.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
Smithy
Posts: 1151
Joined: Mon 12 Dec 2011, 11:17

#22 Post by Smithy »

Yes, just a minor modification to the firewall setup dialog could be good, incorporating that code and additionally adding "on the fly" open up or back to stealth ports as user sees fit.

I noticed firestarter looks pretty good:
http://www.fs-security.com/
and g uncomplicated firewall too:
http://gufw.org/new

But the Puppy firewall just sits there nicely imo and has done for years, so maybe best not to throw out the baby just because the bathwater is a little murky.

User avatar
Smithy
Posts: 1151
Joined: Mon 12 Dec 2011, 11:17

#23 Post by Smithy »

I copied bits of this post from 2009 by martin, legend of thor, bit fiddlyfinikity, but that is the linux way sometimes :wink:

This code will open port 2234:

Code:

Code: Select all

iptables -A INPUT -i eth1 -p tcp --sport 2234 -m state --state ESTABLISHED -j ACCEPT
If a programme requires a particular port to be opened, such as Nicotine, you can make a simple script that opens the port and executes the programme. Eg:

Code:

Code: Select all

#!/bin/sh
iptables -A INPUT -i eth1 -p tcp --sport 2234 -m state --state ESTABLISHED -j ACCEPT
/usr/bin/nicotine

This will open port 2234 and run the Nicotine programme. This works for me.

Remember, that some programmes require multiple ports to be opened. Just add extra iptables lines and the required port.

how to find out what programmes are accessing ports type in Terminal:

Code:

Code: Select all

netstat -nlp

Thanks to trapster for this info.

To check if the port has opened from the first post type:

Code:

Code: Select all

iptables -L
PS: Sometimes your programme still won't be able to access the internet - this may due to:
1. It requires extra ports to be opened or
2. Modem firewall is blocking.

Security does not appear compromised with this procedure - I went to ShieldUp! to test and it came back as stealthed.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#24 Post by SFR »

Thanks for sharing this, Smithy.
I'll write it down for future reference. :)

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

Post Reply