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

Postfix + sasl

Добавлено: 2008-09-29 20:05:41
orpheus
Привет народ. Наткнулся на граблю с сабжем.

Исходники:
system:
  • FreeBSD 7.0-RELEASE-p4
soft:
  • cyrus-sasl-2.1.22_1
    cyrus-sasl-saslauthd-2.1.22
    postfix-current-2.6.20080903,4
мой /usr/local/etc/postfix/main.cf:

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

queue_directory = /var/spool/postfix
command_directory = /usr/local/sbin
daemon_directory = /usr/local/libexec/postfix
data_directory = /var/db/postfix
mail_owner = postfix
myhostname = subdomain.domain.tld
mydomain = domain.tld
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
unknown_local_recipient_reject_code = 550
mynetworks = 127.0.0.1/8
alias_maps = hash:/usr/local/etc/postfix/maps/aliases
alias_database = hash:/usr/local/etc/postfix/maps/aliases
debug_peer_level = 2
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/local/sbin/sendmail
newaliases_path = /usr/local/bin/newaliases
mailq_path = /usr/local/bin/mailq
setgid_group = maildrop
html_directory = no
manpage_directory = /usr/local/man
sample_directory = /usr/local/etc/postfix
readme_directory = no
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, permit
мой /usr/local/etc/postfix/master.cf:

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

smtp      inet  n       -       n       -       -       smtpd -v
-o smtpd_recipient_restrictions=permit_mynetworks,reject
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
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       n       -       -       smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       n       -       -       smtp
        -o smtp_fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
retry     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
scache    unix  -       -       n       -       1       scache
мой /usr/local/lib/sasl2/smtpd.conf:

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

pwcheck_method: saslauthd
mech_list: plain login
Затем проверяю работу:
> telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

читаю лог /var/log/maillog:

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

10:57:27 localhost postfix/smtpd[11328]: warning: SASL: Connect to smtpd failed: No such file or directory
10:57:27 localhost postfix/smtpd[11328]: fatal: no SASL authentication mechanisms
10:57:28 localhost postfix/master[11323]: warning: process /usr/local/libexec/postfix/smtpd pid 11328 exit status 1
10:57:28 localhost postfix/master[11323]: warning: /usr/local/libexec/postfix/smtpd: bad command startup -- throttling
И вот тут ступор. В чем дело? Куда копать?
Заранее благодарю.

Re: Postfix + sasl

Добавлено: 2008-09-30 10:33:10
Alex_hha
А зачем ты используешь бету postfix? Чем вызвана такая необходимость?

Re: Postfix + sasl

Добавлено: 2008-10-02 1:15:49
orpheus
Принял к сведению.
Поставил postfix-2.5.5,1 из /usr/ports/mail/postfix
теперь мой конфиг
# postconf -n

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

command_directory = /usr/local/sbin
config_directory = /usr/local/etc/postfix
daemon_directory = /usr/local/libexec/postfix
data_directory = /var/db/postfix
debug_peer_level = 2
html_directory = no
mail_owner = postfix
mailq_path = /usr/local/bin/mailq
manpage_directory = /usr/local/man
mynetworks_style = host
newaliases_path = /usr/local/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = no
sample_directory = /usr/local/etc/postfix
sendmail_path = /usr/local/sbin/sendmail
setgid_group = maildrop
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
unknown_local_recipient_reject_code = 550
Проверяю
# telnet localhost 25

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

Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.
Лог /var/log/maillog:

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

postfix/smtpd[9424]: warning: SASL: Connect to smtpd failed: No such file or directory
postfix/smtpd[9424]: fatal: no SASL authentication mechanisms
postfix/master[9365]: warning: process /usr/local/libexec/postfix/smtpd pid 9424 exit status 1
postfix/master[9365]: warning: /usr/local/libexec/postfix/smtpd: bad command startup -- throttling
В чем, собсно, дело?

Re: Postfix + sasl

Добавлено: 2008-10-02 3:40:02
wnd
orpheus писал(а): Лог /var/log/maillog:

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

postfix/smtpd[9424]: warning: SASL: Connect to smtpd failed: No such file or directory
postfix/smtpd[9424]: fatal: no SASL authentication mechanisms
В чем, собсно, дело?
При установке cyrus-sasl-2.1.22_1 какие authentication mechanisms установил? plain, login - установил?

Re: Postfix + sasl

Добавлено: 2008-10-02 3:46:19
orpheus
да,
мой /usr/local/lib/sasl2/smtpd.conf:

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

pwcheck_method: saslauthd
mech_list: plain login

Re: Postfix + sasl

Добавлено: 2008-10-02 3:50:25
orpheus
При установке сасла опции [x] plain и [x] login включены.

Re: Postfix + sasl

Добавлено: 2008-10-02 4:48:16
wnd
orpheus писал(а):При установке сасла опции [x] plain и [x] login включены.
покажи postconf -a
а покажи postfix/main.cf, что у тебя написано в smtpd_sasl_path =

и вот еще что: "IMPORTANT: saslauthd usually establishes a UNIX domain socket in /var/run/saslauthd and waits for authentication requests. The Postfix SMTP server must have read+execute permission to this directory or authentication attempts will fail. "

Re: Postfix + sasl

Добавлено: 2008-10-02 5:10:10
orpheus
# postconf -a

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

cyrus
dovecot
мой main.cf

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

queue_directory = /var/spool/postfix
command_directory = /usr/local/sbin
daemon_directory = /usr/local/libexec/postfix
data_directory = /var/db/postfix
mail_owner = postfix
unknown_local_recipient_reject_code = 550
smtpd_sasl_auth_enable=yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, rej
ect_unauth_destination
debug_peer_level = 2
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/local/sbin/sendmail
newaliases_path = /usr/local/bin/newaliases
mailq_path = /usr/local/bin/mailq
setgid_group = maildrop
html_directory = no
manpage_directory = /usr/local/man
readme_directory = no

Re: Postfix + sasl

Добавлено: 2008-10-02 5:16:32
wnd
а добавь в postfix/main.cf:
smtpd_sasl_path = smtpd

Re: Postfix + sasl

Добавлено: 2008-10-02 5:25:12
orpheus
# ls -l /var/run | grep saslauthd

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

drwxrwx---  2 cyrus       mail         512  2 окт 03:38 saslauthd
# id postfix

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

uid=125(postfix) gid=125(postfix) groups=125(postfix),6(mail)
то есть права у группы постфикса (mail) на rwx есть.

Re: Postfix + sasl

Добавлено: 2008-10-02 5:28:27
orpheus
добавил директиву smtpd_sasl_path = smtpd в main.cf. Рестартовал saslauthd и postfix. Проверил - симптомы те же.

Re: Postfix + sasl

Добавлено: 2008-10-02 6:06:44
wnd
брр.. хорошо. что сервер для экспериментов есть...

сделай, линк в /var/spool/postfix на /var/run/authdaemond/saslauthd.pid и не права поставь 755

так вроде работает..

P.S. если у тебя dovecot есть не проще ли через него настроить?
P.P.S. и так между прочим в /etc/rc.conf строчка saslauthd_enable="YES" есть?

Re: Postfix + sasl

Добавлено: 2008-10-02 6:51:11
orpheus
Записи в /etc/rc.conf что касается сасла:
# less /etc/rc.conf | grep sasl

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

saslauthd_enable="YES"
saslauthd_flags="-a pam"
Далее делаю:
cd /var/spool/postfix
ln -s /var/run/authdaemond/saslauthd.pid ./

# ls -l | grep sasl

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

lrwxr-xr-x   1 root     wheel         34  2 окт 06:32 saslauthd.pid -> /var/run/authdaemond/saslauthd.pid
рестартанул сасл, постфикс.

Проверяю:
# telnet localhost 25

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

Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.
В логе старый рассказ =(

Re: Postfix + sasl

Добавлено: 2008-10-02 7:51:31
wnd
у меня та же фигня, а работало потому что dovecot был в конфиге указан :)

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

/usr/local/sbin/saslauthd -v
saslauthd 2.1.22
authentication mechanisms: sasldb getpwent kerberos5 pam rimap
у меня, похоже, что скомпилирован без поддержки plain

P.S. блин, самому уже интерсено как это запустить

Re: Postfix + sasl

Добавлено: 2008-10-02 9:35:54
Alex_hha
у меня, похоже, что скомпилирован без поддержки plain
не путаем механизмы и методы

http://www.sys-adm.org.ua/mail/postfix-cyrus-sasl2.php

Re: Postfix + sasl

Добавлено: 2008-10-02 21:57:47
wnd
Alex_hha писал(а):не путаем механизмы и методы
http://www.sys-adm.org.ua/mail/postfix-cyrus-sasl2.php
спасибо, почитаем, хотя оно мне и не надо :drinks:

Re: Postfix + sasl

Добавлено: 2008-10-03 10:54:59
orpheus
http://www.sys-adm.org.ua/mail/postfix-cyrus-sasl2.php[/quote]

Читал не один раз. Но там такой проблемы не возникает.

Re: Postfix + sasl

Добавлено: 2008-10-05 9:14:58
wnd
orpheus писал(а):Читал не один раз. Но там такой проблемы не возникает.
см.

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

http://forum.lissyara.su/viewtopic.php?f=3&t=11422&p=103315#p103236

Re: Postfix + sasl

Добавлено: 2008-10-06 14:17:43
Alex_hha
покажи

# postconf -A

?

Re: Postfix + sasl

Добавлено: 2008-10-06 17:24:24
helloworld

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

# postconf -A
cyrus
# postconf -a
cyrus
dovecot



Re: Postfix + sasl

Добавлено: 2008-10-06 23:30:19
Alex_hha
postfix случайно не в chroot запускается?

Re: Postfix + sasl

Добавлено: 2008-10-07 5:51:08
helloworld
Нет, postfix поставлен из портов.

Re: Postfix + sasl

Добавлено: 2008-10-07 14:20:41
Alex_hha

Re: Postfix + sasl

Добавлено: 2010-05-27 13:32:00
Neteru
Я решил такую же проблему:

dovecot.conf

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

. . 
. . .
client {
      # The client socket is generally safe to export to everyone. Typical use
      # is to export it to your SMTP server so it can do SMTP AUTH lookups
      # using it.
      path = /var/spool/postfix/private/auth      <---------------- ВОТ ЭТО
      mode = 0660
      user = postfix
      group = postfix
    }
  }
}

main.cf

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

. .
. . .
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth