maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Newbie (https://talk.maemo.org/forumdisplay.php?f=26)
-   -   tip: easy mini firewall (https://talk.maemo.org/showthread.php?t=6052)

vees 2007-04-28 02:41

tip: easy mini firewall
 
Hi,
Nokia's Internet tablets are pretty secure out of the box, ports are well closed, but a small firewall never hurts. Alas, I have not found one (so far). So here is a small hack:

open an editor and create a file with this inside:

#!/bin/sh
iptables -F
iptables -A INPUT -p all -s 127.0.0.1 -j ACCEPT
iptables -A INPUT -p tcp --syn -j DROP

save it, and make it executable (chmod +x). Then, run it as root.

You will have a very basic, but solid, firewall.

HTH,

VS

SeRi@lDiE 2007-04-28 09:37

Re: tip: easy mini firewall
 
Thanks for the tip.

vees 2007-04-28 11:28

Re: tip: easy mini firewall
 
you are welcome. BTW there are far more advanced iptables scripts out there, but this one being super-easy and short I thought I would share it.
on the down side, this does requier some prospective newbie to install Xterm, get a root account, etc.
I wonder if somebody would write a mini-applet and turn this into a mini-firewall package for the N770/N800
Any ideas?
Kind regards,
VS

gsagers 2007-04-28 13:42

Re: tip: easy mini firewall
 
Thanks, great tip! I'd offer the following change for those who want remote SSH access to their Nokia from anywhere - and if I typed something wrong, please correct me - I'm no iptables guru, but it seems to work here!

Code:

#!/bin/sh
iptables -F
iptables -A INPUT -p all -s 127.0.0.1 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --syn -j DROP


Ricky-Lee 2008-12-10 15:06

Re: tip: easy mini firewall
 
Any chance of some one getting a version of iptables with logging working?

grog 2008-12-10 15:47

Re: tip: easy mini firewall
 
Would this have to be rerun after a reboot? If so, it could be slapped as is into an rc file like /etc/init.d/firewall & linked to /etc/rc0.d/S40firewall (for example).

Ricky-Lee 2008-12-10 15:57

Re: tip: easy mini firewall
 
Yes it would have to be rerun after a reboot. An yer linking it in that way should work

brendan 2008-12-10 16:34

Re: tip: easy mini firewall
 
why not just
Code:

vi /etc/sysconfig/iptables
?

grog 2008-12-10 16:40

Re: tip: easy mini firewall
 
I know nothing about iptables, but wouldn't it be "proper" to issue the above commands in the shell to set up the firewall, then use something like 'iptables-save > /etc/iptables.conf' & then just have the rc script call 'iptables-restore < /etc/iptables.conf'? Or am I making things too complicated, as usual? :rolleyes:

allnameswereout 2008-12-10 17:20

Re: tip: easy mini firewall
 
Damn, I thought we'd discuss firewall appliances :)

Quote:

Originally Posted by grog (Post 248470)
I know nothing about iptables, but wouldn't it be "proper" to issue the above commands in the shell to set up the firewall, then use something like 'iptables-save > /etc/iptables.conf' & then just have the rc script call 'iptables-restore < /etc/iptables.conf'? Or am I making things too complicated, as usual? :rolleyes:

That is the easy and proper way. Put these commands in rc scripts and you're done.

So, issue these commands as root:

Code:

iptables -F # Clears INPUT, OUTPUT, FORWARD rules
iptables -P INPUT DROP # Change INPUT policy to DROP
iptables -A INPUT -p all -s 127.0.0.1 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT

To save current firewall rules (before reboot):

Code:

iptables-save >/etc/iptables.conf
To restore previously last firewall rules (during boot or right after boot)

Code:

iptables-restore </etc/iptables.conf
NOTE you should accept traffic to/from local loopback device instead of 127.0.0.1. You should deny traffic from 127.0.0.1 on network because this can only be spoofed traffic. However, I'm no IPT wizard; I prefer OpenBSD PF.

Keep in mind legit network services such as DHCP traffic and Avahi...


All times are GMT. The time now is 07:05.

vBulletin® Version 3.8.8