All of lore.kernel.org
 help / color / mirror / Atom feed
* blocking all trafic exapt selcter ports
@ 2005-04-23  8:47 Kashif Ali Bukhari
  2005-04-23  9:20 ` Edward Shornock
  2005-04-23  9:23 ` Ed
  0 siblings, 2 replies; 9+ messages in thread
From: Kashif Ali Bukhari @ 2005-04-23  8:47 UTC (permalink / raw)
  To: netfilter

i want to block all inbod access to my linux box and want to allow
dns, http proxy,ssh,telnet,and ftp 
how can i do this 

-- 
Syed Kashif Ali Bukhari
Network Associate Asia Net
Cell :- +92-300-4018407 , +92-300-4295604
Ph +92-42-111-111-202 Fax +92-42-5840905
MSN:- kbukhari@msn.com ; kashif.bukhari@asia.net.pk
http://asia.net.pk , http://asiatec.biz


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: blocking all trafic exapt selcter ports
  2005-04-23  8:47 blocking all trafic exapt selcter ports Kashif Ali Bukhari
@ 2005-04-23  9:20 ` Edward Shornock
  2005-04-23  9:23 ` Ed
  1 sibling, 0 replies; 9+ messages in thread
From: Edward Shornock @ 2005-04-23  9:20 UTC (permalink / raw)
  To: netfilter

Kashif Ali Bukhari wrote:
> i want to block all inbod access to my linux box and want to allow
> dns, http proxy,ssh,telnet,and ftp 
> how can i do this 
> 


First, please see
http://www.catb.org/~esr/faqs/smart-questions.html

iptables -A INPUT -p tcp --dport  21 -j ACCEPT
iptables -A INPUT -p tcp --dport  22 -j ACCEPT
iptables -A INPUT -p tcp --dport  23 -j ACCEPT
iptables -A INPUT -p tcp --dport  53 -j ACCEPT
iptables -A INPUT -p tcp --dport  3128 -j ACCEPT
iptables -P INPUT DROP


or if you compile your kernel/iptables with multiport support

iptables -A INPUT -m multiport -p tcp --dports 21-23,53,3128 -j ACCEPT
iptables -P INPUT DROP

A classic RTFM/STFW case, nonetheless...


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: blocking all trafic exapt selcter ports
  2005-04-23  8:47 blocking all trafic exapt selcter ports Kashif Ali Bukhari
  2005-04-23  9:20 ` Edward Shornock
@ 2005-04-23  9:23 ` Ed
  2005-04-23 14:54   ` Jason Opperisano
  1 sibling, 1 reply; 9+ messages in thread
From: Ed @ 2005-04-23  9:23 UTC (permalink / raw)
  To: netfilter

Kashif Ali Bukhari wrote:
> i want to block all inbod access to my linux box and want to allow
> dns, http proxy,ssh,telnet,and ftp 
> how can i do this 
> 


First, please see
http://www.catb.org/~esr/faqs/smart-questions.html

iptables -A INPUT -p tcp --dport  21 -j ACCEPT
iptables -A INPUT -p tcp --dport  22 -j ACCEPT
iptables -A INPUT -p tcp --dport  23 -j ACCEPT
iptables -A INPUT -p tcp --dport  53 -j ACCEPT
iptables -A INPUT -p tcp --dport  3128 -j ACCEPT
iptables -P INPUT DROP


or if you compile your kernel/iptables with multiport support

iptables -A INPUT -m multiport -p tcp --dports 21-23,53,3128 -j ACCEPT
iptables -P INPUT DROP

A classic RTFM/STFW case, nonetheless...



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: blocking all trafic exapt selcter ports
  2005-04-23  9:23 ` Ed
@ 2005-04-23 14:54   ` Jason Opperisano
  2005-04-23 20:58     ` Ed
  0 siblings, 1 reply; 9+ messages in thread
From: Jason Opperisano @ 2005-04-23 14:54 UTC (permalink / raw)
  To: netfilter

On Sat, Apr 23, 2005 at 05:23:07AM -0400, Ed wrote:
> Kashif Ali Bukhari wrote:
> > i want to block all inbod access to my linux box and want to allow
> > dns, http proxy,ssh,telnet,and ftp 
> > how can i do this 
> 
> First, please see
> http://www.catb.org/~esr/faqs/smart-questions.html

i love that link.

> iptables -A INPUT -p tcp --dport  21 -j ACCEPT
> iptables -A INPUT -p tcp --dport  22 -j ACCEPT
> iptables -A INPUT -p tcp --dport  23 -j ACCEPT
> iptables -A INPUT -p tcp --dport  53 -j ACCEPT

and:
  iptables -A INPUT -p udp --dport 53 -j ACCEPT

> iptables -A INPUT -p tcp --dport  3128 -j ACCEPT
> iptables -P INPUT DROP
> 
> or if you compile your kernel/iptables with multiport support
> 
> iptables -A INPUT -m multiport -p tcp --dports 21-23,53,3128 -j ACCEPT

multiport doesn't support ranges, mport does (and it uses a ':' not a
'-'):

  iptables -A INPUT -p tcp -m mport --dports 21:23,53,3128 -j ACCEPT
  iptables -A INPUT -p udp --dport 53 -j ACCEPT

> iptables -P INPUT DROP
> 
> A classic RTFM/STFW case, nonetheless...

yes.  couldn't resist the nit-pick, though.  ;-)

-j

--
"Joe Swanson: You can't just come over here and annex my pool!
 Peter: Oh yeah? Well, according to paragraph 7, sentence 3, word 8 of
 the Geneva Convention..."the". So, tough luck, Swanson."
        --Family Guy


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: blocking all trafic exapt selcter ports
  2005-04-23 14:54   ` Jason Opperisano
@ 2005-04-23 20:58     ` Ed
  2005-04-23 22:36       ` blocking all traffic except selected ports Ed
  0 siblings, 1 reply; 9+ messages in thread
From: Ed @ 2005-04-23 20:58 UTC (permalink / raw)
  To: netfilter

Jason Opperisano wrote:
> On Sat, Apr 23, 2005 at 05:23:07AM -0400, Ed wrote:
> 
>>Kashif Ali Bukhari wrote:
>>
>>>i want to block all inbod access to my linux box and want to allow
>>>dns, http proxy,ssh,telnet,and ftp 
>>>how can i do this 
>>
>>First, please see
>>http://www.catb.org/~esr/faqs/smart-questions.html
> 
> 
> i love that link.
> 

Me too :)

> 
> 
> and:
>   iptables -A INPUT -p udp --dport 53 -j ACCEPT
> 

Ooops, shouldn't respond when really tired. =P

>  
> multiport doesn't support ranges, mport does (and it uses a ':' not a
> '-'):

Again, tiredness :S (glad you caught that).

>>A classic RTFM/STFW case, nonetheless...
> 
> 
> yes.  couldn't resist the nit-pick, though.  ;-)

...and for that I am grateful.  TY (really!) for the corrections. =)  I
shouldn't post when really tired (instead of drinking, that'll be my
excuse).


/me goes back to primarily lurking...



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: blocking all traffic except selected ports
  2005-04-23 20:58     ` Ed
@ 2005-04-23 22:36       ` Ed
  2005-04-23 22:50         ` Jason Opperisano
  0 siblings, 1 reply; 9+ messages in thread
From: Ed @ 2005-04-23 22:36 UTC (permalink / raw)
  To: netfilter

Ed wrote:
> Jason Opperisano wrote:
> 

>>multiport doesn't support ranges, mport does (and it uses a ':' not a
>>'-'):
> 
> 
> Again, tiredness :S (glad you caught that).
> 
> 

Actually (after having a pot of coffee) I just looked at `iptables -m
multiport --help` on my box, and saw the following:


multiport v1.3.1 options:
 --source-ports [!] port[,port:port,port...]
 --sports ...
                                match source port(s)
 --destination-ports [!] port[,port:port,port...]
 --dports ...
                                match destination port(s)
 --ports [!] port[,port:port,port]
                                match both source and destination port(s)


It seems multiport has been updated to use port ranges after all.

(Note to self: don't reply to messages right after waking up either.
UGH! I thought there was a reason that I switched from mport to
multiport on my router...)

https://lists.netfilter.org/pipermail/netfilter-devel/2005-January/017977.html

# uname -r && iptables --version
2.6.11.7
iptables v1.3.1

From http://www.netfilter.org/patch-o-matic/pom-obsolete.html

> iptables mport match
> Author: Andreas Ferber <af@devcon.net>
> Status: Deprecated by 'multiport' version1 in 2.6.11-rcX
> 
> This module is an enhanced multiport match. It has support for byte
> ranges as well as for single ports.
> Up to 15 ports are allowed. Note that a portrange uses up 2 port values.
> 
> Examples:
> # iptables -A FORWARD -p tcp -m mport --ports 23:42,65

The way I understand it, if you're using a Linux kernel that is older
than 2.6.11-rcX, use mport.  Otherwise use multiport.

/me still admits being wrong about the ':' separator, as well as
forgetting about the UDP protocol for DNS though. =)

(Thanks for the nitpicking, J, it really is appreciated.  I don't want
to spread *incorrect* information.)




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: blocking all traffic except selected ports
  2005-04-23 22:36       ` blocking all traffic except selected ports Ed
@ 2005-04-23 22:50         ` Jason Opperisano
  2005-04-23 22:54           ` Taylor Grant
  0 siblings, 1 reply; 9+ messages in thread
From: Jason Opperisano @ 2005-04-23 22:50 UTC (permalink / raw)
  To: netfilter

On Sat, Apr 23, 2005 at 06:36:15PM -0400, Ed wrote:
> Actually (after having a pot of coffee) I just looked at `iptables -m
> multiport --help` on my box, and saw the following:
> 
> 
> multiport v1.3.1 options:
>  --source-ports [!] port[,port:port,port...]
>  --sports ...
>                                 match source port(s)
>  --destination-ports [!] port[,port:port,port...]
>  --dports ...
>                                 match destination port(s)
>  --ports [!] port[,port:port,port]
>                                 match both source and destination port(s)
> 
> 
> It seems multiport has been updated to use port ranges after all.
> 
> (Note to self: don't reply to messages right after waking up either.
> UGH! I thought there was a reason that I switched from mport to
> multiport on my router...)
> 
> https://lists.netfilter.org/pipermail/netfilter-devel/2005-January/017977.html
> 
> # uname -r && iptables --version
> 2.6.11.7
> iptables v1.3.1

this brings out an interesting point--as i was speaking from an iptables
1.2.11 perspective (i have not updated a single box to 1.3.x)...we're
probably going to have to start specifying iptables version on almost
every post to keep from confusing the hell outta people.

-j

--
"Chris: Dad, there's a guy outside who says I can't go to school.
 Peter: Yeah? Him and what army?
 Chris: The U.S. Army.
 Peter: ...that's a good army."
        --Family Guy


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: blocking all traffic except selected ports
  2005-04-23 22:50         ` Jason Opperisano
@ 2005-04-23 22:54           ` Taylor Grant
  2005-04-23 23:07             ` R. DuFresne
  0 siblings, 1 reply; 9+ messages in thread
From: Taylor Grant @ 2005-04-23 22:54 UTC (permalink / raw)
  To: netfilter

Jason Opperisano wrote:
> this brings out an interesting point--as i was speaking from an iptables
> 1.2.11 perspective (i have not updated a single box to 1.3.x)...we're
> probably going to have to start specifying iptables version on almost
> every post to keep from confusing the hell outta people.

*nod*  I could easily see this becoming a problem.  Is this something that is worth posting / starting and administrative / thread on this list stating that there has been a Flag Day in iptables?  Do we need to come up with a conversion method or at least a table that references version with the old way and new way?



Grant. . . .


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: blocking all traffic except selected ports
  2005-04-23 22:54           ` Taylor Grant
@ 2005-04-23 23:07             ` R. DuFresne
  0 siblings, 0 replies; 9+ messages in thread
From: R. DuFresne @ 2005-04-23 23:07 UTC (permalink / raw)
  To: Taylor Grant; +Cc: netfilter

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, 23 Apr 2005, Taylor Grant wrote:

> Jason Opperisano wrote:
>> this brings out an interesting point--as i was speaking from an iptables
>> 1.2.11 perspective (i have not updated a single box to 1.3.x)...we're
>> probably going to have to start specifying iptables version on almost
>> every post to keep from confusing the hell outta people.
>
> *nod*  I could easily see this becoming a problem.  Is this something that is 
> worth posting / starting and administrative / thread on this list stating 
> that there has been a Flag Day in iptables?  Do we need to come up with a 
> conversion method or at least a table that references version with the old 
> way and new way?
>

Versioning in the subject would be the preferred method;

Subject : version 1.2.11 Re: blocking all traffic except selected ports

Thanks,

Ron DuFresne
- -- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         admin & senior security consultant:  sysinfo.com
                         http://sysinfo.com
Key fingerprint = 9401 4B13 B918 164C 647A  E838 B2DF AFCC 94B0 6629

...We waste time looking for the perfect lover
instead of creating the perfect love.

                 -Tom Robbins <Still Life With Woodpecker>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFCatVMst+vzJSwZikRAvAbAKCpAXAS3PH1kC3Hq09509NNUgARkwCgtuuQ
OPK3cfmrOEhJ+m00T61LPn8=
=2J+A
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-04-23 23:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-23  8:47 blocking all trafic exapt selcter ports Kashif Ali Bukhari
2005-04-23  9:20 ` Edward Shornock
2005-04-23  9:23 ` Ed
2005-04-23 14:54   ` Jason Opperisano
2005-04-23 20:58     ` Ed
2005-04-23 22:36       ` blocking all traffic except selected ports Ed
2005-04-23 22:50         ` Jason Opperisano
2005-04-23 22:54           ` Taylor Grant
2005-04-23 23:07             ` R. DuFresne

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.