iptables: Allow only HTTP access for web browsing

Posted by user1448260 on Super User See other posts from Super User or by user1448260
Published on 2012-07-02T13:57:36Z Indexed on 2012/07/02 15:18 UTC
Read the original article Hit count: 229

Filed under:
|
|

Have a linux box, want it locked down but just be able to surf internet on it. Why is this script blocking http too?

#!/bin/sh
#
#
iptables -F

#
#Set default policies for INPUT, FORWARD and OUTPUT chains
#
iptables -P INPUT DROP                
iptables -P FORWARD DROP
iptables -P OUTPUT DROP

#
# Allow TCP connections on tcp port 80
#
iptables -A INPUT -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT

#
# Set access for localhost
#
iptables -A INPUT -i lo -j ACCEPT


#
# List rules
#
iptables -L -v

© Super User or respective owner

Related posts about linux

Related posts about firewall