Tôi có "Ubuntu 20.04.3 LTS" trên Raspberry Pi 4,
và tôi đang cố định cấu hình postfix để sử dụng máy chủ chuyển tiếp phụ thuộc vào người gửi.
Postfix là mail_version = 3.4.13 và tôi có
một IP động.
Lược đồ trông như thế này:
- người dùng cục bộ gửi email đến postfix (máy chủ email cục bộ)
- postfix viết lại TỪ địa chỉ
- phụ thuộc vào địa chỉ TỪ viết lại chọn đúng máy chủ chuyển tiếp
- gửi thư đến relayhost qua cổng 587
cho điểm 1) và 2) tôi có một tập tin sender_canonical tạo:
[email protected] [email protected]
[email protected] [email protected]
Đối với điểm 3) tôi có một tập tin bản đồ chuyển tiếp tạo:
@gmx.de mail.gmx.net:587
@gmail.com smtp.gmail.com:587
Đối với điểm 4) tôi có một tập tin pass_smarthost tạo:
[email protected] [email protected]:UserA-GMX-Password
[email protected] [email protected]:UserB-Gmail-Password
Tôi đã thử nghiệm nó với điều này:
tiếng vang "kiểm tra" | sendmail -f ttm [email protected]
Nhưng hiện tại tôi nhận được:
đuôi -f /var/log/syslog | grep --line-buffered "postfix\|relay\|generic"
Ngày 7 tháng 9 18:28:29 ubuntu-RPI4 postfix/pickup[24810]: 5CFF24028B: uid=0 from=<ttm>
Ngày 7 tháng 9 18:28:29 ubuntu-RPI4 postfix/dọn dẹp[24830]: 5CFF24028B: message-id=<[email protected]>
Ngày 7 tháng 9 18:28:29 ubuntu-RPI4 postfix/qmgr[24811]: 5CFF24028B: from=<[email protected]>, size=256, nrcpt=1 (hàng đợi đang hoạt động)
Ngày 7 tháng 9 18:28:29 ubuntu-RPI4 postfix/smtp[24833]: kết nối với mx04.posteo.de[185.67.36.64]:25: Kết nối bị từ chối
Ngày 7 tháng 9 18:28:29 ubuntu-RPI4 postfix/smtp[24833]: kết nối với mx01.posteo.de[185.67.36.61]:25: Kết nối bị từ chối
Ngày 7 tháng 9 18:28:29 ubuntu-RPI4 postfix/smtp[24833]: kết nối với mx01.posteo.de[185.67.36.62]:25: Kết nối bị từ chối
Ngày 7 tháng 9 18:28:29 ubuntu-RPI4 postfix/smtp[24833]: kết nối với mx03.posteo.de[185.67.36.63]:25: Kết nối bị từ chối
Ngày 7 tháng 9 18:28:29 ubuntu-RPI4 postfix/smtp[24833]: kết nối với mx03.posteo.de[185.67.36.70]:25: Kết nối bị từ chối
Ngày 7 tháng 9 18:28:29 ubuntu-RPI4 postfix/smtp[24833]: 5CFF24028B: to=<[email protected]>, relay=none, delay=0.51, delays=0.07/0.08/0.36/0, dsn=4.4 .1, status=deferred (kết nối với mx03.posteo.de[185.67.36.70]:25: Kết nối bị từ chối)
Đối với tôi, có vẻ như hậu tố đó cố gắng gửi email trực tiếp đến máy chủ người nhận trên cổng 25 - thay vì sử dụng máy chủ chuyển tiếp (ở đây gmx.de).
Và viết lại không đến đúng địa chỉ - có thể là một vòng tròn?
Tôi đã cố gắng thêm tùy chọn "-v" vào master.cf để xem thêm chi tiết hoặc nhận gợi ý về những gì đang diễn ra.
Nhưng tôi đã không nhận được lỗi. Tôi đang thiếu gì?
Bất kỳ gợi ý sẽ hữu ích.
Cảm ơn bạn trước.
chính.cf:
# Xem /usr/share/postfix/main.cf.dist để biết phiên bản đầy đủ hơn đã nhận xét
# Debian cụ thể: Chỉ định tên tệp sẽ gây ra lỗi đầu tiên
# dòng của tệp đó sẽ được sử dụng làm tên. Mặc định của Debian
# là /etc/mailname.
myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = không
# nối thêm .domain là công việc của MUA.
append_dot_mydomain = không
# Bỏ ghi chú dòng tiếp theo để tạo cảnh báo "thư bị trì hoãn"
#delay_warning_time = 4h
readme_directory = không
# Xem http://www.postfix.org/COMPATIBILITY_README.html -- mặc định là 2 trên
# lượt cài đặt mới.
mức độ tương thích = 2
# Thông số TLS
# smtpd
smtpd_tls_cert_file=/etc/postfix/sslcert/mailserver20210902.crt
smtpd_tls_key_file=/etc/postfix/sslcert/mailserver20210902.key
bị hỏng_sasl_auth_clients = có
smtpd_tls_security_level=có thể
smtpd_sasl_type = bồ câu
smtpd_sasl_path = riêng tư/xác thực
smtpd_tls_auth_only = có
smtpd_sasl_auth_enable = có
smtpd_sasl_authenticated_header = có
smtpd_sasl_local_domain = $mydomain
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql_sender_login_maps.cf
smtpd_recipient_restrictions = permit_sasl_authenticated permit_mynetworks reject_unauth_destination reject_unknown_reverse_client_hostname
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = ttmsacer.homenet
mydomain = $myhostname
mydestination = localhost.homenet, localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
máy chủ chuyển tiếp =
mạng của tôi = 127.0.0.0/8, [::ffff:127.0.0.0]/104, [::1]/128, 192.168.178.0/24
hộp thư_size_limit = 0
người nhận_delimiter = +
message_size_limit = 52768000
# vô hiệu hóa virtual_mailbox_limit bằng cách đặt thành 0:
virtual_mailbox_limit = 0
inet_interfaces = 127.0.0.1, máy chủ cục bộ, 192.168.178.20
inet_protocols = tất cả
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocation_maps $transport_maps $mynetworks $smtpd_sender_login_maps
local_transport = ảo
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 104
virtual_uid_maps = tĩnh:5000
virtual_gid_maps = tĩnh:5000
virtual_transport = lmtps:inet:localhost:24
# máy chủ thông minh / smtp
smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=có thể
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_tls_policy_maps = hash:/etc/postfix/tls_policy
smtp_sender_dependent_authentication = có
smtp_sasl_auth_enable = có
smtp_sasl_security_options = vô danh
smtp_connection_cache_on_demand = không
smtp_sasl_password_maps = hash:/etc/postfix/pass_smarthost
sender_dependent_relayhost_maps = hash:/etc/postfix/relaymap
sender_canonical_classes = phong bì_sender, header_sender
sender_canonical_maps = hash:/etc/postfix/sender_canonical
get_override_options = no_address_mappings
master.cf
# Tệp cấu hình quy trình tổng thể Postfix. Để biết chi tiết về định dạng
# của tệp, xem trang hướng dẫn chính (5) (lệnh: "man 5 master" hoặc
# trực tuyến: http://www.postfix.org/master.5.html).
#
# Đừng quên thực hiện "tải lại postfix" sau khi chỉnh sửa tệp này.
#
# ================================================= ==========================
# loại dịch vụ riêng tư unpriv đánh thức chroot lệnh maxproc + args
# (có) (có) (không) (không bao giờ) (100)
# ================================================= ==========================
smtp inet n - y - - smtpd -v
#smtp inet n - y - 1 màn hình đăng
#smtpd vượt qua - - y - - smtpd
#dnsblog unix - - y - 0 dnsblog
#tlsproxy unix - - y - 0 tlsproxy
đệ trình inet n - n - - smtpd -v
-o syslog_name=postfix/gửi
-o smtpd_tls_security_level=mã hóa
-o smtpd_sasl_auth_enable=có
-o smtpd_tls_auth_only=có
# -o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=$mua_client_restrictions
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
-o smtpd_relay_restrictions=permit_sasl_authenticated,từ chối
# -o milter_macro_daemon_name=ĐANG XUẤT HÀNH
smtps inet n - y - - smtpd -v
-o syslog_name=postfix/smtps
# -o smtpd_tls_wrappermode=có
-o smtpd_sasl_auth_enable=có
# -o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=$mua_client_restrictions
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
-o smtpd_relay_restrictions=permit_sasl_authenticated,từ chối
# -o milter_macro_daemon_name=ĐANG XUẤT HÀNH
#628 inet n - y - - qmqpd
đón unix n - y 60 1 đón -v
dọn dẹp unix n - y - 0 dọn dẹp -v
qmgr unix n - n 300 1 qmgr
#qmgr unix n - n 300 1 oqmgr
tlsmgr unix - - y 1000? 1 tlsmgr
viết lại unix - - y - - tầm thường-viết lại -v
bị trả lại unix - - y - 0 bị trả lại
trì hoãn unix - - y - 0 thoát
theo dõi unix - - y - 0 bị trả lại
xác minh unix - - y - 1 xác minh
tuôn ra unix n - y 1000? 0 tuôn ra
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - y - - smtp
chuyển tiếp unix - - y - - smtp
-o syslog_name=postfix/$service_name
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - y - - showq
lỗi unix - - y - - lỗi
thử lại unix - - y - - lỗi
loại bỏ unix - - y - - loại bỏ
unix cục bộ - n n - - cục bộ
unix ảo - n n - - ảo
lmtp unix - - y - - lmtp
đe unix - - y - 1 đe
scache unix - - y - 1 scache
postlog unix-dgram n - n - 1 postlogd
#
# ================================================= ===================
# Giao diện cho phần mềm không phải Postfix. Hãy chắc chắn kiểm tra hướng dẫn
# trang của phần mềm không phải Postfix để tìm ra những tùy chọn mà nó muốn.
#
# Nhiều dịch vụ sau sử dụng phân phối Postfix pipe(8)
# đại lý. Xem trang man pipe(8) để biết thông tin về ${recipient}
# và các tùy chọn phong bì thư khác.
# ================================================= ===================
#
# gửi thư. Xem tệp Postfix MAILDROP_README để biết chi tiết.
# Cũng chỉ định trong main.cf: maildrop_destination_recipient_limit=1
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ================================================= ===================
#
# Các phiên bản Cyrus gần đây có thể sử dụng mục "lmtp" master.cf hiện có.
#
# Chỉ định trong cyrus.conf:
# lmtp cmd="lmtpd -a" nghe="localhost:lmtp" proto=tcp4
#
# Chỉ định trong main.cf một hoặc nhiều điều sau:
# mailbox_transport = lmtp:inet:localhost
# virtual_transport = lmtp:inet:localhost
#
# ================================================= ===================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Cũng chỉ định trong main.cf: cyrus_destination_recipient_limit=1
#
#cyrus unix - n n - - ống
# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ================================================= ===================
# Ví dụ cũ về giao hàng qua Cyrus.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ================================================= ===================
#
# Xem tệp Postfix UUCP_README để biết chi tiết về cấu hình.
#
uucp unix - n n - - ống
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($người nhận)
#
# Các phương thức giao hàng bên ngoài khác.
#
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - ống
cờ = Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 ống
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
người đưa thư unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${người dùng}
# ================================================= ===================
lmtps unix - - - - - lmtp
-o lmtp_use_tls=có
-o lmtp_enforce_tls=có
-o lmtp_tls_mandatory_protocols=!SSLv2,!SSLv3
-o lmtp_tls_protocols=!SSLv2,!SSLv3
-o lmtp_tls_mandatory_ciphers=cao
-o lmtp_tls_ciphers=cao
-o lmtp_send_xforward_command=yes
-o lmtp_tls_security_level=mã hóa
-o lmtp_tls_note_starttls_offer=có
-o lmtp_address_preference=ipv4