How to configure Postfix with SMTP-AUTH over SASL2 with authentication against PAM in Ubuntu

article1

I would like to submit emails to Postfix using smtp authentication. I will authenticate my smtp users against PAM.

Install sasl2:

apt-get install sasl2-bin

Add the following to /etc/postfix/sasl/smtpd.conf:

pwcheck_method: saslauthdmech_list: PLAIN LOGIN

Create saslauthd’s config file copy to /etc/default/saslauthd-postfix so that is used from postfix:

cp /etc/default/saslauthd /etc/default/saslauthd-postfix

Update the following in /etc/default/saslauthd-postfix:

START=yes
NAME="saslauthd-postf"
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"

Since we have chrooted saslauthd to postfix so its good to symlink it:

rm -rf /run/saslauthd
ln -s /var/spool/postfix/var/run/saslauthd /run/saslauthd

Create required subdirectories:

dpkg-statoverride --add root sasl 710 /var/spool/postfix/var/run/saslauthd

Setup proper permission by adding postfix to ‘sasl’ group:

adduser postfix sasl

Restart saslauthd service

systemctl restart saslauthd.service

Add the following directives to /etc/postfix/main.cf:

smtpd_sasl_local_domain = $myhostname
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination

Restart postfix service

systemctl restart postfix.service

Create linux user

useradd postmaster

Test authentication using ‘swaks’ mailing utility :

swaks --from postmaster@postfix.io --to foo@gmail.com --tls --auth LOGIN --auth-user postmaster@postfix.io --auth-password 123pass --server console.postfix.io:25

Comments

  1. This is really a good source of information.PowerMTA SMTP Email server. We provide PMTA Setup for Email marketing at affordable Cost with authentication like SPF, DKIM, DMARC and rDNS.Best powermta server service provider.

    ReplyDelete

Post a Comment

Popular posts from this blog

StatusDnsQueryFailed resolving domain

How to include Gmail's Feedback-ID header in DKIM signature

How to send emails over IPv4 with Postfix