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 01-27-2011, 03:40 PM   #1
linux_alain
Member
 
Registered: Jan 2011
Location: UAE
Distribution: BackTrack, Ubuntu, Red Hat
Posts: 30

Rep: Reputation: 0

Hi all

I am setting my firewall rules using the command iptables.
My question is i wanna know what command i can use that list rule 2 and 3 for instance in my table?

i am using Netfilter firewall

another question is :

I created my own chain (iptables -N MY_CHAIN)
then i used the command
#iptables -A INPUT -p icmp -j MY_CHAIN

which refering all incomming traffic on that protocol to my created chain

then i added a new rule to that chain

when i deleted the rule that ive just created it worked using the command
#iptables -D MY_CHAIN 1

then when i tried to delete the new chain i couldnt using this command
#iptables -X MY_CHAIN

i read through the internet and i guess the reason is that this created chain has referenced as a target by the input chain so that i cant delete it

my question is : what if i need to force the deleting?
is there any command to do that? I dont want to use -F option to flush out the table, i just wanna to delete this created chain


Thanks

also 1 challenging question

if i have this scenario:
i want to create rule that: The host is administered using SSH, scp and sftp so allow incoming SSH traffic and securing remote file copying and transferring

what is best input output chain rules i can use?

thanks

Last edited by unSpawn; 01-28-2011 at 07:36 PM. Reason: //Retain 0-reply status
 
Old 01-30-2011, 05:53 PM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Quote:
Originally Posted by linux_alain View Post
My question is i wanna know what command i can use that list rule 2 and 3 for instance in my table?
For example you can use "sed" command:
Code:
iptables -t filter -S | sed -n '5,6p'
There is 3 lines offset because first 3 listed rules are policies. You can check manually how many lines to skip or write more advanced sed expression.


Quote:
I created my own chain (iptables -N MY_CHAIN)
then i used the command
#iptables -A INPUT -p icmp -j MY_CHAIN
[...]
then when i tried to delete the new chain i couldnt using this command
#iptables -X MY_CHAIN

i read through the internet and i guess the reason is that this created chain has referenced as a target by the input chain so that i cant delete it

my question is : what if i need to force the deleting?
Obviously - delete or change rules which have this chain as their target. How firewall would be known what to do with packet, if it will has inexistent target?


Quote:
i want to create rule that: The host is administered using SSH, scp and sftp so allow incoming SSH traffic and securing remote file copying and transferring

what is best input output chain rules i can use?
It depends on needs. For example, if you only access this server from known IPs/MACs you can restrict access to it. Or you are not bother about using port knock (nice security tool). There are tool for automatically add DROP for certain IPs rules when they discover port scanning or few failed ssh logins.
 
1 members found this post helpful.
Old 01-31-2011, 02:39 AM   #3
linux_alain
Member
 
Registered: Jan 2011
Location: UAE
Distribution: BackTrack, Ubuntu, Red Hat
Posts: 30

Original Poster
Rep: Reputation: 0
thank u so much

thant solved my prob and answerd my question

regards
 
  


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
Restore iptables Rules that have been saved with iptables-save tiuz Linux - Security 4 08-14-2010 05:50 PM
Help in iptables rules jlmiller Linux - Networking 5 02-16-2008 10:34 AM
iptables 1.27a still loading rules after installing iptables 1.3.0 yawe_frek Linux - Software 1 06-07-2007 09:50 PM
setting rules in iptables through ssh bijuhpd Linux - Newbie 1 11-11-2005 07:59 PM
IPTABLES - rules in /etc/sysconfig/iptables The_JinJ Linux - Newbie 6 11-20-2004 01:40 AM

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

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