divert(-1) # # Copyright (c) 2003, 2004 Victor Ustugov # This hack is under BSD License # Redistributions of source code must retain the above copyright notice # # hacks disscussion's maillist - http://www.mta.org.ua/mailman/listinfo/sendmail-conf # # # check_fake_internal # # проверка поддельных локальных письмем # dnl # отвергание сообщений, пришедших не из trusted сетей, с внутренними доменами dnl # в MAIL FROM или RCPT TO dnl # internal домены должны быть указаны в access_db с квалификатором InternalDomain: dnl # dnl # InternalDomain:InternalDomain YES dnl # InternalDomain:@subdomain.InternalDomain YES dnl # dnl # исключения указываются со значением NO: dnl # InternalDomain:in.subdomain.domain YES dnl # InternalDomain:test.in.subdomain.domain NO dnl # dnl # домен localhost считается внутренним автоматически без записи в access_db dnl # dnl # trusted сетями считаются сети/хосты, прописанные dnl # в access_db с квалификтором Connect (и без него) и значением RELAY dnl # dnl # отличные квалификатор и значение в access_db можно задать в виде парамеров: dnl # HACK(`check_fake_internal', `! TrustedNets', `Ok') dnl # divert(0) VERSIONID(`$Id: check_fake_internal.m4,v 8.12-0.08 2005/11/23 13:05:59 corvax Exp $')dnl divert(-1) dnl ifdef(`_ACCESS_TABLE_', `', ` errprint(`*** ERROR: HACK(check_fake_internal) requires FEATURE(access_db) ')') dnl dnl LOCAL_CONFIG dnl dnl define(`_TRUSTED_NETS3_QUALIFIER_', `ifelse(len(X`'_ARG_),`1',`+Connect',_ARG_)')dnl define(`_TRUSTED_NETS3_VALUE_', `ifelse(len(X`'_ARG2_),`1',`RELAY',_ARG2_)')dnl dnl dnl LOCAL_RULESETS dnl dnl SLocal_check_rcpt R $* $: $1 $| $&{rcpt_to} R $* $| <$*> $: $1 $| $2 dnl R $* $| $+ @ $+ $: $1 $| $2 @ $3 $| $>check_address_internal $2@$3 #R $* $| $* $| $#$* $#$3 R $* $| $* $| $#$* $#error $: 554 5.1.7 You do not have permission to send mail with RCPT TO:$&{rcpt_to} R $* $| $* $| $* $: $1 $| $2 dnl R $* $| $+ @ $+ $: $1 $| $2 @ $3 $| $>check_domain_internal $3 #R $* $| $* $| $#$* $#$3 R $* $| $* $| $#$* $#error $: 554 5.1.7 You do not have permission to send mail with RCPT TO:$&{rcpt_to} R $* $| $* $| $* $: $1 R $* $| $: $1 SLocal_check_mail R $* $: $1 $| $&{mail_from} R $* $| <$*> $: $1 $| $2 dnl R $* $| $+ @ $+ $: $1 $| $2 @ $3 $| $>check_address_internal $2@$3 #R $* $| $* $| $#$* $#$3 R $* $| $* $| $#$* $#error $: 554 5.1.7 You do not have permission to send mail with this MAIL FROM R $* $| $* $| $* $: $1 R $* $| $: $1 dnl R $* $: $1 $| $&f R $* $| <$*> $: $1 $| $2 dnl R $* $| $+ @ $+ $: $1 $| $2 @ $3 $| $>check_address_internal $2@$3 #R $* $| $* $| $#$* $#$3 R $* $| $* $| $#$* $#error $: 554 5.1.7 You do not have permission to send mail with this MAIL FROM R $* $| $* $| $* $: $1 $| $2 dnl R $* $| $+ @ $+ $: $1 $| $2 @ $3 $| $>check_domain_internal $3 # R $* $| $* $| $#$* $#$3 R $* $| $* $| $#$* $#error $: 554 5.1.7 You do not have permission to send mail with this MAIL FROM R $* $| $* $| $* $: $1 R $* $| $: $1 Scheck_address_internal R $* . $: $1 dnl R $* $: $&{auth_type} $| $1 R $+ $| $* $@ SKIP_AUTH R $* $| $* $: $2 dnl R $* $: $1 $| $>A <$&{client_addr}> <_TRUSTED_NETS3_QUALIFIER_> <> R $* $| <_TRUSTED_NETS3_VALUE_> $* $@ SKIP_TRUSTED R $* $| <$*> $* $: $1 dnl R $* $| $: $1 $| $>D <$&{client_name}> <_TRUSTED_NETS3_QUALIFIER_> <> R $* $| <_TRUSTED_NETS3_VALUE_> $* $@ SKIP_TRUSTED R $* $| <$*> $* $: $1 dnl R $* $: $1 R $* $: <$(access InternalAddress:$1 $: ? $)> $1 R $* $@ NOT_INTERNAL R $* $@ NOT_INTERNAL R <$*> $* $: $2 dnl R $* $#error $: 554 5.1.7 Access denied Scheck_domain_internal R $* . $: $1 dnl R $* $: $&{auth_type} $| $1 R $+ $| $* $@ SKIP_AUTH R $* $| $* $: $2 dnl R $* $: $1 $| $>A <$&{client_addr}> <_TRUSTED_NETS3_QUALIFIER_> <> R $* $| <_TRUSTED_NETS3_VALUE_> $* $@ SKIP_TRUSTED R $* $| <$*> <> $: $1 $| <$2> dnl R $* $| $: $1 $| $>D <$&{client_name}> <_TRUSTED_NETS3_QUALIFIER_> <> R $* $| <_TRUSTED_NETS3_VALUE_> $* $@ SKIP_TRUSTED R $* $| <$*> <> $: $1 R $* $| <$*> $: $1 dnl R $* $: $1 R localhost $: localhost R $* $: <$(access InternalDomain:@$1 $: ? $)> $1 R $* $: $>D <$1> <$1> R <$*> <$*> $: <$1> $2 R $* $@ NOT_INTERNAL R $* $@ NOT_INTERNAL R <$*> $* $: $2 dnl R $* $#error $: 554 5.1.7 Access denied HACK(`precheck_envelope')dnl