openbsd, postfix, sasl, mysql for smtp authentication
- installing courier-authdaemon
# pkg_add -n courier-authlib-mysql-0.58p2.tgz
Pretending to add tcl-8.4.19
Pretending to add expect-5.43.0p0-no_tk
Pretending to add courier-authlib-0.58p3
# pkg_add courier-authlib-mysql-0.58p2.tgz - configure authdaemon for mysql
# vim /etc/courier/authdaemonrc
--> change
authmodulelist="authuserdb authpwd authpgsql authldap authmysql authpipe"
to authmodulelist="authmysql"
--> change
authmodulelistorig="authuserdb authpwd authpgsql authldap authmysql authpipe"
to authmodulelistorig="authmysql"
# vim /etc/courier/authmysqlrc
MYSQL_SERVER localhost
MYSQL_USERNAME postfix
MYSQL_PASSWORD postfixpassword
MYSQL_SOCKET /var/run/mysql/mysql.sock
MYSQL_DATABASE postfix
MYSQL_USER_TABLE mailbox
MYSQL_CLEAR_PWFIELD password
MYSQL_UID_FIELD 1000
MYSQL_GID_FIELD 1000
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD "/var/_mail"
MYSQL_MAILDIR_FIELD CONCAT(SUBSTRING_INDEX(username,'@',-1),'/',SUBSTRING_INDEX(username,'@',1),'/')
MYSQL_QUOTA_FIELD quota
# vim /etc/rc.local
mkdir -p /var/run/courier-auth/
/usr/local/sbin/authdaemond start - re-install postfix with sasl2-mysql, don't forget patch with postfix-VDA
# cd /usr/ports/mail/postfix/stable/
# make fetch
# cd /usr/ports/distfiles/postfix/
# wget http://vda.sourceforge.net/VDA/postfix-2.6.1-vda-ng.patch.gz
# gunzip postfix-2.6.1-vda-ng.patch.gz
# tar zxvf postfix-2.6.1.tar.gz
# cd postfix-2.6.1
# patch -p1 < ../postfix-2.6.1-vda-ng.patch
# cd ..
# tar zcvf postfix-2.6.1.tar.gz postfix-2.6.1
# cd /usr/ports/mail/postfix/stable/
# make makesum
# env FLAVOR="sasl2 mysql" make install
# postfix stop
# postfix start - configure smtp.conf in sasl2 with mysql authentication
# vim /usr/local/lib/sasl2/smtpd.conf
pwcheck_method: saslauthd auxprop
auxprop_plugin: sql
mech_list: PLAIN LOGIN
sql_engine: mysql
sql_user: postfix
sql_passwd: postfixpassword
sql_hostnmame: localhost
sql_database: postfix
sql_select: select password from mailbox where username='%u@%r'
sql_verbose: true
debug_level:7 - configure postfix support sasl2
# vim /etc/postfix/main.cf
smtpd_recipient_restrictions =
permit_mynetworks,
reject_unauth_destination,
reject_non_fqdn_recipient,
reject_non_fqdn_sender,
reject_unknown_recipient_domain,
check_policy_service inet:127.0.0.1:10030,
reject_rbl_client bl.spamcop.net,
reject_rbl_client cbl.abuseat.org,
reject_rbl_client dnsbl.sorbs.net,
reject_rbl_client b.barracudacentral.org,
reject_rbl_client zen.spamhaus.org,
reject_rbl_client sbl-xbl.spamhaus.org,
reject_rbl_client bl.spamcannibal.org,
reject_rbl_client multi.uribl.com,
reject_rbl_client dsn.rfc-ignorant.org,
reject_rbl_client dul.dnsbl.sorbs.net,
reject_rbl_client list.dsbl.org,
reject_rbl_client ix.dnsbl.manitu.net,
reject_rbl_client combined.rbl.msrbl.net,
reject_rbl_client rabl.nuclearelephant.com,
permit_sasl_authenticated
permit
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous - restart postfix
# postfix reload - test smtp
--> test it using outlook express and set smtp authentication enable, set your email_address as username and email_password as password
Labels: mysql, openbsd, postfix, postfix virtual user, sasl2, smtp authentication

