LinuxForum.Fans
Тема

SLES-10 SP2: Не работает SASL-авторизация в Postfix!

Автор: ACDC 8 сообщений 3715 просмотров
#180682

Имеется SLES 10 SP2 x86-64,настраиваю почтовик Postfix+SASL+TLS+Spamassasin.
За основу взят материал отсюда: _http://nk-rec.narod.ru/samples/lprod/li_postfix_relay/
Нужна простая авторизация без всяких mysql и т.п. - через механизм shadow.
Настройки такие:
/etc/postfix/main.cf:

smtpd_sasl_local_domain =
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_tls_auth_only = no
smtp_use_tls = yes
smtpd_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
smtpd_delay_reject = yes
content_filter=smtp-amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings

#smtp_sasl_password_maps = hash:/etc/postfix/sasldb2
#smtp_sasl_password_maps = hash:/etc/sasldb2
smtp_sasl_password_maps = hash:/etc/passwd - пробовал и так тоже!
smtp_sasl_security_options =
smtpd_sasl_path = /usr/lib64/sasl2/smtpd.conf

вот результат команды saslauthd -v:
saslauthd 2.1.21
authentication mechanisms: getpwent kerberos5 pam rimap shadow ldap
Тут нет поддержки sasldb - поэтому и был выбран механизм shadow.

Хотя первонвчально пробовал настройку по умолчанию через pam, тоже не проходило:
cat /etc/pam.d/smtp:
#%PAM-1.0
auth include common-auth
account include common-account
password include common-password
session include common-session

вот отсюда берет настройки saslauthd: cat /usr/lib64/sasl2/smtpd.conf:
#mech_list: plain login
#pwcheck_method: auxprop
#auxprop_plugin: sasldb

pwcheck_method: saslauthd
#auxprop_plugin: pam
auxprop_plugin: shadow
mech_list: plain login cram-md5 digest-md5

ps ax|grep sasl
26794 ? Ss 0:00 /usr/sbin/saslauthd -a shadow
26795 ? S 0:00 /usr/sbin/saslauthd -a shadow
26796 ? S 0:00 /usr/sbin/saslauthd -a shadow
26797 ? S 0:00 /usr/sbin/saslauthd -a shadow
26798 ? S 0:00 /usr/sbin/saslauthd -a shadow

Тут указываем чтобы saslauth был в /var/spool/postfix/var/run/saslauthd :
/etc/sysconfig/saslauthd:
SASLAUTHD_AUTHMECH=shadow
OPTION="-m /var/spool/postfix/var/run/saslauthd"

Хотя почему-то PID-saslauth настойчиво ложится в /var/run/sasl2:
/var/run/sasl2 # ls -la
total 12
drwxr-xr-x 2 root root 4096 Jul 31 10:48 .
drwxr-xr-x 17 root root 4096 Jul 31 10:46 ..
srwxrwxrwx 1 root root 0 Jul 31 10:48 mux
-rw------- 1 root root 0 Jul 31 10:48 mux.accept
-rw------- 1 root root 6 Jul 31 10:48 saslauthd.pid

результат команды sasldblistusers2 Ж
test1@qwe.ru: userPassword

с сервака команда testsaslauthd -u test1 -p ***** выдает ошибку:
size read failed


Не проходит Sasl-авторизация, соответсвенно даже почтовый пользователь не создается:
tail -f mail:
postfix/smtpd[25776]: connect from smtp4.mail.ru[94.100.176.44]
Jul 31 10:36:21 biserv250 postfix/smtpd[25776]: setting up TLS connection from smtp4.mail.ru[94.100.176.44]
Jul 31 10:36:21 biserv250 postfix/smtpd[25776]: TLS connection established from smtp4.mail.ru[94.100.176.44]: TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)
Jul 31 10:36:21 postfix/smtpd[25776]: NOQUEUE: reject: RCPT from smtp4.mail.ru[94.100.176.44]: 554 <test1@qwe.ru>: Relay access denied; from=<yyy@mail.ru> to=<test1@qwe.ru> proto=ESMTP helo=<smtp4.mail.ru>
Jul 31 10:36:21 postfix/smtpd[25776]: disconnect from smtp4.mail.ru[94.100.176.44]
Jul 31 10:36:28 postfix/qmgr[24164]: warning: connect to transport smtp-amavis: No such file or directory
Jul 31 10:43:18 postfix/qmgr[25925]: warning: connect to transport smtp-amavis: No such file or directory
Jul 31 10:43:24 postfix/smtpd[25945]: connect from unknown[95.56.99.143]
Jul 31 10:43:24 postfix/smtpd[25945]: warning: SASL authentication failure: no secret in database
Jul 31 10:43:24 postfix/smtpd[25945]: warning: unknown[95.56.99.143]: SASL CRAM-MD5 authentication failed
Jul 31 10:43:24 postfix/smtpd[25945]: disconnect from unknown[95.56.99.143]
Jul 31 10:44:18 postfix/qmgr[25925]: warning: connect to transport smtp-amavis: No such file or directory

tail -f messages |grep smtp:
Jul 31 10:36:20 postfix/smtpd[25776]: sql_select option missing
Jul 31 10:36:20 postfix/smtpd[25776]: auxpropfunc error no mechanism available
Jul 31 10:36:20 postfix/smtpd[25776]: _sasl_plugin_load failed on sasl_auxprop_plug_init for plugin: sql

откуда тут берется sasl_auxprop_plug_init for plugin: sql ???
И как все-таки настроить обычную авторизацию пользователей через passwd/shadow?

#180711

Еще информация :
локально : nmap localhost
Interesting ports on localhost (127.0.0.1):
(The 1666 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
53/tcp open domain
139/tcp open netbios-ssn
445/tcp open microsoft-ds
465/tcp open smtps
953/tcp open rndc
локально 25 и 110 нет почему-то

снаружи:
(The 1660 ports scanned but not shown below are in state: filtered)
PORT STATE SERVICE
25/tcp open smtp
53/tcp open domain
80/tcp closed http
110/tcp closed pop3
113/tcp closed auth
143/tcp closed imap
465/tcp open smtps
1723/tcp closed pptp
3264/tcp closed ccmail
3268/tcp closed globalcatLDAP
3269/tcp closed globalcatLDAPssl
3292/tcp closed meetingmaker
снаружи 25 есть , а вот 110 нет - тоже странно!

хотя локально на 25 postfix висит:
# netstat -an| grep :25
tcp 0 0 192.168.128.250:25 0.0.0.0:* LISTEN
tcp 0 0 xx.yyy.zzz.eee:25 0.0.0.0:* LISTEN
tcp 0 0 xx.yyy.zzz.eee:25 92.42.232.158:5965 TIME_WAIT
tcp 0 0 xx.yyy.zzz.eee:25 92.42.232.158:46977 ESTABLISHED

#180737

в данный момент не принимает почту с mail.ru например:
в /var/log/mail такое:

Jul 31 18:39:42 postfix/smtpd[7800]: connect from fallback5.mail.ru[94.100.176.59]
Jul 31 18:39:42 postfix/smtpd[7800]: match_list_match: fallback5.mail.ru: no match
Jul 31 18:39:42 postfix/smtpd[7800]: match_list_match: 94.100.176.59: no match
Jul 31 18:39:42 postfix/smtpd[7800]: match_list_match: fallback5.mail.ru: no match
Jul 31 18:39:42 postfix/smtpd[7800]: match_list_match: 94.100.176.59: no match

при этом Delivery на mail.ru не возвращается - соединение висит на 25 порту и тишина:

tcp 0 0 xxx.yyy.zzz.eee:25 0.0.0.0:* LISTEN
tcp 0 0 xxx.yyy.zzz.eee:25 94.100.176.59:42910 ESTABLISHED

Если пишу письма между локальными письмами то они считаются spam-ом и попадают в
/var/spool/amavis/virusmails
ящики пользователей так и не создаются postfix-ом ни в какую...

#180901

Перемещу тему в админскую ветку, SUSE тут ни при чем :)

#186670

Cнес все, заново ставлю с нуля:

в данный момент почтовик работает на винде за firewall-ом, ему организован проброс 25 и 110 портов .
Надо настроить postfix, все отладить и перенести пользователей с виндового почтавика на postfix.

пока Postfix запускаю на порту smtp_my(2525):
main.cf:
alias_maps = hash:/etc/aliases
biff = no
canonical_maps = hash:/etc/postfix/canonical
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/lib/postfix
debug_peer_level = 2
defer_transports =
disable_dns_lookups = no
disable_mime_output_conversion = no
html_directory = /usr/share/doc/packages/postfix/html
inet_interfaces = all
inet_protocols = all
mail_name = sendmail
mail_owner = postfix
mail_spool_directory = /var/spool/mail
mail_version = 1.0
mailbox_command = /usr/bin/procmail
mailbox_size_limit = 0
mailbox_transport =
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
masquerade_classes = envelope_sender, header_sender, header_recipient
masquerade_domains =
masquerade_exceptions = root
message_size_limit = 10240000
mydestination = $myhostname, localhost.$mydomain
mydomain = domain.xx
myhostname = mail.domain.xx
mynetworks = 192.168.128.0/24, 127.0.0.0/8
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/packages/postfix/README_FILES
relayhost =
relocated_maps = hash:/etc/postfix/relocated
sample_directory = /usr/share/doc/packages/postfix/samples
sender_canonical_maps = hash:/etc/postfix/sender_canonical
sendmail_path = /usr/sbin/sendmail
setgid_group = maildrop
smtp_sasl_auth_enable = no
smtp_use_tls = no
smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)
smtpd_client_restrictions =
smtpd_helo_required = no
smtpd_helo_restrictions =
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sender_restrictions = hash:/etc/postfix/access
smtpd_use_tls = no
strict_8bitmime = no
strict_rfc821_envelopes = no
transport_maps = hash:/etc/postfix/transport
unknown_local_recipient_reject_code = 550
virtual_alias_domains = hash:/etc/postfix/virtual
virtual_alias_maps = hash:/etc/postfix/virtual

cat master.cf :
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)

#smtp inet n - n - - smtpd
#smtp unix - - n - - smtp

smtp_my inet n - n - - smtpd
smtp_my unix - - n - - smtp

#submission inet n - n - - smtpd
# -o smtpd_etrn_restrictions=reject
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#smtps inet n - n - - smtpd
# -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
#submission inet n - n - - smtpd
# -o smtpd_etrn_restrictions=reject
# -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes
#628 inet n - n - - qmqpd

pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - n 300 1 oqmgr
#tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap

# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay unix - - n - - smtp
-o fallback_relay=
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - n - - showq
error unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
#localhost:10025 inet n - n - - smtpd -o content_filter=
scache unix - - n - 1 scache

# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1

maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
cyrus unix - n n - - pipe
user=cyrus argv=/usr/lib/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
procmail unix - n n - - pipe
flags=R user=nobody argv=/usr/bin/procmail -t -m /etc/procmailrc ${sender} ${recipient}

создал пользователя test1. Отправляю почту:

/etc/postfix # telnet localhost 2525
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.domain.xx ESMTP sendmail (1.0)
ehlo mail.domain.xx
250-mail.domain.xx
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250 8BITMIME
auth plain
334
AHRlc3QxAHBhc3N3b3Jk
235 Authentication successful
mail from:<>
250 Ok
rcpt to:<test1@domain.xx>
250 Ok
data
354 End data with <CR><LF>.<CR><LF>
hello from Number 2!
.
250 Ok: queued as 732A212DA4F
quit
221 Bye

в логе такое:

Aug 24 18:16:02 postfix/smtpd[23646]: 732A212DA4F: client=localhost[127.0.0.1], sasl_method=plain, sasl_username=test1
Aug 24 18:16:19 postfix/cleanup[23812]: 732A212DA4F: message-id=<20110824121602.732A212DA4F@mail.domain.xx>
Aug 24 18:16:20 postfix/qmgr[23632]: 732A212DA4F: from=<>, size=342, nrcpt=1 (queue active)
Aug 24 18:16:20 postfix/qmgr[23632]: 732A212DA4F: to=<test1@domain.xx>, relay=none, delay=36, status=deferred (delivery temporarily suspended: transport is unavailable)
postfix/qmgr[23632]: warning: connect to transport smtp: Connection refused

пробовал в master.cf строку
#smtp unix - - n - - smtp
тогда postfix пишет что:
postfix/smtp[21173]: connect to mail.domain.xx[xx.yyy.zzz.www]: Connection refused (port 25)

не пашет транспортный агент хотя агент procmail прописан в mai.cf...
Подскажите, что нужно исправить?

#186933

up!

#186940

Раскомментил строку:
smtp unix - - n - - smtp

postfix restart

отсылаю письмо от заведенной учетки:

250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250 8BITMIME
auth plain
334
AHRlc3QxAHBhc3N3b3Jk
235 Authentication successful
mail from:<test1@domain.xx>
250 Ok
rcpt to:<user@mail.ru>
250 Ok
data
354 End data with <CR><LF>.<CR><LF>
test n 1!
.
250 Ok: queued as B020312DA21
quit
221 Bye

письмо на майл.ру уходит нормально,в логе:

Aug 25 18:22:55 postfix/smtpd[23963]: B020312DA21: client=localhost[127.0.0.1], sasl_method=plain, sasl_username=test1
Aug 25 18:23:06 postfix/cleanup[23965]: B020312DA21: message-id=<20110825122255.B020312DA21@mail.domain.xx>
Aug 25 18:23:06 postfix/qmgr[22996]: B020312DA21: from=<test1@domain.xx>, size=336, nrcpt=1 (queue active)
Aug 25 18:23:07 postfix/smtp[23978]: B020312DA21: to=<user@mail.ru>, relay=mxs.mail.ru[94.100.176.20], delay=24, status=sent (250 OK id=1QwYwR-0000Q8-00)
Aug 25 18:23:07 postfix/qmgr[22996]: B020312DA21: removed
Aug 25 18:23:08 postfix/smtpd[23963]: disconnect from localhost[127.0.0.1]

при ответе с майлюру сразу пишет что:
This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

test1@domain.xx
SMTP error from remote mailer after RCPT TO:<test1@domain.xx>:
host mail.domain.xx [xx.yy.zz.ww]: 550 User not found

получается такой учетки естественно нет на виндозном почтаре и сразу получаем ответ?
как добиться чтобы проверить учетку в postfix на порту 2525 (чтобы создался ящик postfix-ом)?

#187201

Наружу письма уходят нормально.
Не отсылаются письма между внутренними учетками:

Aug 26 17:01:39 postfix/smtpd[2991]: connect from localhost[127.0.0.1]
Aug 26 17:02:15 postfix/smtpd[2991]: 8E19412DA46: client=localhost[127.0.0.1], sasl_method=plain, sasl_username=test1
Aug 26 17:02:22 postfix/cleanup[2993]: 8E19412DA46: message-id=<20110826110215.8E19412DA46@mail.domain.xx>
Aug 26 17:02:22 postfix/qmgr[1965]: 8E19412DA46: from=<>, size=333, nrcpt=1 (queue active)
Aug 26 17:02:22 postfix/smtp[2994]: 8E19412DA46: to=<test2@domain.xx>, relay=none, delay=20, status=bounced (mail for domain.xx loops back to myself)
Aug 26 17:02:22 postfix/qmgr[1965]: 8E19412DA46: removed

Что означает bounced (mail for domain.xx loops back to myself)???

Войдите или зарегистрируйтесь, чтобы ответить.