ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Alexei Takaseev <alexei@taf.ru>
To: ALT Linux Community <community@lists.altlinux.ru>
Subject: Re: [Comm] Postfix + SMTP-AUTH + SASL + MySQL
Date: Mon, 31 Oct 2005 00:28:00 +0800
Message-ID: <20051031002800.49ededfa.alexei@taf.ru> (raw)
In-Reply-To: <4364EE51.3010105@stc.donpac.ru>

On Sun, 30 Oct 2005 19:01:21 +0300
Eugene Prokopiev wrote:

> Здравствуйте!
> 
> Задача: настроить SMTP-авторизацию в Postfix, имена и пароли 
> пользователей уже хранятся в MySQL (открытым текстом):
> 
> mysql> select userid, passwd from dbmail_users;
> +--------------------------------+----------+
> | userid                         | passwd   |
> +--------------------------------+----------+
> | john                           | jpwd     |
> +--------------------------------+----------+
> 
> Имею установленные:
> 
> # rpm -qa | grep postfix (взят из бэкпортов)
> postfix-control-1.2-alt1
> postfix-2.2.4-alt0.M24.1
> postfix-html-2.2.4-alt0.M24.1
> postfix-mysql-2.2.4-alt0.M24.1
> postfix-tls-2.2.4-alt0.M24.1
> 
> # rpm -qa | grep sasl (сначала пытался взять из бекпортов, но там
> # alt0, 
> т.е. версия младше - как это получилось?)
> libsasl2-2.1.19-alt1
> libsasl2-plugin-sql-2.1.19-alt1
> cyrus-sasl2-2.1.19-alt1
> cyrus-sasl2-docs-2.1.19-alt1
> 
> Читаю /usr/share/doc/postfix-2.2.4/README.ALT-ru_RU.KOI8-R: "Вся 
> конфигурация SASL находится в /etc/postfix/sasl"
> 
> Однако:
> 
> # ls -l /etc/postfix/sasl
> ls: /etc/postfix/sasl: No such file or directory
> 
> Пытаюсь определить, где лежат конфиги, стандартым методом :)

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

> # rpm -qli `rpm -qa | grep sasl` | grep /etc
> /etc/sasl2
> /etc/sasl2/sasldb2
> /etc/rc.d/init.d/saslauthd
> /etc/sasl2/saslauthd.conf
> /etc/sasl2/saslpasswd.conf
> /etc/sysconfig/saslauthd
> 
> Cмотрю, что там уже наконфигурено:
> 
> # cat /etc/sasl2/saslpasswd.conf
> pwcheck_method: sasldb
> 
> # cat /etc/sasl2/saslauthd.conf | grep -v "^[#]"
> ldap_servers: ldap://10.1.1.15/ ldap://10.1.1.25/
> ldap_bind_dn: cn=operator,ou=Profile,o=foo.com
> ldap_bind_pw: secret
> ldap_version: 3
> ldap_timeout: 5
> ldap_time_limit: 5
> 
> Прихожу в некоторое замешательство от отсутствия упоминаний об sql и
> иду  в search.altlinux.ru, где упоминается совсем другой файл 
> /usr/lib/sasl2/smtpd.conf. О lib говорит и google в ответ на "postfix 
> sasl mysql". Предполагаю, что и в ALT когда-то следовали общим
> правилам,  а затем решили поместить этот файл в более приличное место.

Вообще-то ноги у этого поведения растут от Debian.

> Создаю этот файл и вписываю в него:
> 
> pwcheck_method: auxprop
> auxprop_plugin: sql
> mech_list: plain login
> sql_engine: mysql
> sql_hostnames: localhost
> sql_user: dbmail
> sql_passwd: dbmailpwd
> sql_database: dbmail
> sql_select: select passwd from dbmail_users where userid='%u'
> 
> После запуска сервиса saslauthd приходит мысль протестировать 

saslauthd не умеет работать с 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


Вот, собственно, и вся настройка.


  reply	other threads:[~2005-10-30 16:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-30 16:01 Eugene Prokopiev
2005-10-30 16:28 ` Alexei Takaseev [this message]
2005-10-30 18:27   ` Eugene Prokopiev
2005-10-30 18:43     ` Eugene Prokopiev
2005-10-30 19:13     ` Eugene Prokopiev
2005-10-31  6:02       ` Laaz Vadim
2005-10-31  7:36       ` Alexey I. Froloff
2005-10-31 12:58       ` Alexei Takaseev
2005-10-31 14:09       ` [Comm] " Michael Shigorin
2005-10-31 18:36         ` Pavel Usischev
2005-11-01  6:30       ` [Comm] " Dmitry Lebkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051031002800.49ededfa.alexei@taf.ru \
    --to=alexei@taf.ru \
    --cc=community@lists.altlinux.org \
    --cc=community@lists.altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git