LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Are my iptables rules reasonable? [Resolved] (https://www.linuxquestions.org/questions/linux-security-4/are-my-iptables-rules-reasonable-%5Bresolved%5D-4175614955/)

Thewyzewun 10-03-2017 09:37 AM

Are my iptables rules reasonable? [Resolved]
 
I'm a developer, and I use Docker.

Here's the output of `iptables -L`, I can't understand most of it, but it appears to be quite permissive.
I'm not running any services from my machine (not even SSH).

Code:

target    prot opt source              destination       
ACCEPT    all  --  anywhere            anywhere            ctstate RELATED,ESTABLISHED
ACCEPT    all  --  anywhere            anywhere           
INPUT_direct  all  --  anywhere            anywhere           
INPUT_ZONES_SOURCE  all  --  anywhere            anywhere           
INPUT_ZONES  all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere            ctstate INVALID
REJECT    all  --  anywhere            anywhere            reject-with icmp-host-prohibited

Chain FORWARD (policy DROP)
target    prot opt source              destination       
DOCKER-USER  all  --  anywhere            anywhere           
DOCKER-ISOLATION  all  --  anywhere            anywhere           
ACCEPT    all  --  anywhere            anywhere            ctstate RELATED,ESTABLISHED
DOCKER    all  --  anywhere            anywhere           
ACCEPT    all  --  anywhere            anywhere           
ACCEPT    all  --  anywhere            anywhere           
ACCEPT    all  --  anywhere            anywhere            ctstate RELATED,ESTABLISHED
DOCKER    all  --  anywhere            anywhere           
ACCEPT    all  --  anywhere            anywhere           
ACCEPT    all  --  anywhere            anywhere           
ACCEPT    all  --  anywhere            anywhere            ctstate RELATED,ESTABLISHED
DOCKER    all  --  anywhere            anywhere           
ACCEPT    all  --  anywhere            anywhere           
ACCEPT    all  --  anywhere            anywhere           
ACCEPT    all  --  anywhere            anywhere            ctstate RELATED,ESTABLISHED
DOCKER    all  --  anywhere            anywhere           
ACCEPT    all  --  anywhere            anywhere           
ACCEPT    all  --  anywhere            anywhere           
ACCEPT    all  --  anywhere            anywhere            ctstate RELATED,ESTABLISHED
DOCKER    all  --  anywhere            anywhere           
ACCEPT    all  --  anywhere            anywhere           
ACCEPT    all  --  anywhere            anywhere           
ACCEPT    all  --  anywhere            anywhere            ctstate RELATED,ESTABLISHED
ACCEPT    all  --  anywhere            anywhere           
FORWARD_direct  all  --  anywhere            anywhere           
FORWARD_IN_ZONES_SOURCE  all  --  anywhere            anywhere           
FORWARD_IN_ZONES  all  --  anywhere            anywhere           
FORWARD_OUT_ZONES_SOURCE  all  --  anywhere            anywhere           
FORWARD_OUT_ZONES  all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere            ctstate INVALID
REJECT    all  --  anywhere            anywhere            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target    prot opt source              destination       
OUTPUT_direct  all  --  anywhere            anywhere           

Chain DOCKER (5 references)
target    prot opt source              destination       

Chain DOCKER-ISOLATION (1 references)
target    prot opt source              destination       
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
DROP      all  --  anywhere            anywhere           
RETURN    all  --  anywhere            anywhere           

Chain DOCKER-USER (1 references)
target    prot opt source              destination       
RETURN    all  --  anywhere            anywhere           

Chain FORWARD_IN_ZONES (1 references)
target    prot opt source              destination       
FWDI_public  all  --  anywhere            anywhere            [goto]
FWDI_public  all  --  anywhere            anywhere            [goto]

Chain FORWARD_IN_ZONES_SOURCE (1 references)
target    prot opt source              destination       

Chain FORWARD_OUT_ZONES (1 references)
target    prot opt source              destination       
FWDO_public  all  --  anywhere            anywhere            [goto]
FWDO_public  all  --  anywhere            anywhere            [goto]

Chain FORWARD_OUT_ZONES_SOURCE (1 references)
target    prot opt source              destination       

Chain FORWARD_direct (1 references)
target    prot opt source              destination       

Chain FWDI_public (2 references)
target    prot opt source              destination       
FWDI_public_log  all  --  anywhere            anywhere           
FWDI_public_deny  all  --  anywhere            anywhere           
FWDI_public_allow  all  --  anywhere            anywhere           
ACCEPT    icmp --  anywhere            anywhere           

Chain FWDI_public_allow (1 references)
target    prot opt source              destination       

Chain FWDI_public_deny (1 references)
target    prot opt source              destination       

Chain FWDI_public_log (1 references)
target    prot opt source              destination       

Chain FWDO_public (2 references)
target    prot opt source              destination       
FWDO_public_log  all  --  anywhere            anywhere           
FWDO_public_deny  all  --  anywhere            anywhere           
FWDO_public_allow  all  --  anywhere            anywhere           

Chain FWDO_public_allow (1 references)
target    prot opt source              destination       

Chain FWDO_public_deny (1 references)
target    prot opt source              destination       

Chain FWDO_public_log (1 references)
target    prot opt source              destination       

Chain INPUT_ZONES (1 references)
target    prot opt source              destination       
IN_public  all  --  anywhere            anywhere            [goto]
IN_public  all  --  anywhere            anywhere            [goto]

Chain INPUT_ZONES_SOURCE (1 references)
target    prot opt source              destination       

Chain INPUT_direct (1 references)
target    prot opt source              destination       

Chain IN_public (2 references)
target    prot opt source              destination       
IN_public_log  all  --  anywhere            anywhere           
IN_public_deny  all  --  anywhere            anywhere           
IN_public_allow  all  --  anywhere            anywhere           
ACCEPT    icmp --  anywhere            anywhere           

Chain IN_public_allow (1 references)
target    prot opt source              destination       
ACCEPT    tcp  --  anywhere            anywhere            tcp dpt:ssh ctstate NEW
ACCEPT    udp  --  anywhere            224.0.0.251          udp dpt:mdns ctstate NEW

Chain IN_public_deny (1 references)
target    prot opt source              destination       

Chain IN_public_log (1 references)
target    prot opt source              destination       

Chain OUTPUT_direct (1 references)
target    prot opt source              destination

I have a good idea of how to configure iptables, on a machine running Ubuntu (using ufw) but little idea of how to do so on my development machine (where I believe the easiest interface I have at my disposal is iptables).

Help would be appreciated, coming up with some sensible settings :).

Basically, I want to be able to browse the Internet. I don't connect to any resources on my LAN (aside to the Internet, via WiFi).

hoes 10-03-2017 12:59 PM

Your results seem to complicated to type directly.
I suspect that this is also the result of a daemon like ufw.
So I would like for the daemon and edit the rules via the daemon.

The rules that you posted contain a lot of duplication and multiple rules that will never be reached.
So on its own it is not a good set of rules.

If want to learn more about iptables rules, I would suggest that you read the man page or google it. Understanding the rules is actually not that hard.

Thewyzewun 10-06-2017 08:24 AM

Quote:

Originally Posted by hoes (Post 5765846)
Your results seem to complicated to type directly.
I suspect that this is also the result of a daemon like ufw.
So I would like for the daemon and edit the rules via the daemon.

The rules that you posted contain a lot of duplication and multiple rules that will never be reached.
So on its own it is not a good set of rules.

If want to learn more about iptables rules, I would suggest that you read the man page or google it. Understanding the rules is actually not that hard.

Thanks for replying.

I've subsequently learned that my OS; Fedora, does not use iptables, but instead FirewallD.
So, these rules are not actually being used.

I've subsequently followed a couple of FirewallD tutorials, and improved my rules considerably.

hoes 10-06-2017 04:14 PM

You say that the rules are not used, but actually they are.
Both ufw and firewalld are convenience daemons that run on top of iptables.

If you would now look at the iptables rules you could probably recognise some of your rules.

Using firewalld is the right approach.
Glad you were able to configure the rules.


All times are GMT -5. The time now is 05:54 PM.