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 # # # Verify Sender (MAIL FROM envelope field) # # встречная проверка корректности адресов отправителей # используется check_mail_address.pl (http://victor.corvax.kiev.ua/check_mail_address/) # dnl # используется для исключения из встречной проверки сообщений от авторизованных отправителей dnl # define(`confVERIFY_SENDER_SKIP', `AUTH')dnl dnl # dnl # используется для исключения из встречной проверки исходящих сообщений dnl # define(`confVERIFY_SENDER_SKIP, `OUTGOING')dnl dnl # подробнее об исходящих сообщениях см. HACK(`is_outgoing') dnl # dnl # используется для исключения из встречной проверки сообщений, MAIL FROM которых указан в access_db в виде: dnl # VerifySender:mailbox@subdomain.maildomain OK dnl # VerifySender:subdomain.maildomain OK dnl # VerifySender:maildomain OK dnl # VerifySender: VERIFY dnl # define(`confVERIFY_SENDER_SKIP', `EXCLUDED')dnl dnl # dnl # реализована возможность проведения предварительной проверки хоста dnl # (PTR записи, доменной зоны, A записи, сети) в access_db dnl # (создано правило verify_sender_check_host) dnl # подробнее см. verify_sender_check_host.m4 dnl # divert(0) VERSIONID(`$Id: verify_sender.m4,v 8.12-0.06 2003/09/12 20:29:15 corvax Exp $')dnl divert(-1) dnl ifelse_strstr(confVERIFY_SENDER_SKIP, `EXCLUDED', `dnl ifdef(`_ACCESS_TABLE_', `dnl', `dnl errprint(`*** ERROR: HACK(verify_sender) requires FEATURE(access_db) ')')') dnl HACK(`precheck_envelope')dnl dnl ifdef(`confMAIL_FROM_CHECKER',, `define(`confMAIL_FROM_CHECKER', `/usr/local/scripts/check_mail_address.pl')') dnl dnl LOCAL_CONFIG dnl dnl Kmail_from_check program `'confMAIL_FROM_CHECKER dnl dnl LOCAL_RULESETS dnl dnl SLocal_check_mail # R $* $: $>Parse0 $>3 $1 R $* $: $1 $| $>verify_sender $1 R $+ $| < error: $* User unknown > $#error $: 554 5.1.7 Sender unknown R $+ $| < error: $+ > $+ $#error $: 554 $1 R $+ $| $* $: $1 Sverify_sender ifelse_strstr(confVERIFY_SENDER_SKIP, `AUTH', `dnl # skip checks for authentificated senders R $* $: $&{auth_type} $| $1 R $+ $| $* $@ SKIP_AUTH R $* $| $* $: $2 ') dnl # check client host R $* $: $1 $| $>verify_sender_check_host $&{client_name} $| $&{client_addr} R $* $| SKIP $@ SKIP_HOST R $* $| $#$* $#$2 R $* $| $* $: $1 ifelse_strstr(confVERIFY_SENDER_SKIP, `OUTGOING', `dnl # skip checks for outgoing messages R $* $: $&{IsOutgoing} $| $1 R YES $| $* $@ SKIP_OUTGOING R $* $| $* $: $2 ') dnl R $+ < @ $+ > $* $: $1@$2 R $+ . $: $1 ifelse_strstr(confVERIFY_SENDER_SKIP, `EXCLUDED', `dnl # skip checks for excluded messages R $* $: $1 R $+ @ $+ $: < $(access VerifySender:$1@$2 $: ? $) > $1 @ $2 R $+ @ $+ $: < $(access VerifySender:@$2 $: ? $) > $1 @ $2 R $+ @ $+ $: $>D <$2> R <$*> $: <$1> $2 R $+ @ $+ $: < $(access VerifySender: $: ? $) > $1 @ $2 R $* $@ SKIP_EXCLUDED R $* $@ SKIP_EXCLUDED R <$*> $* $: $2 ') dnl R $+ @ $+ $: < $(mail_from_check $1@$2 $) > Sverify_sender_check_host