postfix에 tld 블랙리스트 추가

postfix에 tld 블랙리스트 추가

내 postfix 설정에서 특정 TLD 도메인(제 경우에는 ".info"로 끝나는 모든 도메인)에서 들어오는 모든 메일을 "비활성화"하고 싶습니다. 도메인을 차단하는 일반적인 방법은 /etc/postfix/rejected_domains다음과 같은 해시 파일을 사용하는 것입니다.

[...]
bla.info     REJECT Spam
blubb.info   REJECT More Spam!
[...]

main.cf내 파일 에 다음 구성이 있습니다 .

# domains to be restricted
smtpd_sender_restrictions = hash:/etc/postfix/rejected_domains
reject_unauth_destinations = hash:/etc/postfix/rejected_domains

모든 정보를 차단하려는 내 생각은 위 파일에 다음 규칙을 추가하는 것이었습니다.

*.info  REJECT Toooo much spam
.info   REJECT Toooo much spam

불행하게도 이것은 작동하지 않는 것 같습니다.

2.8.5-2~build0.10.04여기에서 Ubuntu LTS 10에서 postfix를 사용합니다 .

답변1

해시는 리터럴(정확히 일치)용이므로 regex 또는 pcre를 사용하고 싶습니다.

~처럼초월체이미 값이 있는 경우 이를 추가하고 싶다면 다음을 사용하여 기존 값을 확인할 수 있습니다.

postconf smtpd_sender_restrictions
postconf reject_unauth_destinations

그런 다음 다음을 사용하여 이를 재정의할 수 있습니다.

postconf -e smtpd_sender_restrictions=pcre:/etc/postfix/rejected_domains
postconf -e reject_unauth_destinations=pcre:/etc/postfix/rejected_domains

/etc/postfix/rejected_domains의 내용:

/\.info$/           REJECT All Info Domains

그런 다음postfix reload

답변2

smtpd_helo_restrictions =
    permit_mynetworks
    permit_sasl_authenticated
    check_helo_access hash:/etc/postfix/helo_blacklist
    check_helo_access hash:/etc/postfix/helo_whitelist
    reject_invalid_helo_hostname
    reject_non_fqdn_helo_hostname
    reject_unknown_helo_hostname

helo_blacklist에서

info REJECT INFO tld blocked

실행하다postmap helo_blacklist

info로 끝나는 helo를 표시하는 서버에는 다음과 같은 오류가 발생합니다.

Helo command rejected: INFO tld blocked;

답변3

허용되는 답변과 달리smtpd_sender_restrictions는 직접 가져오지 않지만 pcre:가 필요합니다 check_sender_access type:table.

smtpd_recipient_restrictions = 
    check_sender_access pcre:/etc/postfix/sender_access

그런 다음 다음을 /etc/postfix/sender_access가질 수 있습니다.

/\.info$/  550  I do not accept mail from .info
/\.icu$/   550  https://blocked.icu/

관련 정보