Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
02-01-2007, 11:58 PM
|
#1
|
LQ Newbie
Registered: Sep 2006
Posts: 16
Rep:
|
Need help building firewall Iptables
Hi everyone,
Thank you for for reading this thread. I am currently building a simple firewall and dont' quite understand what does it mean by " Drop all incoming packets from reserved port 0 as well as inbound traffic to port 0" The following below is the few rules that I made so far. Can anyone tell me what is the script look like to drop all incoming packet & traffic for reserved port 0. Also, if you see any error on my scirpt, please let me know.
# Set the default policies to DROP
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
# Permit inbound/outbound ssh packets.
iptables -A INPUT -i eth1 -p tcp --dport 22 -- syn -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp --sport 22 -- syn -j DROP
# Permit inbound/outbound www packets.
iptables -A INPUT -i eth1 -p tcp --dport 80 -- syn -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp --sport 80 -- syn -j DROP
# Drop inbound traffic to port 80 (http) from source ports less than 1024
iptables -A INPUT -i eth1 -p tcp --dport 80 --sport 0:1024 -j DROP
# Drop all incoming packets from reserved port 0 as well as inbound traffic to port 0
|
|
|
02-02-2007, 01:55 AM
|
#2
|
Senior Member
Registered: Sep 2005
Location: Out
Posts: 3,307
Rep:
|
Port 0 should be blocked:
http://www.ouah.org/port0paper.txt
For understanding iptables:
man iptables
+
google
or use firestarter or guarddog which will generate your rules based on simple questions
|
|
|
02-03-2007, 11:52 AM
|
#3
|
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
|
You really shouldn't be trying to "roll your own" firewall w/ so little background knowledge, If you are determined to learn how, a commendable goal, look at Oscar Andreasson's Iptables Tutorial 1.2.2
|
|
|
02-06-2007, 02:18 AM
|
#4
|
LQ Newbie
Registered: Sep 2006
Posts: 16
Original Poster
Rep:
|
Hi, cause I am currently working on my school assignment, really want to get some help, due to my little knowledge on linux and firewall. I am using Fedora 6, how can I execute the firewall when bootup? Also, can anyone please take a look my scipts and tell me where is wrong? I really appreciated. Thanks
# Set the default policies to DROP
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
# Allow the localhost
iptables -A INPUT -i lo -j ACCEPT
# Permit inbound/outbound ssh packets.
iptables -A INPUT -p tcp --dport 22 --syn -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 --syn -j ACCEPT
# Permit inbound/outbound www packets.
iptables -A INPUT -p tcp --dport 80 --syn -j ACCEPT
iptables -A OUTPUT -p tcp --sport 80 --syn -j ACCEPT
# Drop inbound traffic to port 80 (http) from source ports less than 1024
iptables -A INPUT -p tcp --dport 80 --sport 0:1024 -j DROP
# Drop all incoming packets from reserved port 0 as well as inbound traffic to port 0
iptables -A INPUT -p tcp --dport 0 -j DROP
iptables -A INPUT -p tcp --sport 0 -j DROP
# Allow DNS traffic through this machine
iptables -A INPUT -p udp --dport 53 -j ACCEPT
# Allow DHCP traffic throught this machine
iptables -I INPUT -p udp --dport 67:68 -j ACCEPT
# Create user-defined chains to keep track of the ssh & www traffic v.s the rest of the system
iptables -N definedtraffic
iptables -N resttraffic
iptables -A definedtraffic -j ACCEPT
iptables -A resttraffic -j ACCEPT
iptables -A FORWARD -i eth1 -m tcp -p tcp --sport 22 -j definedtraffic
iptables -A FORWARD -i eth1 -m tcp -p tcp --sport 80 -j definedtraffic
iptables -A FORWARD -j resttraffic
|
|
|
02-08-2007, 04:44 AM
|
#5
|
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
|
Is this homework?
What have you done to help yourself?
Where are you located?
|
|
|
All times are GMT -5. The time now is 11:10 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|