Re: Qmail-ldap + dovecot

Nickitas <[email protected]> Wed, 31 Aug 2011 13:13:16 +0300
Newsgroups gmane.mail.qmail.ldap
Message-ID <[email protected]>
Thank you Nicolas , I will keep this in mind when I get the time to 
properly test it on a live system .. Thats an issue I would had never 
ever thought off :)


On 08/31/2011 11:00 AM, Nicolas de Bari Embriz Garcia Rojas wrote:
> Hi, I am running dovecot2 under FreeBSD, I had some issues with users
> that create imap mailboxes with dots, at the end I solve this with a
> namespace and plugging listescape, here my final configuration, hoping
> it can help
>
> file /usr/local/etc/dovecot/dovecot.conf
> --
> base_dir = /var/run/dovecot/
>
> first_valid_uid = 200
> last_valid_uid = 200
> first_valid_gid = 200
> last_valid_gid = 200
> mail_uid = 200
> mail_gid = 200
>
> syslog_facility = local1
> log_path = /var/log/maillog
> log_timestamp = %Y-%m-%d %H:%M:%S
> debug_log_path = /var/log/dovecot.debug
> mail_debug = no
> #auth_verbose = yes
> #auth_debug = yes
> #mail_debug = yes
>
> login_greeting = INBOX.IM
>
> mail_location = maildir:~/Maildir
> maildir_very_dirty_syncs = yes
> maildir_copy_with_hardlinks = yes
> maildir_stat_dirs = no
>
> userdb {
>    args = /usr/local/etc/dovecot/dovecot-ldap.conf
>    driver = ldap
> }
>
> passdb {
>    args = /usr/local/etc/dovecot/dovecot-ldap.conf
>    driver = ldap
> }
>
> protocols = imap pop3
>
> service imap-login {
>    service_count = 1
>    chroot = login
>    inet_listener imap {
>      address = *
>      port = 143
>    }
>    inet_listener imaps {
>      address = *
>      port = 993
>      ssl = yes
>    }
> }
>
> service pop3-login {
>    service_count = 1
>    chroot = login
>    inet_listener pop3 {
>      address = *
>      port = 110
>    }
>    inet_listener pop3s {
>      address = *
>      port = 995
>      ssl = yes
>    }
> }
>
> ssl_cert =</usr/local/etc/dovecot/mail_inbox_im.pem
> ssl_key =</usr/local/etc/dovecot/mail_inbox_im.key
>
> disable_plaintext_auth = no
> #auth_verbose = yes
>
> plugin {
>    quota = maildir:User quota
> }
>
> protocol imap {
>    mail_plugins = quota imap_quota listescape
> }
>
> protocol pop3 {
>    mail_plugins = quota
> }
>
> namespace {
>    inbox = yes
>    list = yes
>    prefix =
>    separator = /
>    hidden = no
>    subscriptions = yes
>    type = private
> }
> --
>
> file /usr/local/etc/dovecot/dovecot-ldap.conf
>
> --
> hosts = 192.168.1.2:389
>
> auth_bind = no
> dn = cn=dovecot,dc=inbox,dc=im
> dnpass = xxxxxxx
>
> base = ou=vusers,dc=inbox,dc=im
>
> ldap_version = 3
>
> deref = never
>
> # mailMessageStore = domain/user
> # storate : Quota limit in kilobytes
> # bytes : Quota limit in bytes
> user_attrs = mailMessageStore=home=/home/qmail/maildirs/%$,qmailUID=uid,qmailGID=gid,mailQuotaSize=quota=maildir:bytes
> user_filter = (&(objectClass=qmailUser)(uid=%u)(accountStatus=active))
>
> pass_attrs = mail=user,userPassword=password
> pass_filter = (&(objectClass=qmailUser)(uid=%u))
> --
>
> Now if you want to give an extra to qmail-ldap (nothing related to
> dovecot) but you can help to test, consider also installing this
> patch: (smtpauthuser + SRS)
>
> http://code.google.com/p/qmail-ldap-smtpauthuser/wiki/SETUP?tm=6
>
> regards.
>
>
>
> 2011/8/30 Nickitas<[email protected]>:
>> Hi ,
>>
>>   This configuration seems to work for me .
>>
>>   Thanx a lot :)
>>
>>
>> On 08/26/2011 04:54 PM, [email protected] wrote:
>>> Hi
>>>
>>> here is my working config.
>>> The key part is passdb.
>>>
>>> # 2.0.13: /usr/local/etc/dovecot/dovecot.conf
>>> # OS: Linux 2.6.32-71.el6.x86_64 x86_64 CentOS Linux release 6.0 (Final)
>>> auth_debug = yes
>>> auth_verbose = yes
>>> base_dir = /var/run/dovecot
>>> disable_plaintext_auth = no
>>> first_valid_gid = 500
>>> last_valid_gid = 65000
>>> last_valid_uid = 65000
>>> listen = *
>>> log_path = /var/log/dovecot
>>> mail_debug = yes
>>> mail_location = maildir:~/Maildir
>>> passdb {
>>>     args = /var/qmail/bin/auth_dovecot ./Maildir/
>>>     driver = checkpassword
>>> }
>>> plugin {
>>>     mail_log_events = delete undelete expunge copy mailbox_delete
>>> mailbox_rename
>>>     mail_log_fields = uid box msgid from subject
>>>     mail_log_group_events =
>>>     mechanisms = plain login
>>>     quota = maildir
>>>     quota_rule = *:storage=10240000
>>>     quota_rule2 = Trash:storage=1024000
>>>     quota_rule3 = SPAM:ignore
>>>     trash = /usr/local/etc/dovecot/dovecot-trash.conf
>>> }
>>> protocols = imap pop3
>>> service imap-login {
>>>     inet_listener imaps {
>>>       port = 993
>>>       ssl = yes
>>>     }
>>>     process_min_avail = 1
>>> }
>>> service pop3-login {
>>>     inet_listener pop3s {
>>>       port = 995
>>>       ssl = yes
>>>     }
>>>     process_min_avail = 1
>>> }
>>> ssl_cert =</etc/ssl/certs/mailcertificate.pem
>>> ssl_cipher_list = ALL
>>> ssl_key =</etc/ssl/private/mailcertificate.pem
>>> userdb {
>>>     driver = prefetch
>>> }
>>> verbose_proctitle = yes
>>> verbose_ssl = yes
>>> protocol imap {
>>>     mail_plugins = quota mail_log notify imap_quota
>>>     ssl_cert =</etc/ssl/certs/mailcertificate.pem
>>>     ssl_key =</etc/ssl/private/mailcertificate.pem
>>> }
>>> protocol pop3 {
>>>     mail_plugins = quota mail_log notify
>>>     ssl_cert =</etc/ssl/certs/mailcertificate.pem
>>>     ssl_key =</etc/ssl/private/mailcertificate.pem
>>> }
>>>
>>> -sent via mobile device
>>>
>>> -- orijinal mesaj --
>>> Konu: Re: Qmail-ldap + dovecot
>>> Kimden: Nickitas<[email protected]>
>>> Tarih: 26.08.2011 15:19
>>>
>>> Thank you Russel , I am definitely  gonna try it when I get the chance
>>> cause your setup is almost identical to ours :)
>>>
>>> On 08/26/2011 02:47 PM, Russell Simpkins wrote:
>>>> On 8/26/11 7:12 AM, Nickitas wrote:
>>>>> Thanx all for the answers :)
>>>>>
>>>>>   I added strsalloc.o at both sections in Makefile and it worked ok
>>>>> (for the compilation) . I keep getting an error 111 though using this
>>>>> method (test pop connection) ..
>>>>>
>>>>>   I ve also tried the Felipe's implementation , but I can't pass the
>>>>> authentication , think there is something that has to do with ldap
>>>>> config , will look more in this later ..
>>>>>
>>>>> Thank you again :)
>>>> I too use dovecot for imap and simply configure dovecot to auth
>>>> against the ldap server. I do not use the patch you listed, I use
>>>> stock qmail-1.0.3 with qmail-ldap-1.03-20060201.patch. I use a similar
>>>> method to Felipe, configuring dovecot to auth directly against LDAP
>>>> and configuring qmail to use auth_smtp. If you can login using qmail,
>>>> then there's no reason you shouldn't be able to log in with dovecot,
>>>> it may just be a case of making sure you have the correct password
>>>> scheme configured for dovecot.
>>>>
>>>> ## dovecot.conf
>>>> protocols = imap imaps
>>>> syslog_facility = mail
>>>> ssl_cert_file = /etc/httpd/conf/certs/mail.crt
>>>> ssl_key_file = /etc/httpd/conf/keys/mail.key
>>>> mail_location = maildir:%h
>>>> namespace private {
>>>>    prefix = INBOX.
>>>>    inbox = yes
>>>> }
>>>> mail_debug = yes
>>>> maildir_copy_with_hardlinks = yes
>>>> protocol imap {
>>>> }
>>>> protocol pop3 {
>>>> }
>>>> protocol lda {
>>>>    postmaster_address = [email protected]
>>>> }
>>>> auth_verbose = yes
>>>> auth default {
>>>>    mechanisms = plain
>>>>    passdb ldap {
>>>>      args = /etc/dovecot-ldap.conf
>>>>    }
>>>>    userdb ldap {
>>>>      args = /etc/dovecot-ldap.conf
>>>>    }
>>>> }
>>>> dict {
>>>> }
>>>> plugin {
>>>> }
>>>>
>>>> ## dovecot-ldap conf
>>>>
>>>> hosts =YOUR_LDAP_SERVER_IP:389
>>>> dn=cn=Manager,dc=cttechhosting,dc=net
>>>> auth_bind = yes
>>>> # this should match up to how you did your ldap accounts
>>>> auth_bind_userdn = uid=%u,ou=accounts,dc=cttechhosting,dc=net
>>>> ldap_version=3
>>>> base = ou=accounts,dc=cttechhosting,dc=net
>>>> # tell dovecot what fields to use
>>>> user_attrs =
>>>> mailMessageStore=home,qmailUID=uid,qmailGID=gid,mailMessageStore=mail
>>>> user_filter = (&(objectClass=qmailUser)(uid=%u))
>>>> pass_attrs = mail=user,userPassword=password
>>>> pass_filter = (&(objectClass=qmailUser)(uid=%u))
>>>> default_pass_scheme = LDAP-SHA
>>>>
>>>>
>>>>
>>>
>>>
>>
>