235 words
1 minutes
Hướng dẫn cấu hình chặn email, domain trong Zimbra
Tài liệu cấu hình chặn email/domain gửi trong Zimbra
1. Tạo danh sách email và domain bị chặn
1.1. Tạo file chặn theo email cụ thể
vi /opt/zimbra/conf/postfix_reject_senderVí dụ nội dung:
cpanel@umac.com.vn REJECTadmin@primepicks.cloud REJECTm.jamali@jsk-co.com REJECTphattv@gmail.com REJECT1.2. Tạo file chặn theo domain
vi /opt/zimbra/conf/postfix_reject_sender_domainsVí dụ:
expomob.com REJECTbagrass.com REJECTLưu ý: Cần định dạng đúng
email hoặc domain + REJECT.
2. Biên dịch các file thành dạng lmdb
/opt/zimbra/common/sbin/postmap /opt/zimbra/conf/postfix_reject_sender/opt/zimbra/common/sbin/postmap /opt/zimbra/conf/postfix_reject_sender_domains3. Cấu hình Postfix để sử dụng danh sách
3.1. Kiểm tra hiện tại:
su - zimbra -c "postconf smtpd_sender_restrictions"3.2. Thêm dòng kiểm tra check_sender_access
su - zimbra -c "zmprov ms mail.phucanh.com.vn +zimbraMtaSmtpdSenderRestrictions 'check_sender_access lmdb:/opt/zimbra/conf/postfix_reject_sender'"Nếu bạn muốn thêm cả file domain:
su - zimbra -c "zmprov ms mail.phucanh.com.vn +zimbraMtaSmtpdSenderRestrictions 'check_sender_access lmdb:/opt/zimbra/conf/postfix_reject_sender_domains'"Lệnh này cập nhật cấu hình
zmprovđể bổ sung vào các chính sách của Zimbra MTA.
4. Tải lại dịch vụ để áp dụng
su - zimbra -c "postfix reload"su - zimbra -c "zmmtactl restart"5. Kiểm tra kết quả trong log
grep -iE "gmail.com" /var/log/zimbra.logVí dụ log khi chặn thành công:
NOQUEUE: reject: RCPT from mail-ej1-f49.google.com[209.85.218.49]: 554 5.7.1 <phattv@gmail.com>: Sender address rejected: Access denied;6. Mẫu hoàn chỉnh file /opt/zimbra/conf/postfix_reject_sender
cpanel@umac.com.vn REJECTadmin@primepicks.cloud REJECTm.jamali@jsk-co.com REJECTphattv@gmail.com REJECT7. Mẫu file /opt/zimbra/conf/postfix_reject_sender_domains
expomob.com REJECTbagrass.com REJECTGhi chú
- Sau mỗi lần chỉnh sửa file
.conf, bạn bắt buộc phải chạy lạipostmapvà restart dịch vụ. - Dùng
lmdb:thay vìhash:nếu Zimbra đang dùng Postfix 3.x+ (như trong Zimbra 9+). - Đảm bảo không chỉnh sửa trùng nhau hoặc xung đột các rule trong
smtpd_sender_restrictions.