LinuxQuestions.org
Review your favorite Linux distribution.
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 06-26-2013, 05:16 AM   #1
linuxcenter
LQ Newbie
 
Registered: Jun 2013
Posts: 5

Rep: Reputation: Disabled
Lightbulb Iptables rule help


Rule 1: want to block all Incoming/Input connections, from port range 0 to 65535.
Rule 2: In Outgoing/Output allow only tcp port 80,443, udp 53 & block all the remaining ports 0 to 65535

Additional rules for:
blocking ping attempts
blocking dos attacks
blocking script attacks
 
Old 06-26-2013, 05:55 AM   #2
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
is ping attempts blocking about this?
Code:
sysctl -w net.ipv4.icmp_echo_ignore_all=1
 
Old 06-26-2013, 05:57 AM   #3
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
wonder why don't you ask about blocking privileges escalation vulnerabilities blocking?
 
Old 06-26-2013, 06:21 AM   #4
nsingh63
LQ Newbie
 
Registered: Jun 2013
Posts: 10
Blog Entries: 2

Rep: Reputation: 0
Rule 1: want to block all Incoming/Input connections, from port range 0 to 65535.

iptables -A INPUT -j DROP
or
iptables -A INPUT --sport 00:65535 -j DROP

Rule 2: In Outgoing/Output allow only tcp port 80,443, udp 53 & block all the remaining ports 0 to 65535

iptables -A OUTPUT -p tcp -s $SERVER_IP --sport 00:65535 -d 0/0 --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
same for other

blocking ping attempts
iptables -A OUTPUT -p icmp --icmp-type echo-request -j DROP

blocking dos attacks

iptables -A INPUT -p udp -m state --state NEW -m recent --update --seconds 1 --hitcount 5 --name DDOS --rsource -j DROP
 
  


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
iptables: rule with RETURN target just after a rule with ACCEPT target Nerox Linux - Networking 6 09-04-2011 03:33 PM
iptables rule kim_bcs Linux - Security 1 01-28-2011 09:34 AM
iptables rule sang_froid Linux - Networking 1 03-18-2009 10:32 AM
iptables rule DJ29Joesph Linux - Security 4 11-04-2008 12:55 AM
What is it doing this iptables rule?? lanczer Linux - Security 1 02-24-2006 11:26 AM

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

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