LinuxQuestions.org
Help answer threads with 0 replies.
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 11-03-2007, 02:42 PM   #1
sportsman667
LQ Newbie
 
Registered: Nov 2007
Posts: 3

Rep: Reputation: 0
Iptables and implementing a policy


I am new to iptables and am having a little trouble figuring them out. Using Iptables I am trying to implement the following policy: im trying to permit all outgoing connections, permit incoming ICMP, permit incoming ssh, permit incoming finger connections ,and reject all other packets. How can I do this?
I have concluded so far that for permitting incoming ssh and permitting finger connections my table would look like this but as far as finding out the ports for ICMP and implementing the policy im lost!!:

direction protocols source port destination port


OUTGOING TCP >1023 22

INCOMING TCP 22 >1023

OUTGOING TCP >1023 79

INCOMING TCP 79 >1023

EITHER Any Any Any

Thanks,
Thomas
 
Old 11-03-2007, 04:47 PM   #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 sportsman667 View Post
I am new to iptables and am having a little trouble figuring them out. Using Iptables I am trying to implement the following policy: im trying to permit all outgoing connections, permit incoming ICMP, permit incoming ssh, permit incoming finger connections ,and reject all other packets. How can I do this?
It would go like:
Code:
iptables -P INPUT DROP

iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

iptables -A INPUT -i lo -j ACCEPT

iptables -A INPUT -p ICMP --icmp-type 8 -j ACCEPT

iptables -A INPUT -p TCP --dport 22 -m state --state NEW -j ACCEPT

iptables -A INPUT -p TCP --dport 79 -m state --state NEW -j ACCEPT
This assumes that by "ICMP" you meant ICMP type 8 (echo request, a.k.a. "ping").
 
Old 11-04-2007, 05:30 AM   #3
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
Originally Posted by sportsman667 View Post
... Using Iptables I am trying to implement the following policy: im trying to permit all outgoing connections, permit incoming ICMP, permit incoming ssh, permit incoming finger connections ,and reject all other packets.
I'll just add a couple of comments about definitions (just in case they cause confusion later)....

A policy is essentially a default. In other words, its the rule that gets matched by packets that don't match any of the explicit rules. So it is usually something like drop or reject.

(The more secure approach is generally felt to be:

rule 1: if it is this kind of packet, do this
.
.
rule n: .
everything else, forget about


but you could, if you were careful, do:

rule 1: if it is this bad thing, forget about it
.
.
rule n:
everything else, accept


the first system has a policy of forgetting about packets that come its way and the second of accepting. You'd have to be very careful about the second and it is not generally advisable.)

Secondly, you refer to rejecting. Its a close decision in some cases, but most people, most of the time, prefer to drop undesired/unsolicited packets. Reject sends an error message and that error message may be useful to someone trying to hack your system, in that it acts as confirmation that someone is there. (Mind you, if you are responding to ping packets, you are already telling the world that you exist, if they ask.)
 
  


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 and implementing a policy sportsman667 Linux - Newbie 2 11-03-2007 04:35 PM
implementing QoS with iptables TOS chain blkdog Linux - Networking 0 07-13-2007 12:35 PM
editing of configuration and policy file and implementing tripwire anil2003 Linux - Security 1 04-24-2006 02:52 PM
editing of configuration and policy file while implementing tripwire-2.3.1-2-i686.tgz anil2003 VectorLinux 0 03-29-2006 04:36 AM
Implementing password policy ddaas Linux - Security 3 12-31-2004 02:02 PM

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

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