LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-01-2018, 08:25 AM   #16
sniper8752
Member
 
Registered: Oct 2012
Posts: 454

Original Poster
Rep: Reputation: Disabled

Where would it be logging to? I don't have /var/log/messages.
 
Old 03-01-2018, 08:36 AM   #17
sniper8752
Member
 
Registered: Oct 2012
Posts: 454

Original Poster
Rep: Reputation: Disabled
I figured out why http traffic was going through without any 80/443 rules. I've had to add these rules now to let the traffic through:
Code:
-A INPUT -i eth1 -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT

-A OUTPUT -o eth0 -p tcp -m tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
-A OUTPUT -o eth0 -p tcp -m tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT
I made sure that my http server is only listening on the internal interface (eth1).
 
Old 03-15-2018, 03:08 AM   #18
someguy007
LQ Newbie
 
Registered: Mar 2018
Posts: 10

Rep: Reputation: Disabled
If you set your Policies to DROP you do not need a rule to block, you just need rules to allow.
This is most secure.

Example:

# Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT

# Accept on localhost
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

# Allow established sessions to receive traffic and block port 80
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j DROP

This is as simple as you will get other than creating .htaccess file to block all but your local net

Just a though
 
  


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
Attempting to block all non-used ports with iptables. jddancks Linux - Security 12 10-19-2013 04:24 PM
Block all the ports excpet 80 on iptables (eth2) webboy105 Linux - Security 11 02-04-2010 03:17 PM
How to block high ports in iptables? sparc86 Linux - Security 1 12-01-2008 07:55 PM
block m$ related ports using iptables carboncopy Linux - Security 8 01-28-2005 12:30 PM
iptables: block ports and RELATED, ESTABLISHED Klaus Pforte Linux - Security 6 07-17-2003 10:00 AM

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

All times are GMT -5. The time now is 11:06 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration