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 host from first non-local Received field in RFC Ignorants Lists # Проверка хоста из первого нелокального поля Received в списка RFC Ignorants # dnl # dnl # ВНИМАНИЕ!!! HACK не закончен! dnl # dnl # после выполнения HACK(`parse_received') значения _RHSBL_SRV_, _ARG_, etc становятся пустыми 8-( dnl # dnl # divert(0) ifdef(`_ERHSBL_R_RECEIVED_',`dnl',`dnl VERSIONID(`$Id: check_received_rhsbl.m4,v 8.12-0.03 2004/23/07 15:01:05 corvax Exp $')dnl divert(-1) ') dnl LOCAL_CONFIG dnl define(`_RHSBL_SRV_', `_ARG_')dnl define(`_RHSBL_SRV_', `ifelse(len(X`'_ARG_),`1',`abuse.rfc-ignorant.org',`_ARG_')')dnl define(`_RHSBL_MSG_', `ifelse(len(X`'_ARG2_),`1',`"550 Mail from " $`'&{hop_host_addr} " refused by blackhole site '_RHSBL_SRV_`"',`_ARG2_')')dnl define(`_RHSBL_MSG_TMP_', `ifelse(_ARG3_,`t',`"451 Temporary lookup failure of " $`'&{hop_host_addr} " at '_RHSBL_SRV_`"',`_ARG3_')')dnl dnl ifdef(`_ERHSBL_R_RECEIVED_',`dnl',`dnl define(`_ERHSBL_R_RECEIVED_',`') dnl HACK(`parse_received')dnl dnl dnl LOCAL_RULESETS dnl dnl SLocal_check_mail # clear macro R $* $: $(macro {hop_host_addr} $) $1 SCheck_Received R from $+ ( $+ [ $-.$-.$-.$- ] ) by $* $: from $1 ( $2 [ $3.$4.$5.$6 ] ) by $7 R from $+ ( $+ [ 127.$-.$-.$- ] ) by $* $: from $1 ( $2 [ 127.$3.$4.$5 ] ) by $6 R from $+ ( $+ [ 10.$-.$-.$- ] ) by $* $: from $1 ( $2 [ 10.$3.$4.$5 ] ) by $6 R from $+ ( $+ [ 172.16.$-.$- ] ) by $* $: from $1 ( $2 [ 172.16.$3.$4 ] ) by $5 R from $+ ( $+ [ 192.168.$-.$- ] ) by $* $: from $1 ( $2 [ 192.168.$3.$4 ] ) by $5 R from $+ ( $+ [ $-.$-.$-.$- ] ) by $* $: $(macro {hop_host_addr} $@ $2 [ $3.$4.$5.$6 ] $) from $1 ( $2 [ $3.$4.$5.$6 ] ) by $7 R from $+ ( $-.$+ [ $-.$-.$-.$- ] ) by $* $: $(macro {hop_host_domain} $@ $3 $) from $1 ( $2.$3 [ $4.$5.$6.$7 ] ) by $8 R <$*> from $+ ( $+ [ $-.$-.$-.$- ] ) by $* $: from $1 ( $2 [ $3.$4.$5.$6 ] ) by $7 Scheck_eoh R $* $: $1 $| $&{hop_host_addr} R $* $| $+ [ $-.$-.$-.$- ] $: $1 $| $>Check_Received_RHSBL $2 R $* $| $#$* $#$2 R $* $| $* $: $1 ') dnl dnl LOCAL_RULESETS dnl dnl SCheck_Received_RHSBL # DNS based RHS spam list _RHSBL_SRV_R_ R $-.$+ $: <@> $1.$2 R <@> $-.$+ $: <@> $1.$2 $| $>SearchList $| <> R <@> $* $| <$={Accept}> $: $1 R <@> $* $| <$*> $: <@> $1 R <@> $-.$+ $: < $(dns_a $2._RHSBL_SRV_. $: OK $) > $1.$2 R <@> $* $: $1 R $* $: $1 ifelse(len(X`'_ARG3_),`1', `R <$+> $* $: $2', `R <$+> $* $#error $@ 4.7.1 $: _RHSBL_MSG_TMP_') #R <$+> $* $#error $@ 5.7.1 $: _RHSBL_MSG_ R <$+> $-.$+ $: < $(dns_txt $3._RHSBL_SRV_. $: UNKNOWN $) > $2.$3 R < UNKNOWN > $* $#error $@ 5.7.1 $: _RHSBL_MSG_ R < $* > $* $#error $@ 5.7.1 $: _RHSBL_MSG_ #R < $+ > $-.$+ $#error $@ 5.7.1 $: $&{{hop_host_addr}} ": " $1 " see http://www.rfc-ignorant.org/tools/lookup.php?domain="$&{hop_host_domain} R < $+ > $-.$+ $#error $@ 5.7.1 $: $2.$3 ": " $1 " see http://www.rfc-ignorant.org/tools/lookup.php?domain="$3 R < $* > $* $#error $@ 5.7.1 $: _RHSBL_MSG_ R <$*> $* $: $2 dnl