Welcome to Linux Support and Sun Help
Search LinuxSupport
From: Subject: Restricting local users from sending external mail Date: Fri, 14 Sep 2001 08:22:47 +0100 MIME-Version: 1.0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Location: http://www.sendmail.org/~ca/email/restrict.html X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Restricting local users from sending external = mail

Restricting local users from sending external mail

Last = Update=20 2001-09-10=20
This example ruleset restricts local users from sending mail to external = recipients. It uses class w to detect local senders/recipients. = Attention: this protection is only based on the address = information=20 given in the envelope of the e-mail which can be easily forged.=20

List those aliases (which are local) in a file:

LOCAL_CONFIG
F{Internal}/etc/mail/intern.only
Then the rules work like this:
LOCAL_RULESETS
SLocal_check_rcpt
Sr
# dnl get sender address and canonify it
R$*				$: $1 $| $>3 $&f
R$* $| <>			$@ OK		<> is always ok
R$* $| $={Internal} <@$=w.>	$: $1		luser@local.host?
R$* $| $={Internal}		$: $1		luser?
R$* $| $*			$@ OK		someone else
R$*				$: $>3 $1	check recipient
R$+<@$=w.>			$@ OK		local? ok
R$+<@$+>			$#error $@ 5.1.8 $: "551 sorry luser your boss does not =
like you"

Before 8.9, you have to use Scheck_rcpt instead of=20 SLocal_check_rcpt.=20

The ruleset works like this:=20

  1. is the sender a local user (listed in the file)?=20
  2. if no: OK=20
  3. if yes: the recipient must be local too=20
  4. if it isn't: error

[(links)] = [Hints] [Avoiding UBE] = [cf/READM= E]=20 [New]=20
Copyright =A9 Claus=20 A=DFmann Please send comments to: mailto:ca+emailfoot@sendmail.or= g=20
Disclaimer: the information provided may be = inaccurate or=20 outdated or incomplete. Please contact me if you find an = error.=20
Valid HTML 4.01! Valid CSS!