Возникла необходимость настроить аутентификацию SMTP в AD, т.к. почтовик в конторе на Exchange. Плюс к этому надо проксировать imaps, т.е. "выставить" imaps в мир.Значит AUTH Postfix, используя Dovecot SASL, я настроил. Dovecot производит аутентификацию методом Authentication binds (как описано в Wiki).
Ниже привожу основную часть конфига dovecot.conf
protocols = imapsprotocol imap {
#listen = *:10143
ssl_listen = external_ip:993
}auth default {
mechanisms = plain login
passdb passwd-file {
args = /usr/local/etc/dovecot-imap-proxy
}passdb ldap {
args = /usr/local/etc/dovecot-ldap.conf
}
userdb static {
args = uid=0 gid=0
}socket listen {
client {
path = /var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
}Если вместо protocols = imaps прописать protocols = none, т.е использовать только Dovecot SASL, то SMTP AUTH работает отлично. Но с imaps работать не хочет. Я так понимаю надо создать 2 типа auth, один будет использоваться для SMTP AUTH, другой - для imaps. Но как это сделать? Вобщем прошу помощи.
dovecot -n, пжалста. Попробуем помозговать тогда
>dovecot -n, пжалста. Попробуем помозговать тогдаДа, конечно.
# dovecot -n|cat
# 1.2.4: /usr/local/etc/dovecot.conf
# OS: FreeBSD 7.2-RELEASE-p2 i386
protocols: none
ssl_listen: external_ip:993
ssl_cipher_list: ALL:!LOW:!SSLv2
login_dir: /var/run/dovecot/login
login_executable: /usr/local/libexec/dovecot/imap-login
verbose_proctitle: yes
first_valid_uid: 1000
first_valid_gid: 1000
mail_privileged_group: mail
imap_client_workarounds: delay-newmail netscape-eoh tb-extra-mailbox-sep
lda:
postmaster_address: postmaster@example.com
sendmail_path: /usr/sbin/sendmail
auth default:
mechanisms: plain login
username_format: %Lu
debug: yes
passdb:
driver: ldap
args: /usr/local/etc/dovecot-ldap.conf
userdb:
driver: passwd
args: blocking=yes
userdb:
driver: static
args: uid=0 gid=0 home=/dev/null
socket:
type: listen
client:
path: /var/spool/postfix/private/auth
mode: 432
user: postfix
group: postfixПолазив в Инете, видел похожие проблемы. Народ рекомендует использовать один auth default и несколько баз с указанием пути к конфигу с использованием переменной %Ls. Но у меня так и не получилось.
Сорри там опечатка вышла.
protocols: imaps
>
> Сорри там опечатка вышла.
> protocols: imaps
>
>
>что-то я сертификата не вижу.
что в /var/log/maillog какает ?
Вобщем, заработало немножко:-).# dovecot -n
# 1.2.4: /usr/local/etc/dovecot.conf
# OS: FreeBSD 7.2-RELEASE-p2 i386
protocols: imaps
ssl_listen: external_ip:993
ssl_cipher_list: ALL:!LOW:!SSLv2
login_dir: /var/run/dovecot/login
login_executable: /usr/local/libexec/dovecot/imap-login
verbose_proctitle: yes
first_valid_uid: 1000
first_valid_gid: 1000
mail_privileged_group: mail
imap_client_workarounds: delay-newmail netscape-eoh tb-extra-mailbox-sep
lda:
postmaster_address: postmaster@example.com
sendmail_path: /usr/sbin/sendmail
auth default:
mechanisms: plain login
username_format: %Lu
debug: yes
passdb:
driver: passwd-file
args: /usr/local/etc/dovecot-%Ls.conf
passdb:
driver: ldap
args: /usr/local/etc/dovecot-ldap.conf
userdb:
driver: passwd
args: blocking=yes
socket:
type: listen
client:
path: /var/spool/postfix/private/auth
mode: 432
user: postfix
group: postfixНе знаю почему не выдает сертификаты, но я их сгенерировал (с помощью mkcert.sh) и в конфиге dovecot.conf прописал.
cat /usr/local/etc/dovecot-%Ls.conf
user1@example.com:{PLAIN}BigSecret:0:0::::proxy host=10.0.10.3 port=143
где 10.0.10.3 - адрес корпоративного Ексченджя.
В /usr/local/etc/dovecot-ldap.conf раскомментировал только
auth_bind=yes
auth_bind_userdn = cn=%n, ou=CIT, dc=example, dc=com
ldap_version = 3
base = dc=example, dc=com
Вот в таком виде работает, но теперь проблема. КАК заставить это работать без дополнительной записи логин\пароль в passwd-file???Да, и еще, спасибо за то что откликнулись :-).
Что-то мне подсказывает, что лдап тут не работает. Мне что-то подсказывает, что userdb в данном случае работает при помощи имапа эксчейнджа.Для эктив дайректори нужно лдап на порт 3268 биндить.
http://wiki.dovecot.org/AuthDatabase/LDAP/AuthBinds вот тут, кстати, чуть другой темплейт. ldapsearch уже заставили выбирать из активдайректори?
>Что-то мне подсказывает, что лдап тут не работает. Мне что-то подсказывает, что
>userdb в данном случае работает при помощи имапа эксчейнджа.
>
>Для эктив дайректори нужно лдап на порт 3268 биндить.
>
>http://wiki.dovecot.org/AuthDatabase/LDAP/AuthBinds вот тут, кстати, чуть другой темплейт. ldapsearch уже заставили выбирать из
>активдайректори?Сорри, я пропустил главные строчки в dovecot-ldap.conf
hosts = 10.0.29.2:389 10.0.29.3:389На самом деле лдап работает, потому как если закоментировать dovecot-imap.conf, то аутентификация SMTP проходит успешно.
Проблему вижу в следующем.
Вот здесь написано http://wiki.dovecot.org/PasswordDatabase/ExtraFields/Proxy
Password forwardingMake sure that the authentication succeeds with any given password. You can do this by using empty passwords. v1.1+ requires also that you return nopassword field.
Ну я взял и прописал в файле dovecot-imap.conf следующее
%u:{PLAIN}:0:0::::proxy host=10.0.10.3 port=143
Ниже приведу лог, с включенный auth debug
Oct 2 09:20:11 relay dovecot: auth(default): new auth connection: pid=60178
Oct 2 09:20:44 relay dovecot: auth(default): new auth connection: pid=60182
Oct 2 09:20:45 relay dovecot: auth(default): client in: AUTH 1 PLAIN service=imap secured lip=external_ip rip=199.0.149.3 lport=993 rport=27958 resp=<hidden>
Oct 2 09:20:45 relay dovecot: auth(default): passwd-file /usr/local/etc/dovecot-imap.conf: Read 1 users
Oct 2 09:20:45 relay dovecot: auth(default): passwd-file(user1@example.com,199.0.149.3): lookup: user=user1@example.com file=/usr/local/etc/dovecot-imap.conf
Oct 2 09:20:45 relay dovecot: auth(default): passwd-file(user1@example.com,199.0.149.3): unknown user
Oct 2 09:20:45 relay dovecot: auth(default): ldap_bind
Oct 2 09:20:45 relay dovecot: auth(default): ldap_simple_bind
Oct 2 09:20:45 relay dovecot: auth(default): ldap_sasl_bind
Oct 2 09:20:45 relay dovecot: auth(default): ldap_send_initial_request
Oct 2 09:20:45 relay dovecot: auth(default): ldap_send_server_request
Oct 2 09:20:45 relay dovecot: auth(default): ldap_result ld 0x185290c0 msgid -1
Oct 2 09:20:45 relay dovecot: auth(default): ldap_chkResponseList ld 0x185290c0 msgid -1 all 1
Oct 2 09:20:45 relay dovecot: auth(default): ldap_chkResponseList returns ld 0x185290c0 NULL
Oct 2 09:20:45 relay dovecot: auth(default): wait4msg ld 0x185290c0 msgid -1 (timeout 0 usec)
Oct 2 09:20:45 relay dovecot: auth(default): wait4msg continue ld 0x185290c0 msgid -1 all 1
Oct 2 09:20:45 relay dovecot: auth(default): ** ld 0x185290c0 Connections:
Oct 2 09:20:45 relay dovecot: auth(default): * host: 10.0.29.2 port: 389 (default)
Oct 2 09:20:45 relay dovecot: auth(default): refcnt: 2 status: Connected
Oct 2 09:20:45 relay dovecot: auth(default): last used: Fri Oct 2 09:20:45 2009
Oct 2 09:20:45 relay dovecot: auth(default):
Oct 2 09:20:45 relay dovecot: auth(default): ** ld 0x185290c0 Outstanding Requests:
Oct 2 09:20:45 relay dovecot: auth(default): * msgid 2, origid 2, status InProgress
Oct 2 09:20:45 relay dovecot: auth(default): outstanding referrals 0, parent count 0
Oct 2 09:20:45 relay dovecot: auth(default): ** ld 0x185290c0 Response Queue:
Oct 2 09:20:45 relay dovecot: auth(default): Empty
Oct 2 09:20:45 relay dovecot: auth(default): ldap_chkResponseList ld 0x185290c0 msgid -1 all 1
Oct 2 09:20:45 relay dovecot: auth(default): ldap_chkResponseList returns ld 0x185290c0 NULL
Oct 2 09:20:45 relay dovecot: auth(default): ldap_int_select
Oct 2 09:20:45 relay dovecot: auth(default): read1msg: ld 0x185290c0 msgid -1 all 1
Oct 2 09:20:45 relay dovecot: auth(default): read1msg: ld 0x185290c0 msgid 2 message type bind
Oct 2 09:20:45 relay dovecot: auth(default): ldap_chase_referrals
Oct 2 09:20:45 relay dovecot: auth(default): read1msg: V2 referral chased, mark request completed, id = 2
Oct 2 09:20:45 relay dovecot: auth(default): new result: res_errno: 49, res_error: <80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 525, vece>, res_matched: <>
Oct 2 09:20:45 relay dovecot: auth(default): read1msg: ld 0x185290c0 0 new referrals
Oct 2 09:20:45 relay dovecot: auth(default): read1msg: mark request completed, ld 0x185290c0 msgid 2
Oct 2 09:20:45 relay dovecot: auth(default): request done: ld 0x185290c0 msgid 2
Oct 2 09:20:45 relay dovecot: auth(default): res_errno: 49, res_error: <80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 525, vece>, res_matched: <>
Oct 2 09:20:45 relay dovecot: auth(default): ldap_free_request (origid 2, msgid 2)
Oct 2 09:20:45 relay dovecot: auth(default): ldap_free_connection 0 1
Oct 2 09:20:45 relay dovecot: auth(default): ldap_free_connection: refcnt 1
Oct 2 09:20:45 relay dovecot: auth(default): ldap_parse_result
Oct 2 09:20:45 relay dovecot: auth(default): ldap_parse_result
Oct 2 09:20:45 relay dovecot: auth(default): ldap(user1@example.com,199.0.149.3): invalid credentials
Oct 2 09:20:45 relay dovecot: auth(default): ldap_msgfree
Oct 2 09:20:45 relay dovecot: auth(default): ldap_result ld 0x185290c0 msgid -1
Oct 2 09:20:45 relay dovecot: auth(default): ldap_chkResponseList ld 0x185290c0 msgid -1 all 1
Oct 2 09:20:45 relay dovecot: auth(default): ldap_chkResponseList returns ld 0x185290c0 NULL
Oct 2 09:20:45 relay dovecot: auth(default): wait4msg ld 0x185290c0 msgid -1 (timeout 0 usec)
Oct 2 09:20:45 relay dovecot: auth(default): wait4msg continue ld 0x185290c0 msgid -1 all 1
Oct 2 09:20:45 relay dovecot: auth(default): ** ld 0x185290c0 Connections:
Oct 2 09:20:45 relay dovecot: auth(default): * host: 10.0.29.2 port: 389 (default)
Oct 2 09:20:45 relay dovecot: auth(default): refcnt: 1 status: Connected
Oct 2 09:20:45 relay dovecot: auth(default): last used: Fri Oct 2 09:20:45 2009
Oct 2 09:20:45 relay dovecot: auth(default):
Oct 2 09:20:45 relay dovecot: auth(default): ** ld 0x185290c0 Outstanding Requests:
Oct 2 09:20:45 relay dovecot: auth(default): Empty
Oct 2 09:20:45 relay dovecot: auth(default): ** ld 0x185290c0 Response Queue:
Oct 2 09:20:45 relay dovecot: auth(default): Empty
Oct 2 09:20:45 relay dovecot: auth(default): ldap_chkResponseList ld 0x185290c0 msgid -1 all 1
Oct 2 09:20:45 relay dovecot: auth(default): ldap_chkResponseList returns ld 0x185290c0 NULL
Oct 2 09:20:45 relay dovecot: auth(default): ldap_int_select
Oct 2 09:20:47 relay dovecot: auth(default): client out: FAIL 1 user=user1@example.com
КАкие предложения?