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 # # # Restrict using of LUSER_RELAY # Ограничение использования LUSER_RELAY # dnl примеры исползования: dnl dnl необходимо запретить прием для неизвестных локальных пользователей сообщений от: dnl отправителей из домена domain.com (но не из поддоменов domain.com), кроме postmaster@domain.com dnl LUSER_FROM:postmaster@domain.com OK dnl LUSER_FROM:@domain.com REJECT dnl всех отправителей из домена another.domain и всех его поддоменов dnl LUSER_FROM:another.domain REJECT dnl отправителя user@foo.bar dnl LUSER_FROM:user@foo.bar REJECT dnl необходимо запретить прием сообщений для несущестующего локального пользователя zuper-user: dnl LUSER_TO:zuper-user REJECT dnl необходимо запретить прием сообщений для несущестующего локальных пользователей от отправителей, dnl адреса которых содержат ящик test@ dnl LUSER_FROM:test@ REJECT dnl divert(0) VERSIONID(`$Id: restrict_luser_relay.m4,v 8.12-0.08 2005/12/06 17:53:15 corvax Exp $')dnl divert(-1) dnl ifdef(`_ACCESS_TABLE_', `', ` errprint(`*** ERROR: HACK(restrict_luser_relay) requires FEATURE(access_db) ')') ifndef(`LUSER_RELAY', ` errprint(`*** ERROR: HACK(restrict_luser_relay) requires variable LUSER_RELAY ')')dnl dnl dnl LOCAL_RULESETS dnl dnl SLocal_localaddr dnl R $+ + $* $: $1 R $* $: $1 R $* $: < $(user $1 $: ? $) > $1 R $* $: < $(aliases $1 $: ? $) > $1 R < $* <>> $* $: < $1 > $2 dnl R $* $: $1 $| $>Local_localaddr_local $1 R $* $| $* $: $1 $| $>Local_localaddr_local $&{rcpt_to} R $* $| $#$* $#$2 R $* $| $* $: $1 SLocal_localaddr_local dnl R <$*> $: $1 R $* $: $1 $| $&f dnl # проверка LUSER_COMPAT:<><@>recipient_mailbox R $* $| $: < $(access LUSER_COMPAT:<><@>$1 $: ? $) > $1 $| dnl # проверка LUSER_COMPAT:sender_address<@>recipient_mailbox R $* $| $+ $: < $(access LUSER_COMPAT:$2<@>$1 $: ? $) > $1 $| $2 dnl # проверка LUSER_COMPAT:@sender_domain<@>recipient_mailbox R $* $| $+@$+ $: < $(access LUSER_COMPAT:@$3<@>$1 $: ? $) > $1 $| $2@$3 dnl # проверка LUSER_COMPAT:sender_domain<@>recipient_mailbox R $* $| $+@$+ $: < $(access LUSER_COMPAT:$3<@>$1 $: ? $) > $1 $| $2@$3 dnl # проверка LUSER_COMPAT:sender_mailbox@<@>recipient_mailbox R $* $| $+@$+ $: < $(access LUSER_COMPAT:$2@<@>$1 $: ? $) > $1 $| $2@$3 dnl R $* $| $* $: $1 $| $&{mail_addr} dnl # проверка LUSER_COMPAT:sender_mailbox@sender_domain<@>recipient_mailbox R $* $| $+ $: < $(access LUSER_COMPAT:$2<@>$1 $: ? $) > $1 $| $2 dnl # проверка LUSER_COMPAT:@sender_domain<@>recipient_mailbox R $* $| $+@$+ $: < $(access LUSER_COMPAT:@$3<@>$1 $: ? $) > $1 $| $2@$3 dnl # проверка LUSER_COMPAT:sender_domain<@>recipient_mailbox R $* $| $+@$+ $: < $(access LUSER_COMPAT:$3<@>$1 $: ? $) > $1 $| $2@$3 dnl # проверка LUSER_COMPAT:sender_mailbox@<@>recipient_mailbox R $* $| $+@$+ $: < $(access LUSER_COMPAT:$2@<@>$1 $: ? $) > $1 $| $2@$3 dnl dnl # проверка LUSER_TO:recipient_mailbox R $* $| $* $: < $(access LUSER_TO:$1 $: ? $) > $1 $| $2 dnl # проверка LUSER_TO:recipient_mailbox@recipient_domain R $* $| $* $: < $(access LUSER_TO:$1 $: ? $) > $1 $| $2 dnl # проверка LUSER_TO:@recipient_domain R $+@$+ $| $* $: < $(access LUSER_TO:@$2 $: ? $) > $1@$2 $| $3 dnl # проверка LUSER_TO:recipient_domain R $+@$+ $| $* $: < $(access LUSER_TO:$2 $: ? $) > $1@$2 $| $3 dnl # проверка LUSER_TO:recipient_mailbox@ R $+@$+ $| $* $: < $(access LUSER_TO:$1@ $: ? $) > $1@$2 $| $3 dnl # проверка LUSER_TO:recipient_mailbox@ R $+ $| $* $: < $(access LUSER_TO:$1@ $: ? $) > $1 $| $2 dnl dnl R $* $| $* $: $1 $| $&f dnl # проверка LUSER_FROM:<> R $* $| $: < $(access LUSER_FROM:<> $: ? $) > $1 $| # проверка LUSER_FROM:sender_mailbox@sender_domain R $* $| $+@$+ $: < $(access LUSER_FROM:$2 $: ? $) > $1 $| $2@$3 dnl # проверка LUSER_FROM:@sender_domain R $* $| $+@$+ $: < $(access LUSER_FROM:@$3 $: ? $) > $1 $| $2@$3 dnl # проверка LUSER_FROM:sender_mailbox@ R $* $| $+@$+ $: < $(access LUSER_FROM:$2@ $: ? $) > $1 $| $2@$3 dnl # проверка LUSER_FROM:sender.subdomain.sender_domain # проверка LUSER_FROM:sender_domain R $* $| $+@$+ $: $>D <$3> < ! LUSER_FROM > < $1 $| $2@$3 > R <$*> < $* $| $+@$+ > $: < $1 > $2 $| $3@$4 dnl R $* $| $* $: $1 $| $&{mail_addr} dnl # проверка LUSER_FROM:sender_mailbox@sender_domain R $* $| $+@$+ $: < $(access LUSER_FROM:$2 $: ? $) > $1 $| $2@$3 dnl # проверка LUSER_FROM:@sender_domain R $* $| $+@$+ $: < $(access LUSER_FROM:@$3 $: ? $) > $1 $| $2@$3 dnl # проверка LUSER_FROM:sender_mailbox@ R $* $| $+@$+ $: < $(access LUSER_FROM:$2@ $: ? $) > $1 $| $2@$3 dnl # проверка LUSER_FROM:sender.subdomain.sender_domain # проверка LUSER_FROM:sender_domain R $* $| $+@$+ $: $>D <$3> < ! LUSER_FROM > < $1 $| $2@$3 > R <$*> < $* $| $+@$+ > $: < $1 > $2 $| $3@$4 dnl dnl # отделяем отправителей из локальных доменов (в ${mail_addr} отсутствует "@" R $* $| $+@$+ $: $1 $| $2@$3 R $* $| $+ $: < $(access LUSER_FROM:$2 $: ? $) > $1 $| $2 # отделяем политики по умолчанию для локальных отправителей из локальных доменов R $* $| $+ $: < $(access LUSER_FROM:_LOCAL_ $: ? $) > $1 $| $2 R $* $| $+@$+ $: $1 $| $2@$3 dnl # отделяем политики по умолчанию R $* $| $+ $: < $(access LUSER_FROM: $: ? $) > $1 $| $2 dnl R < REJECT:$* > $* $#error $: $1 R < REJECT > $* $#error $@ 5.1.1 $: User unknown R < REJECT $* > $* $#error $: $1 R < DISCARD:$* > $* $#discard $: $1 R < DISCARD > $* $#discard $: discarded by Local_localaddr R < DISCARD $* > $* $#discard $: $1 dnl R < $* > $* $| $* $: < $1 > $2 R < $* > $* $: $2 dnl