I recently set up postfix + dovecot on a aws ec2 instance following this guide: http://flurdy.com/docs/postfix/#config-secure-auth
Currently I'm stuck with SASL.
The SQL query doesn't seem to be what has been configured. Here are the configs:
/etc/postfix/sasl/smtpd.conf
shows
pwcheck_method: saslauthd
mech_list: plain login
log_level: 7
allow_plaintext: true
auxprop_plugin: sql
sql_engine: mysql
sql_hostnames: 127.0.0.1
sql_user: mail
sql_passwd: passwd
sql_database: maildb
sql_select: select crypt from users where id='%u@%r' and enabled = 1
and
/etc/sasl2/smtpd.conf
shows
pwcheck_method: saslauthd
mech_list: plain login
log_level: 7
allow_plaintext: true
auxprop_plugin: sql
sql_engine: mysql
sql_hostnames: 127.0.0.1
sql_user: mail
sql_passwd: password
sql_database: maildb
sql_select: select crypt from users where id='%u@%r' and enabled = 1
and
/etc/pam.d/smtp
#%PAM-1.0
auth required pam_mysql.so user=mail passwd=password host=127.0.0.1 db=maildb table=users usercolumn=id passwdcolumn=crypt crypt=1 debug
account sufficient pam_mysql.so user=mail passwd=password host=127.0.0.1 db=maildb table=users usercolumn=id passwdcolumn=crypt crypt=1 debug
Now the config files defined select crypt from users where id='%u@%r' and enabled = 1
as the select query for the password.
When the auth failed and I checked /var/log/secure
I found out that a wrong select query is used:
Jun 1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - SELECT crypt FROM users WHERE id = 'admin'
Jun 1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - SELECT returned no result.
Jun 1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - pam_mysql_check_passwd() returning 1.
Jun 1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - pam_mysql_sql_log() called.
Jun 1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - pam_mysql_sql_log() returning 0.
Jun 1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - pam_sm_authenticate() returning 10.
Jun 1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - pam_mysql_release_ctx() called.
Jun 1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - pam_mysql_destroy_ctx() called.
Jun 1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - pam_mysql_close_db() called.
What could be the cause of this?