Created
October 9, 2020 12:16
-
-
Save egeneralov/14f4f49a35a379cf285782e7463a6f22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -xec | |
| apt-get install -yq libsasl2-modules postfix sasl2-bin | |
| cat << EOF > /etc/postfix/sasl/smtpd.conf | |
| pwcheck_method: saslauthd | |
| mech_list: PLAIN LOGIN | |
| EOF | |
| cp /etc/default/saslauthd /etc/default/saslauthd-postfix | |
| cat << EOF >> /etc/default/saslauthd-postfix | |
| START=yes | |
| DESC="SASL Auth. Daemon for Postfix" | |
| NAME="saslauthd-postf" # max. 15 char. | |
| # Option -m sets working dir for saslauthd (contains socket) | |
| OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd" # postfix/smtp in chroot() | |
| EOF | |
| dpkg-statoverride --add root sasl 710 /var/spool/postfix/var/run/saslauthd | |
| adduser postfix sasl | |
| service saslauthd restart | |
| cp /etc/pam.d/{other,smtp} | |
| postconf -e 'smtpd_sasl_local_domain = $myhostname' | |
| postconf -e 'smtpd_sasl_auth_enable = yes' | |
| postconf -e 'broken_sasl_auth_clients = yes' | |
| postconf -e 'smtpd_sasl_security_options = noanonymous' | |
| postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination' | |
| service postfix restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment