iptables script.....

Dark Atheist

OSNN Veteran Addict
Political Access
Joined
8 Apr 2003
Messages
6,376
on which i think i have dropped the proverbial nad

#!/bin/bash
ext_if=eth0
int_if=eth1
iptables -F INPUT
iptables -P INPUT DROP
iptables -F OUTPUT
iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p udp -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p udp -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
accept_port="80 443 2010 9000:9000"
names="some.dns.name1 some.dns.name2 some.dns.name3 some.dns.name4"
iptables -A INPUT -i $ext_if -j DROP
iptables -A INPUT -i $int_if -s 164.168.1.1/24 -j ACCEPT
iptables -A INPUT -i $ext_if -s 192.168.1.1/24 -j ACCEPT
for ip in $names
do
for port in $accept_ports
do
iptables -A INPUT -i $ext_if -s $ip --dport $ip --syn -m state --state NEW -j ACCEPT
done
done

is what i believe should give me control about who can access certain things on my server (web fftp)

thing is since running this script it is also blocking me on the lan too!!!! i cant see web pages or connect to my own ftp :(

any Sharpe eyed person out there see where i messed up (and no saying well you wrote it is neither a reason nor helpful, it also wont get you reps or a cookie)
 
seems it was iptables -A INPUT -i $ext_if -j DROP that line looks like i might have it in the rong place - still least i can connect to my server now, and also shame i have blocked other ports :p still i can add them
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,623
Latest member
AndersonLo
Back