LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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-12-2014, 09:51 AM   #1
gprathap1121@gmail.com
LQ Newbie
 
Registered: Jun 2014
Posts: 20

Rep: Reputation: Disabled
Is there a way to provide multiple iptables rules in a single shell command?


I have several input chain firewall DOSP rules for packet types like tcp, ICMP, UDP.

Is there a way to combine all the rules and add it in a single instance?
$IPTABLES -N DOSP
$IPTABLES -A INPUT -i ! lo -j DOSP
$IPTABLES -A DOSP -s 127.0.0.0/8 -j DROP
$IPTABLES -A DOSP -p udp --dport 67:68 --sport 67:68 -j ACCEPT
$IPTABLES -A DOSP -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP
$IPTABLES -A DOSP -p tcp --tcp-flags ALL ALL -j DROP
$IPTABLES -A DOSP -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP
$IPTABLES -A DOSP -p tcp --tcp-flags ALL NONE -j DROP
$IPTABLES -A DOSP -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
$IPTABLES -A DOSP -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
$IPTABLES -A DOSP -p tcp --tcp-flags FIN,RST FIN,RST -j DROP
$IPTABLES -A DOSP -p tcp --tcp-flags SYN,PSH,ACK,FIN,URG FIN,URG,PSH -j DROP
$IPTABLES -A DOSP -p tcp ! --syn -m state --state NEW -j DROP

Is it possible that these rules be combined and set in a single command as they belong to the same DOSP chain?
 
Old 06-12-2014, 10:32 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,125

Rep: Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260
The usual way is to put your rules in a file and execute the file.
 
  


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
how can we use multiple variables in single for loop in shell script nagendrar Linux - Newbie 11 05-22-2017 01:21 PM
Please provide the exact IPtables rules for this situation splinux Linux - Security 7 05-11-2012 04:16 AM
[SOLVED] Firewall - iptables rules in Slackware 13 64bit for single machine directly connected gauchao Slackware 5 12-29-2009 07:58 AM
Applying iptables rules to multiple subnets eggi Linux - Networking 2 01-04-2006 10:29 PM
Iptables, Multiple IP Aliases and Different Rules for each external ip genmud Linux - Networking 7 09-18-2005 02:07 AM

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

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