LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 09-05-2003, 09:40 AM   #1
goldenmag
LQ Newbie
 
Registered: Jul 2003
Posts: 8

Rep: Reputation: 0
Iptable-rules block port 80


I would like to know the iptable command for blocking port 80???



If you have also a good link to iptable rules it would be great.


Tx.
 
Old 09-05-2003, 10:08 AM   #2
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
iptables -A INPUT -p tcp --dport 80 -j DROP

Will close port 80 quite nicely. As for rule sets, do a search on iptables with the search buttons. A significant number of sets have been posted here.

If you need a tutorial on iptables, the one at FrozenTux is best.
 
Old 09-05-2003, 11:57 AM   #3
german
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Debian etch, Gentoo
Posts: 312

Rep: Reputation: 30
If you want to block it out from the computer as opposed to in from the rest of the world, then change the INPUT above to OUTPUT.

B.
 
Old 09-05-2003, 06:56 PM   #4
eric.r.turner
Member
 
Registered: Aug 2003
Location: Planet Earth
Distribution: Linux Mint
Posts: 216

Rep: Reputation: 31
The principle of least priviledge says to block everything coming in by default, then add rules to allow the services you want make available.

Let's say you want to allow connection to only your email server. Create a chain that can be appended to both the INPUT and FORWARD chains in the filter table. Here's how you set things up:

iptables --table filter --new-chain myrules

iptables --table filter \
--append myrules \
--protocol tcp \
--destination-port 25 \
--match state \
--state NEW \
--jump ACCEPT

iptables --table filter \
--append myrules \
--match state \
--state NEW,INVALID \
--jump DROP

iptables --table filter \
--append INPUT \
--jump myrules

iptables --table filter \
--append FORWARD \
--jump myrules
 
  


Reply



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
IPTable rules RecoilUK Linux - Security 1 05-27-2005 07:25 PM
Verifying IPTable rules... Ateo Linux - Networking 1 02-02-2005 03:33 PM
ftp to special port when iptable rules activated ! nuwanguy Linux - Security 7 09-27-2004 05:58 AM
Help with IPtable Rules aqoliveira Linux - Security 3 12-10-2003 10:00 AM
Iptable rules for Gnutella al_erola Linux - Security 5 03-06-2002 03:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 08:32 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