Cấu hình SASL Postfix

Oct 02 2020

Chúng tôi có ứng dụng như Jira cần gửi tới email cho người dùng. Đã sử dụng Postfix làm máy chủ email và đã thực hiện cấu hình được đề cập bên dưới. Test kết nối, test email đều ok. Tôi muốn bật xác thực SASL và cũng đã cấu hình cho điều đó. Nhưng có vẻ như xác thực không thực sự hoạt động. Tôi đã nhập sai tên người dùng và mật khẩu trong Jira, nhưng nó vẫn có thể kết nối với máy chủ và có thể gửi email. Ai đó có thể vui lòng giúp tôi ?

Trong /etc/postfix/sasl_passwd, tôi đã nhập nội dung sau

test-jira@<domainname.com> jira_test:test123

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname,<"all other destination list">
mydomain = <"my domain name">
myhostname =  <"my hotname name">
mynetworks = <"ALL IPS">
myorigin = $mydomain 
newaliases_path = /usr/bin/newaliases.postfix 
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
relay_domains = $mydestination
relayhost = <"MY RELAY HOST SERVER DETAILS">
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_sasl_auth_enable = yes 
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd 
smtp_sender_dependent_authentication = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination 
unknown_local_recipient_reject_code = 550 

Trả lời

tater Oct 02 2020 at 16:45

Nếu postfix đang hoạt động như một máy chủ (tức là SMTP daemon) và sẽ thực hiện xác thực, thì bạn cần đặt ủy quyền vào smtpd_. Từ câu hỏi có vẻ như bạn đã đặt nó vào smtp_(khách hàng).

Cái gì đó như

smtpd_sasl_security_options = noanonymous
smtpd_sasl_auth_enable = yes

Thông thường, ủy quyền sẽ không đi vào sasl_passwdvì đó là lưu trữ mật khẩu cho các máy chủ từ xa .