Linux Netfilter discussions
 help / color / mirror / Atom feed
* howto only allow outgoing mail from certain hosts
@ 2002-10-01 14:08 Heupink, Mourik Jan C.
  2002-10-01 15:38 ` Boryan Yotov
  0 siblings, 1 reply; 3+ messages in thread
From: Heupink, Mourik Jan C. @ 2002-10-01 14:08 UTC (permalink / raw)
  To: 'netfilter@lists.netfilter.org'

Hello all.

The subject says it all, really. I want to (of course) allow OUTGOING mail
from our domain, from only two designated servers. So, drop outgoing mail
from any other host.

I can't seem to produce the iptables command to get this to work... (using
forward chain, because using transp. bridging firewall...)

I guess this: iptables -A FORWARD -s x.x.x.0/24 -p tcp --dport 25 -REJECT
would drop all outgoing mail, right? (i guess the way to select outgoing
mail traffic would be to use --dport..?)

Now i have to find a way to make an exclusion in that rule. something like
-s x.x.x.0/24 EXCEPT x.x.x.y

Could anyone shed some light onto this..?

Thanks very much in advance,
Yours,
Mourik Jan



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

* Re: howto only allow outgoing mail from certain hosts
  2002-10-01 14:08 howto only allow outgoing mail from certain hosts Heupink, Mourik Jan C.
@ 2002-10-01 15:38 ` Boryan Yotov
  0 siblings, 0 replies; 3+ messages in thread
From: Boryan Yotov @ 2002-10-01 15:38 UTC (permalink / raw)
  To: 'netfilter@lists.netfilter.org'

[-- Attachment #1: Type: text/plain, Size: 1522 bytes --]

Hello,

   If I understood the problem correctly you must use the following

   iptables -A FORWARD -s x.x.x.a -p tcp --dport 25 -j ACCEPT
   iptables -A FORWARD -s x.x.x.b -p tcp --dport 25 -j ACCEPT

   iptables -A FORWARD -s x.x.x.0/24 -p tcp --dport 25 -j  REJECT

   Or if you have more than two host you want to gran SMTP access put 
the following into a script:
    ...
    #Here you could add as much as you need IP addresses or hostnames 
separated by space
    allowed_smpt="x.x.x.a   x.x.x.b   x.x.x.c   x.x.x.d"
        for allowed in $allowed_smpt
    do
       iptables -A FORWARD -s $allowed -p tcp --dport 25 -j ACCEPT
    done

    iptables -A FORWARD -s x.x.x.0/24 -p tcp --dport 25 -j REJECT
    ...

Hope this will help
Regards :)

Heupink, Mourik Jan C. wrote:

>Hello all.
>
>The subject says it all, really. I want to (of course) allow OUTGOING mail
>from our domain, from only two designated servers. So, drop outgoing mail
>from any other host.
>
>I can't seem to produce the iptables command to get this to work... (using
>forward chain, because using transp. bridging firewall...)
>
>I guess this: iptables -A FORWARD -s x.x.x.0/24 -p tcp --dport 25 -REJECT
>would drop all outgoing mail, right? (i guess the way to select outgoing
>mail traffic would be to use --dport..?)
>
>Now i have to find a way to make an exclusion in that rule. something like
>-s x.x.x.0/24 EXCEPT x.x.x.y
>
>Could anyone shed some light onto this..?
>
>Thanks very much in advance,
>Yours,
>Mourik Jan
>
>
>
>
>  
>



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

* RE: howto only allow outgoing mail from certain hosts
       [not found] <0EB90DD25728C04CBD401CDCD72D2A655A8E@homer.no.laasby.com>
@ 2002-10-01 19:20 ` mourik jan c heupink
  0 siblings, 0 replies; 3+ messages in thread
From: mourik jan c heupink @ 2002-10-01 19:20 UTC (permalink / raw)
  To: netfilter@lists.netfilter.org

Thank you all very much...!
You are a bunch of very helpful people here!

Never had so many replies to a single question (and so fast also!)

Thanks, and things are running just as i want them to, now.

Yours,
Mourik Jan

On Tue, 2002-10-01 at 18:03, Kjetil Laasby wrote:
> Hi.
> 
> Try to put your "excluding" networks first - like
> 
> iptables -A FORWARD -s mailserver1 -p tcp --dport 25 -j ACCEPT // That's
> OK
> iptables -A FORWARD -s mailserver2 -p tcp --dport 25 -j ACCEPT // That's
> OK
> iptables -A FORWARD -s 0.0.0.0/0 -p tcp --dport 25 -j DROP // Anything
> else 
> 
> Syntax may not be right here, just working from my head.. 
> 
> Regards,
> Kjetil
> 
> -----Original Message-----
> From: Heupink, Mourik Jan C. [mailto:Heupink@INTECH.UNU.EDU] 
> Sent: 1. oktober 2002 16:09
> To: 'netfilter@lists.netfilter.org'
> Subject: howto only allow outgoing mail from certain hosts
> 
> Hello all.
> 
> The subject says it all, really. I want to (of course) allow OUTGOING
> mail
> from our domain, from only two designated servers. So, drop outgoing
> mail
> from any other host.
> 
> I can't seem to produce the iptables command to get this to work...
> (using
> forward chain, because using transp. bridging firewall...)
> 
> I guess this: iptables -A FORWARD -s x.x.x.0/24 -p tcp --dport 25
> -REJECT
> would drop all outgoing mail, right? (i guess the way to select outgoing
> mail traffic would be to use --dport..?)
> 
> Now i have to find a way to make an exclusion in that rule. something
> like
> -s x.x.x.0/24 EXCEPT x.x.x.y
> 
> Could anyone shed some light onto this..?
> 
> Thanks very much in advance,
> Yours,
> Mourik Jan
> 




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

end of thread, other threads:[~2002-10-01 19:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-01 14:08 howto only allow outgoing mail from certain hosts Heupink, Mourik Jan C.
2002-10-01 15:38 ` Boryan Yotov
     [not found] <0EB90DD25728C04CBD401CDCD72D2A655A8E@homer.no.laasby.com>
2002-10-01 19:20 ` mourik jan c heupink

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox