LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 02-03-2009, 05:24 AM   #1
carlozrox
LQ Newbie
 
Registered: Feb 2009
Posts: 2

Rep: Reputation: 1
How to block ALL traffic except port 443


Hi!

How can block ALL traffic with iptables except the port 443.
How can enable all traffic again.

Thanks a lot!
 
Old 02-03-2009, 06:07 AM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by carlozrox View Post
Hi!

How can block ALL traffic with iptables except the port 443.
How can enable all traffic again.

Thanks a lot!
Depends on what kind of traffic. Is this a client, a server, or a router?

Client example (block/unblock):
Code:
iptables -I OUTPUT -p TCP -o eth0 --dport ! 443 -j REJECT
iptables -D OUTPUT -p TCP -o eth0 --dport ! 443 -j REJECT
Server example (block/unblock):
Code:
iptables -I INPUT -p TCP -i eth0 --dport ! 443 -j DROP
iptables -D INPUT -p TCP -i eth0 --dport ! 443 -j DROP
Router example (block/unblock):
Code:
iptables -I FORWARD -p TCP -i eth0 -o eth1 --dport ! 443 -j REJECT
iptables -D FORWARD -p TCP -i eth0 -o eth1 --dport ! 443 -j REJECT

Last edited by win32sux; 02-03-2009 at 07:08 AM.
 
Old 03-11-2009, 05:15 AM   #3
carlozrox
LQ Newbie
 
Registered: Feb 2009
Posts: 2

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by win32sux View Post
Depends on what kind of traffic. Is this a client, a server, or a router?

Client example (block/unblock):
Code:
iptables -I OUTPUT -p TCP -o eth0 --dport ! 443 -j REJECT
iptables -D OUTPUT -p TCP -o eth0 --dport ! 443 -j REJECT
Server example (block/unblock):
Code:
iptables -I INPUT -p TCP -i eth0 --dport ! 443 -j DROP
iptables -D INPUT -p TCP -i eth0 --dport ! 443 -j DROP
Router example (block/unblock):
Code:
iptables -I FORWARD -p TCP -i eth0 -o eth1 --dport ! 443 -j REJECT
iptables -D FORWARD -p TCP -i eth0 -o eth1 --dport ! 443 -j REJECT
Great! Thanks!
 
1 members found this post helpful.
  


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
Configuring Automatic Redirects from port 80 to port 443 with bundled Apache server kaplan71 Fedora 1 12-28-2007 08:30 AM
Block 443 at SUSE firewall shifflav Linux - Networking 2 08-14-2007 03:01 PM
How can I block all traffic to port 110 to and IP using IPtables? abefroman Linux - Networking 8 11-16-2005 07:26 PM
access using port 443 gtoerner Linux - Security 3 07-14-2005 05:48 PM
turn off http port 80, keep https port 443 lothario Linux - Networking 6 02-11-2005 04:06 AM

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

All times are GMT -5. The time now is 05:52 AM.

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