LDAP 조회를 통해 찾은 메일 주소로 보낸 메일을 거부하는 방법

LDAP 조회를 통해 찾은 메일 주소로 보낸 메일을 거부하는 방법

LDAP 조회를 통해 특정 이메일 주소로 전송된 이메일을 거부하려고 합니다.

나는 이 LDAP 조회 테이블을 만들었습니다.

version = 3
timeout = 100

## set the size_limit to 1 since we only
## want to find one email address match
size_limit = 1
expansion_limit = 0

start_tls = no
tls_require_cert = no

server_host = ldaps://ldap.xxxx.test/
search_base = ou=NoEmail, ou=xxxx,dc=xxxx,dc=xxx,dc=test
scope = sub
query_filter = (|(|(mail=%[email protected](mail=%[email protected]))(uid=%s))
result_attribute = mail
result_filter = reject

bind = yes
bind_dn = cn=ldap-user,ou=SystemUsers,dc=xxxx,dc=xxx,dc=test
bind_pw = xxxxxxxxxxxxx

명령을 실행하면 postmap -q USERNAME ldap:/etc/postfix/ldap-deleted.cf다음과 같은 결과가 출력되지만 rejectpostfix는 여전히 메일을 받아들입니다.

smtpd_restriction_classes나는 와 를 모두 시도했습니다 .smtpd_recipient_restrictions

smtpd_restriction_classes = noauth
noauth = check_recipient_access ldap:/etc/postfix/ldap-deleted.cf
smtpd_recipient_restrictions = check_recipient_access ldap:/etc/postfix/ldap-deleted.cf, permit_mynetworks,reject_unauth_destination

나는 또한 시도했다smtpd_helo_restrictions

smtpd_helo_restrictions = ldap:/etc/postfix/ldap-deleted.cf

로그에는 다음이 표시됩니다.

Sep 21 09:11:45 tst postfix/qmgr[4354]: CEDFB26DA14: from=<[email protected]>, size=769, nrcpt=1 (queue active)
Sep 21 09:11:45 tst postfix/smtpd[4383]: disconnect from unknown[xxxxxxxxxx] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7
Sep 21 09:11:45 tst postfix/local[4388]: CEDFB26DA14: to=<[email protected]>, relay=local, delay=0.19, delays=0.13/0.01/0/0.05, dsn=2.0.0, status=sent (delivered to mailbox)

답변1

local_recipient_maps나는 ldap 파일에 지정한 사용자에게만 메일을 허용하도록 postfix를 잠그는 것을 발견했습니다.

local_recipient_maps = ldap:/etc/postfix/ldap-active.cf

관련 정보