LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-10-2004, 07:09 AM   #1
smurf
Member
 
Registered: Apr 2001
Posts: 113

Rep: Reputation: 15
New Firewall Script Required


Hey guys,

Ive used the same firewall script for about a year now.

The firewall script is very basic.
Eth0 LAN
Eth1 Web


The problem is, now I understand what the firewall does its come to my attention that it doesnt block any ports unless i tell it to.

I am looking for a script that denys all, and then opens specific ports

Is there any examples anywhere as i cant seem find any myself and i would trust a firewall i attempted to write myself

Cheers

Smurf
 
Old 06-10-2004, 07:29 AM   #2
wrongman
Member
 
Registered: May 2004
Location: Italy
Distribution: Debian Unstable 64bit
Posts: 99

Rep: Reputation: 15
i'm using this one, don't know if it's safe or not, if you have to eth devices you should add something, anyway... here it is:
Code:
iptables -F
iptables -F -t mangle
iptables -F -t nat
iptables -X

iptables -P INPUT DROP
iptables -P FORWARD DROP

iptables -A INPUT -m state --state INVALID -j DROP
iptables -A FORWARD -m state --state INVALID -j DROP
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT

iptables -A INPUT -i lo -m state --state NEW -j ACCEPT

for f in /proc/sys/net/ipv4/conf/*/rp_filter
do
echo 1 > $f
done
It SHOULD block every connection attempt started from the net, and allow only connections started by you..
hope it helps... cya
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script help required syntax error sridhar11 Programming 1 10-31-2005 08:38 AM
small shell script required demigor Programming 6 08-08-2005 04:38 PM
Monitoring Script required nimish Linux - Software 0 11-05-2004 03:25 AM
basic script help required jimmorrison Linux - General 5 10-26-2004 11:31 PM
slackware's /etc/rc.d/rc.firewall equivalent ||| firewall script startup win32sux Debian 1 03-06-2004 09:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration