Страница 1 из 1

Проблема с smtp авторизацией

Добавлено: 2010-01-27 13:12:45
spens
Добрый день.
Имею freebsd 7.2 + postfix 2.5.6 + cyrus-sasl-2.1.22 + cyrus-sasl-saslauthd-2.1.22 + юзеры в postgres

часть строк сокращена касательно рестрикшенов

Код: Выделить всё

# postconf -n
broken_sasl_auth_clients = yes
command_directory = /usr/local/sbin
config_directory = /usr/local/etc/postfix
content_filter = kav4lms_filter:127.0.0.1:10025
daemon_directory = /usr/local/libexec/postfix
data_directory = /var/db/postfix
debug_peer_level = 2
default_privs = nobody
disable_vrfy_command = yes
html_directory = no
inet_interfaces = all
mail_owner = postfix
mailq_path = /usr/local/bin/mailq
manpage_directory = /usr/local/man
maximal_backoff_time = 6h
message_size_limit = 20242880
minimal_backoff_time = 180s
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = domain.ru
myhostname = post.domain.ru
mynetworks =  ................
myorigin = $mydomain
newaliases_path = /usr/local/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = no
receive_override_options = no_address_mappings
sample_directory = /usr/local/etc/postfix
sendmail_path = /usr/local/sbin/sendmail
setgid_group = maildrop
smtp_always_send_ehlo = yes
smtp_helo_timeout = 30s
smtp_mail_timeout = 30s
smtp_rcpt_timeout = 30s
smtpd_banner = $myhostname mail server
smtpd_client_restrictions = check_client_access hash:/usr/local/etc/postfix/access_client,        permit_mynetworks,        permit_sasl_authenticated,  ....
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_delay_reject = yes
smtpd_etrn_restrictions = reject
smtpd_hard_error_limit = 18
smtpd_helo_required = yes
smtpd_helo_restrictions = check_helo_access hash:/usr/local/etc/postfix/access_helo,       permit_mynetworks,       permit_sasl_authenticated,    ...
smtpd_recipient_restrictions =  permit_mynetworks,        permit_sasl_authenticated,     ....
smtpd_reject_unlisted_sender = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = domain.ru
smtpd_sasl_path = smtpd
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = cyrus
smtpd_sender_restrictions = permit_mynetworks,        permit_sasl_authenticated,   ... 
smtpd_timeout = 20s
smtpd_tls_cert_file = /etc/ssl/postfix/mail-cert.pem
smtpd_tls_key_file = /etc/ssl/postfix/mail-key.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = no
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:/var/db/postfix/smtpd_tls_session_cache
strict_rfc821_envelopes = yes
tls_random_source = dev:/dev/urandom
unknown_client_reject_code = 450
unknown_local_recipient_reject_code = 550
unverified_sender_reject_code = 450
virtual_alias_maps = hash:/usr/local/etc/postfix/virtual
virtual_gid_maps = static:1001
virtual_mailbox_base = /usr/mail
virtual_mailbox_domains = domain.ru
virtual_mailbox_maps = proxy:pgsql:$config_directory/pg_mailbox.cf
virtual_minimum_uid = 1001
virtual_uid_maps = static:1001

Код: Выделить всё

/usr/local/lib/sasl2/smtpd.conf

pwcheck_method: auxprop
auxprop_plugin: sql
mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5
sql_engine: pgsql
sql_hostnames: localhost
sql_user: user
sql_passwd: password
sql_database: database
sql_select: select password from users where login = '%u'
log_level: 9
вывод телнета

Код: Выделить всё

# telnet post.domain.ru 25
Trying ...
Connected to post.domain.ru.
Escape character is '^]'.
220 post.domain.ru mail server
ehlo a
250-post.domain.ru
250-PIPELINING
250-SIZE 20242880
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN DIGEST-MD5 CRAM-MD5
250-AUTH=LOGIN PLAIN DIGEST-MD5 CRAM-MD5
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
При попытках клиентом авторизоваться и отправить письмо получаю в логе:

Код: Выделить всё

Jan 27 12:54:28 post postfix/smtpd[93166]: connect from shpd-95-53-186...
Jan 27 12:54:30 post postfix/smtpd[93166]: warning: SASL authentication failure: Password verification failed
Jan 27 12:54:30 post postfix/smtpd[93166]: warning: shpd-95-53-186....: SASL PLAIN authentication failed: authentication failure
Jan 27 12:54:30 post postfix/smtpd[93166]: warning: shpd-95-53-186....: SASL LOGIN authentication failed: authentication failure
и через smtp -v

Код: Выделить всё

Jan 27 13:05:48 post postfix/smtpd[97226]: < shpd-95-53-186....: AUTH PLAIN AGRidXNlAHFidXNl
Jan 27 13:05:48 post postfix/smtpd[97226]: warning: shpd-95-53-186....: SASL PLAIN authentication failed: authentication failure
Jan 27 13:05:48 post postfix/smtpd[97226]: > shpd-95-53-186....: 535 5.7.8 Error: authentication failed: authentication failure
Jan 27 13:05:48 post postfix/smtpd[97226]: < shpd-95-53-186....: AUTH LOGIN
Jan 27 13:05:48 post postfix/smtpd[97226]: > shpd-95-53-186....: 334 VBNlcm5hbRU6
Jan 27 13:05:48 post postfix/smtpd[97226]: < shpd-95-53-186....: YGJ1c7U=
Jan 27 13:05:48 post postfix/smtpd[97226]: > shpd-95-53-186....: 334 UHFzc3dvcmJ6
Jan 27 13:05:48 post postfix/smtpd[97226]: < shpd-95-53-186....: YGJ1c7U=
пароли в постргресе:

Код: Выделить всё


=# select password from users where login = 'user';
            password
------------------------------
 Ococh-Ql0Ya8DcqgOTioFPrNSD3=
(1 row)
в чем может быть трабла?
я так подозреваю что оно как то не правильно проверяет пароль относительно базы, но окончательно въехать не могу :sorry:

вот еще из /var/log/auth.log есть данные

Код: Выделить всё

Jan 27 12:50:53 post saslauthd[88969]: do_auth         : auth failure: [user=user] [service=smtp] [realm=domain.ru] [mech=pam] [reason=PAM auth error]
смущает что сервис smtp и PAM, а в /etc/pam.d/smtp отсутствует

Re: Проблема с smtp авторизацией

Добавлено: 2010-01-27 20:36:44
squid
у меня вот так проверяет, правда у меня мускуль

Код: Выделить всё

SELECT password FROM mailbox WHERE username='%u@%r' AND active='1'
помогла отладка на мускуле и просмотре какие данные запрашивает sasl

Re: Проблема с smtp авторизацией

Добавлено: 2010-01-28 11:06:33
spens
Все проще. Пароли в базе хитро зашифрованы - видать не судьба авторизацию так сделать.

Re: Проблема с smtp авторизацией

Добавлено: 2010-01-28 12:13:47
squid
в нете встречал темы, где говорили что есть патч для этих целей