[Comm] Postfix + SMTP-AUTH + SASL + MySQL

Eugene Prokopiev =?iso-8859-1?q?prokopiev_=CE=C1_stc=2Edonpac=2Eru?=
Вс Окт 30 21:27:42 MSK 2005


> postfix-2.2.x относить к стандартным в ALM24 сомнительно.

а я не постфикс, а способ поиска конфигов отношу к стандартным :)

> saslauthd не умеет работать с SQL. Для этого существует
> libsasl2-plugin-sql

libsasl2-plugin-sql у меня установлен

> Конфиги от реально работающей системы ALM24:
> postfix-2.0.20-alt1.3
> postfix-pgsql-2.0.20-alt1.3
> postfix-pcre-2.0.20-alt1.3
> libsasl2-2.1.19-alt1
> libsasl2-plugin-sql-2.1.19-alt1
> 
>  username |  password  | domain_name | active
> ----------+------------+-------------+--------
>  user1    | XXXXXXXXXX | mydomain.ru |      1
> 
> /etc/postfix/sasl/smtpd.conf:
> auxprop_plugin: sql
> 
> sql_engine: pgsql
> sql_user: mail
> sql_passwd: secret
> sql_hostnames: localhost
> sql_database: mail
> 
> sql_statement: select password from mailusers where username = '%u' and
> domain_name = '%r' and active = 1
> 
> 
> Вот, собственно, и вся настройка.

Создал практически идентичную конфигурацию, разве что вместо pgsql у 
меня mysql.

При попытке отослать письмо из Thunderbird имею:

/var/log/auth/messages:

Oct 30 21:08:36 myserver postfix/smtpd[29932]: sql plugin Parse the 
username john
Oct 30 21:08:36 myserver postfix/smtpd[29932]: sql plugin try and 
connect to a host
Oct 30 21:08:36 myserver postfix/smtpd[29932]: sql plugin trying to open 
db 'dbmail' on host 'localhost'
Oct 30 21:08:36 myserver postfix/smtpd[29932]: sql plugin could not 
connect to host localhost
Oct 30 21:08:36 myserver postfix/smtpd[29932]: sql plugin couldn't 
connect to any host

/var/log/mail/all:

Oct 30 21:08:32 myserver postfix/smtpd[29932]: warning: SASL 
authentication failure: OTP: auxprop backend can't store properties
Oct 30 21:08:32 myserver postfix/smtpd[29932]: connect from 
localhost.localdomain[127.0.0.1]
Oct 30 21:08:32 myserver postfix/smtpd[29932]: warning: SASL 
authentication failure: no secret in database
Oct 30 21:08:32 myserver postfix/smtpd[29932]: warning: 
localhost.localdomain[127.0.0.1]: SASL CRAM-MD5 authentication failed
Oct 30 21:08:32 myserver postfix/smtpd[29932]: warning: SASL 
authentication failure: no secret in database
Oct 30 21:08:32 myserver postfix/smtpd[29932]: warning: 
localhost.localdomain[127.0.0.1]: SASL NTLM authentication failed
Oct 30 21:08:32 myserver postfix/smtpd[29932]: warning: SASL 
authentication failure: Password verification failed
Oct 30 21:08:32 myserver postfix/smtpd[29932]: warning: 
localhost.localdomain[127.0.0.1]: SASL PLAIN authentication failed
Oct 30 21:08:32 myserver postfix/smtpd[29932]: warning: 
localhost.localdomain[127.0.0.1]: SASL LOGIN authentication failed
Oct 30 21:08:36 myserver postfix/smtpd[29932]: warning: SASL 
authentication failure: no secret in database
Oct 30 21:08:36 myserver postfix/smtpd[29932]: warning: 
localhost.localdomain[127.0.0.1]: SASL CRAM-MD5 authentication failed
Oct 30 21:08:36 myserver postfix/smtpd[29932]: warning: SASL 
authentication failure: no secret in database
Oct 30 21:08:36 myserver postfix/smtpd[29932]: warning: 
localhost.localdomain[127.0.0.1]: SASL NTLM authentication failed
Oct 30 21:08:36 myserver postfix/smtpd[29932]: warning: SASL 
authentication failure: Password verification failed
Oct 30 21:08:36 myserver postfix/smtpd[29932]: warning: 
localhost.localdomain[127.0.0.1]: SASL PLAIN authentication failed
Oct 30 21:08:36 myserver postfix/smtpd[29932]: warning: 
localhost.localdomain[127.0.0.1]: SASL LOGIN authentication failed

При этом причин для "could not connect to host localhost" или "couldn't 
connect to any host" вроде бы нет:

$ mysql -u dbmail dbmail -h localhost -p
Enter password:

mysql> show tables;
+---------------------------+
| Tables_in_dbmail          |
+---------------------------+
| dbmail_acl                |
| dbmail_aliases            |
| dbmail_auto_notifications |
| dbmail_auto_replies       |
| dbmail_filters            |
| dbmail_mailboxes          |
| dbmail_messageblks        |
| dbmail_messages           |
| dbmail_pbsp               |
| dbmail_physmessage        |
| dbmail_subscription       |
| dbmail_users              |
+---------------------------+
12 rows in set (0.00 sec)

mysql>

И еще:

1. Как ограничить список способов авторизации? NTLM мне точно не нужен.

2. Как авторизоваться телнетом? Чем генерить логин/пароль?

3. Зачем в принципе нужен saslauthd? Если Postfix в состоянии без него 
обходиться, то кто не в состоянии и почему?

-- 
С уважением, Прокопьев Евгений



Подробная информация о списке рассылки community