[Mimedefang] Bloclking mail to a mailing list if mail is from outside of our network

James Smith sysadmin at aims.gov.au
Tue Sep 23 01:57:04 EDT 2003


> -----Original Message-----
> From: Mathew Thomas [mailto:mathew.thomas at rmit.edu.au] 
>
>  I am managing a mail gateway for a Uni which is running on 
> Sendmail. All mail from inside and
> outside our network are routed via the gateway. 
> 
> There are more five hundred of mailing list in our GroupWise. 
> The GroupWise server has got user at ems.uni.edu.au as well as  
> mailinglist at ems.uni.edu.au. I would like to block mail  only 
> to these mailing  lists (mailinglist at ems.uni.edu.au) , if the 
> mail is  from outside, but allow all mail from inside the 
> network to the mailing list. (ie allow mail to the list if a 
> mail is from an IP in the 
> /etc/mail/relay-domains.).  How can I do it.  Please help

Hi Mathew,

The following code is untested so may need some work, but should set you in
the right direction. You will also need to install Net::IP::Match, grab it
here:
http://search.cpan.org/~marcel/Net-IP-Match-0.01/ 


Use Net::IP::Match;

foreach $RcptAddr (@Recipients){
	# Change the 192.168.0.0/16 to your internal subnet.
	if(! __MATCH_IP($RelayAddr, '192.168.0.0/16') && ($RcptAddr =~
/^<?mailinglist\@ems\.uni\.edu\.au>?$/i)) {
		# Relay IP was not internal, bouncing.
		action_bounce("External posting to this address denied");
	}
}

Regards
James

><> ><> ><> ><> ><> ~~~~~ <>< <>< <>< <>< <><
Systems Administrator
Australian Insitute of Marine Science
Townsville, FNQ, Australia
Phone +61 7 4753 4400  Fax +61 7 4772 5852
Email: sysadmin at aims.gov.au
><> ><> ><> ><> ><> ~~~~~ <>< <>< <>< <>< <><



More information about the MIMEDefang mailing list