56 Comments

  1. Admin

    I would like to personally thank you for your outstanding walk-through! After 4 days of parsing manuals and visiting both the dovecot and postfix sites, I stumbled across your information. Thank you for the very detailed, yet simple, outline — it worked great for my topology! I now own a permanent bookmark to this site!

    šŸ˜‰ Cheers

  2. digital_shaman

    * SQL and LDAP: user_global_uid and user_global_gid fields have
    been removed from their config files. Instead you can now use mail_uid
    and mail_gid settings in dovecot.conf.

  3. broy

    hi..is there any set-up guide on how to install LDAP server? coz’ in your installation guide somehow the active LDAP is out of your scope..i hope you gonna post also the steps of configuring LDAP server…MANY THANKS!

    hope you’ll have time for this…

    and most of all thank you very much! for this great and useful tutorial..

    • Mohammad Al-Shami

      Thanks for the comment. I’ve never personally installed an OpenLDAP server before, but it shouldn’t be that hard. As for Active Directory I’ve done it a few times (never for production though) and it’s not that hard, you can check here

      Have a good one

  4. broy

    wow! your such a nice person with a great personality..
    I’m glad that as soon as possible you replied with my request…

    sorry for the time…I’m just a newbie in freeBSD mail server set-up and with the help of your walkthrough,
    I’m not getting lost with the installation but,anyways, thanks!..i hope your always approachable with the people who needs you help…again MANY THANKS!

    by the way..where can i find the LDAP server set-up in the site you provided..:) sorry I’m just messed up…:)

    • Mohammad Al-Shami

      Active directory runs on an LDAP backend, so you just need to install Active Directory and you’ll be ready. Check here for detailed instructions on how to install it on Windows Server 2003.

      As for OpenLDAP, I’ve never installed it myself, Google is your best option. Good luck :)

  5. vgumus

    hi,
    I’ve configured the system according to the documents, but the speech was a problem

    dovecot-ldap.conf
    hosts = 192.168.2.100
    dn = cn=administrator, cn=Users, dc=4gbilisim, dc=local
    dnpass = 1234567
    auth_bind = yes
    ldap_version = 3
    base = dc=4gbilisim, dc=local
    user_attrs = sAMAccountName=home
    user_filter = (&(ObjectClass=person)(sAMAccountName=%u))
    pass_filter = (&(ObjectClass=person)(sAMAccountName=%u))

    ldapvirtual.cf
    server_host = 192.168.2.100
    search_base = dc=4gbilisim, dc=local
    bind = yes
    bind_dn = CN=Administrator,CN=Users,DC=4gbilisim,DC=local
    bind_pw = 1234567
    version = 3
    query_filter = (mail=%s)
    result_attribute = sAMAccountName
    result_format = %s/
    special_result_attribute = member

    maillog
    May 19 10:11:18 mailsrv01 postfix/smtpd[1210]: 1001120DBB: client=localhost[127.0.0.1]
    May 19 10:11:24 mailsrv01 postfix/cleanup[1228]: 1001120DBB: message-id=
    May 19 10:11:24 mailsrv01 postfix/qmgr[1207]: 1001120DBB: from=, size=371, nrcpt=1 (queue active)
    May 19 10:11:26 mailsrv01 postfix/pipe[1229]: 1001120DBB: to=, relay=dovecot, delay=19, delays=17/0.22/0/1.9, dsn=5.1.1, status=bounced (user unknown)
    May 19 10:11:26 mailsrv01 postfix/cleanup[1228]: E204920DBD: message-id=
    May 19 10:11:26 mailsrv01 postfix/qmgr[1207]: E204920DBD: from=, size=2165, nrcpt=1 (queue active)
    May 19 10:11:26 mailsrv01 postfix/bounce[1231]: 1001120DBB: sender non-delivery notification: E204920DBD
    May 19 10:11:26 mailsrv01 postfix/qmgr[1207]: 1001120DBB: removed
    May 19 10:11:29 mailsrv01 postfix/pipe[1229]: E204920DBD: to=, relay=dovecot, delay=2.1, delays=0.03/0.03/0/2, dsn=5.1.1, status=bounced (user unknown)

    postmap -q [email protected] ldap:/usr/local/etc/postfix/ldapvirtual.cf
    Veysi.Gumus/

  6. vgumus

    Test 1 OK

    telnet localhost 25
    Trying 127.0.0.1…
    Connected to localhost.
    Escape character is ‘^]’.
    220 mailsrv01.4gbilisim.local ESMTP Postfix
    ehlo -l
    250-mailsrv01.4gbilisim.local
    250-PIPELINING
    250-SIZE 10240000
    250-VRFY
    250-ETRN
    250-AUTH PLAIN LOGIN
    250-AUTH=PLAIN LOGIN
    250-ENHANCEDSTATUSCODES
    250-8BITMIME
    250 DSN
    mail from: veysi.gumus
    250 2.1.0 Ok
    rcpt to: recep.ayaz
    250 2.1.5 Ok
    data
    354 End data with .
    deneme
    .
    250 2.0.0 Ok: queued as DCCED20DBB

    Test 2 Error

    telnet localhost 25
    Trying 127.0.0.1…
    Connected to localhost.
    Escape character is ‘^]’.
    220 mailsrv01.4gbilisim.local ESMTP Postfix
    ehlo -l
    250-mailsrv01.4gbilisim.local
    250-PIPELINING
    250-SIZE 10240000
    250-VRFY
    250-ETRN
    250-AUTH PLAIN LOGIN
    250-AUTH=PLAIN LOGIN
    250-ENHANCEDSTATUSCODES
    250-8BITMIME
    250 DSN
    mail from: [email protected]
    250 2.1.0 Ok
    rcpt to: [email protected]
    550 5.1.1 : Recipient address rejected: User unknown in virtual mailbox table

    dovecot-ldap.conf
    hosts = 192.168.2.100
    dn = cn=administrator, cn=users, dc=4gbilisim, dc=local
    dnpass = 1234567
    auth_bind = yes
    ldap_version = 3
    base = dc=4gbilisim, dc=local
    user_attrs = sAMAccountName=home
    user_filter = (&(ObjectClass=person)(sAMAccountName=%u))
    pass_filter = (&(ObjectClass=person)(sAMAccountName=%u))

    ldapvirtual.cf
    server_host = 192.168.2.100
    search_base = dc=4gbilisim, dc=local
    bind = yes
    bind_dn = CN=Administrator,CN=Users,DC=4gbilisim,DC=local
    bind_pw = 1234567
    version = 3
    query_filter = (sAMAccountName=%u)
    result_attribute = sAMAccountName
    result_format = %s/

    postmap -q veysi.gumus ldap:/usr/local/etc/postfix/ldapvirtual.cf
    Veysi.Gumus/

  7. Mohammad Al-Shami

    Sorry for the delay, I’ve been very busy and haven’t had the chance to reply.

    Did you make sure you put the correct lines in master.cf?

    Also I’m going to need the output of postconf -n on your sever

  8. vgumus

    Hi,

    postconf -n

    alias_database = hash:/etc/postfix/aliases
    alias_maps = hash:/etc/postfix/aliases
    broken_sasl_auth_clients = yes
    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
    disable_vrfy_command = yes
    header_checks = regexp:/etc/postfix/header_checks
    html_directory = no
    inet_interfaces = all
    mail_owner = postfix
    mailq_path = /usr/local/bin/mailq
    manpage_directory = /usr/local/man
    mime_header_checks = regexp:/etc/postfix/mime_header_checks
    mydestination = $myhostname localhost.$mydomain localhost
    mydomain = 4gbilisim.com
    myhostname = mailsrv01.4gbilisim.local
    mynetworks = 127.0.0.0/8, 192.168.2.0/24
    mynetworks_style = host
    myorigin = $mydomain
    newaliases_path = /usr/local/bin/newaliases
    notify_classes = protocol, resource, software
    queue_directory = /var/spool/postfix
    readme_directory = no
    sample_directory = /usr/local/etc/postfix
    sendmail_path = /usr/local/sbin/sendmail
    setgid_group = maildrop
    smtpd_banner = $myhostname ESMTP
    smtpd_helo_required = yes
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_path = /var/run/dovecot/auth-client
    smtpd_sasl_type = dovecot
    unknown_local_recipient_reject_code = 550
    virtual_gid_maps = static:1002
    virtual_mailbox_base = /var/vmail
    virtual_mailbox_domains = $mydomain
    virtual_mailbox_maps = proxy:ldap:/usr/local/etc/postfix/ldapvirtual.cf
    virtual_transport = dovecot
    virtual_uid_maps = static:1002

  9. vgumus

    dovecot -n
    # 1.1.11: /usr/local/etc/dovecot.conf
    # OS: FreeBSD 7.2-RELEASE i386 ufs
    protocols: imap pop3
    ssl_disable: yes
    disable_plaintext_auth: no
    login_dir: /var/run/dovecot/login
    login_executable(default): /usr/local/libexec/dovecot/imap-login
    login_executable(imap): /usr/local/libexec/dovecot/imap-login
    login_executable(pop3): /usr/local/libexec/dovecot/pop3-login
    login_greeting_capability(default): yes
    login_greeting_capability(imap): yes
    login_greeting_capability(pop3): no
    valid_chroot_dirs: /var/vmail
    verbose_proctitle: yes
    first_valid_uid: 1002
    last_valid_uid: 1002
    first_valid_gid: 1002
    last_valid_gid: 1002
    mail_privileged_group: mail
    mail_uid: vmail
    mail_gid: vmail
    mail_location: maildir:/var/vmail/%n
    mail_executable(default): /usr/local/libexec/dovecot/imap
    mail_executable(imap): /usr/local/libexec/dovecot/imap
    mail_executable(pop3): /usr/local/libexec/dovecot/pop3
    mail_plugin_dir(default): /usr/local/lib/dovecot/imap
    mail_plugin_dir(imap): /usr/local/lib/dovecot/imap
    mail_plugin_dir(pop3): /usr/local/lib/dovecot/pop3
    imap_client_workarounds(default): delay-newmail netscape-eoh tb-extra-mailbox-sep
    imap_client_workarounds(imap): delay-newmail netscape-eoh tb-extra-mailbox-sep
    imap_client_workarounds(pop3):
    pop3_client_workarounds(default):
    pop3_client_workarounds(imap):
    pop3_client_workarounds(pop3): outlook-no-nuls oe-ns-eoh
    auth default:
    mechanisms: plain login
    username_format: %Lu
    debug: yes
    passdb:
    driver: ldap
    args: /usr/local/etc/dovecot-ldap.conf
    userdb:
    driver: ldap
    args: /usr/local/etc/dovecot-ldap.conf
    socket:
    type: listen
    client:
    path: /var/run/dovecot/auth-client
    mode: 432
    user: postfix
    group: postfix
    master:
    path: /var/run/dovecot/auth-master
    mode: 384
    user: vmail
    group: vmail

  10. vgumus

    master.cf

    dovecot unix – n n – – pipe
    flags=DRhu user=vmail:vmail argv=/usr/local/libexec/dovecot/deliver -d ${user}

  11. vgumus

    hi,

    test ok

    telnet localhost 25
    Trying 127.0.0.1…
    Connected to localhost.
    Escape character is ‘^]’.
    220 mailsrv01.4gbilisim.local ESMTP
    ehlo -l
    250-mailsrv01.4gbilisim.local
    250-PIPELINING
    250-SIZE 10240000
    250-ETRN
    250-AUTH PLAIN LOGIN
    250-AUTH=PLAIN LOGIN
    250-ENHANCEDSTATUSCODES
    250-8BITMIME
    250 DSN
    mail from: veysi.gumus
    250 2.1.0 Ok
    rcpt to: recep.ayaz
    250 2.1.5 Ok
    data
    354 End data with .
    deneme
    .
    250 2.0.0 Ok: queued as A2CAD20DC1

    maill log

    May 23 16:57:19 mailsrv01 dovecot: auth(default): new auth connection: pid=1483
    May 23 16:57:19 mailsrv01 postfix/smtpd[1483]: connect from localhost[127.0.0.1]
    May 23 16:57:40 mailsrv01 postfix/smtpd[1483]: A2CAD20DC1: client=localhost[127.0.0.1]
    May 23 16:57:46 mailsrv01 postfix/cleanup[1486]: A2CAD20DC1: message-id=
    May 23 16:57:46 mailsrv01 postfix/qmgr[1398]: A2CAD20DC1: from=, size=354, nrcpt=1 (queue active)
    May 23 16:57:47 mailsrv01 dovecot: auth(default): master in: USER 1 recep.ayaz service=deliver
    May 23 16:57:47 mailsrv01 dovecot: auth(default): ldap(recep.ayaz): user search: base=dc=4gbilisim, dc=local scope=subtree filter=(&(ObjectClass=person)(sAMAccountName=recep.ayaz)) fields=sAMAccountName
    May 23 16:57:49 mailsrv01 dovecot: auth(default): ldap(recep.ayaz): result: sAMAccountName(home)=recep.ayaz
    May 23 16:57:49 mailsrv01 dovecot: auth(default): master out: USER 1 recep.ayaz home=recep.ayaz
    May 23 16:57:49 mailsrv01 deliver(recep.ayaz): msgid=: saved mail to INBOX
    May 23 16:57:49 mailsrv01 postfix/pipe[1487]: A2CAD20DC1: to=, orig_to=, relay=dovecot, delay=20, delays=17/0.16/0/2.2, dsn=2.0.0, status=sent (delivered via dovecot service)
    May 23 16:57:49 mailsrv01 postfix/qmgr[1398]: A2CAD20DC1: removed

    test error

    telnet localhost 25
    Trying 127.0.0.1…
    Connected to localhost.
    Escape character is ‘^]’.
    220 mailsrv01.4gbilisim.local ESMTP
    ehlo -l
    250-mailsrv01.4gbilisim.local
    250-PIPELINING
    250-SIZE 10240000
    250-ETRN
    250-AUTH PLAIN LOGIN
    250-AUTH=PLAIN LOGIN
    250-ENHANCEDSTATUSCODES
    250-8BITMIME
    250 DSN
    mail from: [email protected]
    250 2.1.0 Ok
    rcpt to: [email protected]
    550 5.1.1 : Recipient address rejected: User unknown in virtual mailbox table

  12. qzvt

    what wrong the error when start dovecot

    Warning: Last died with error (see error log for more information): Auth process died too early – shutting down
    Info: If you have trouble with authentication failures,
    enable auth_debug setting. See http://wiki.dovecot.org/WhyDoesItNotWork

    im set ssl_disable = yes
    help!…

  13. m0ps

    hi! i configured internal mail server with your how-to, but i’m faced with such trouble:
    i cant send mail to root/postmaster and other aliases, that defined in /etc/aliases. in logs:

    Jun 30 11:44:15 mail postfix/pipe[48486]: A2F0610E447: to=, relay=dovecot, delay=0.12, delays=0.11/0/0/0.01, dsn=5.1.1, status=bounced (user unknown)
    Jun 30 11:44:15 mail postfix/qmgr[52868]: C025210E449: removed

    the impression that postfix does not check for aliases in /etc/aliases and immediately tries to deliver a letter to the user postmaster (which of course is not in the ad)

    #postconf -n | grep ^alias
    alias_database = hash:/etc/aliases
    alias_maps = hash:/etc/aliases

    /etc/aliases.db created

    request assistance in resolving problem…
    P.S. sorry for my english…

    • Mohammad Al-Shami

      Hi and sorry for the late reply. Either try adding a postmaster account on Active Directory or using virtual_alias_maps.

  14. qzvt

    hi guy, i make config ssl_disable=no and make cert and key, in the end i run
    start dovecot but i got the message below.

    dovecot: Jul 02 20:14:16 Error: auth(default): LDAP: binding failed (dn CN=administrator,OU=Users,DC=example,DC=com): Invalid credentials

    question:
    how i know dovecot connect to active directory service work or not.
    Thank guy.

  15. john

    hello..

    [root@mail1 ~]# cp dovecot-example.conf dovecot.conf
    cp: dovecot-example.conf: No such file or directory

    please help me where can i find the dovecot-example.conf? Do i have to make it myself or can i find it inside dovecot?

  16. Mohammad Al-Shami

    Sorry guys, I haven’t checked my blog in ages

    Active Directory uses LDAP, so you need to use that.

    You won’t find virtual_transport=dovecot and dovecot_destination_recipient_limit=1 in the configuration file. Add them

    Hope that helps

  17. jo

    thanks man…about the test username and pasword mshami qazxsw…

    * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
    a LOGIN mshami qazxsw
    a NO [UNAVAILABLE] Temporary authentication failure.

  18. jo

    Trying 127.0.0.1…
    Connected to localhost.
    Escape character is ‘^]’.
    220 mailhost ESMTP Postfix
    ehlo localhost
    250-mailhost
    250-PIPELINING
    250-SIZE 10240000
    250-VRFY
    250-ETRN
    250-ENHANCEDSTATUSCODES
    250-8BITMIME
    250 DSN
    AUTH PLAIN
    503 5.5.1 Error: authentication not enabled

    why is it?can you help me man??

  19. brent

    We need a non-privileged user in Active Directory to allow the other programs to authenticate, I’m calling it LDAP, and the password will be qwerty
    Test username will be mshami and password will be qazxsw
    Domain name is shami.local
    Base DN is DC=shami,DC=local
    IP addresses for our domain controllers are 192.168.192.210 and 192.168.192.211

    hi…im just novice in AD,
    just want to ask if test username and password is something made by on our own? or do we have to set-up in AD? and second, is it always two ip address to used? is that the IP address of our win2k3 AD server?

    thanks!
    hope you reply….

  20. jo

    helo sir,..where did u get mshami and qazxsw?
    Trying 127.0.0.1…
    Connected to localhost.
    Escape character is ā€˜^]’.
    220 mailhost ESMTP Postfix
    ehlo localhost
    250-mailhost
    250-PIPELINING
    250-SIZE 10240000
    250-VRFY
    250-ETRN
    250-ENHANCEDSTATUSCODES
    250-8BITMIME
    250 DSN
    AUTH PLAIN
    503 5.5.1 Error: authentication not enabled

  21. jo

    hello! Al-Shami
    i found some errors on the authentication scheme
    but i can’t figured out how to solve this problem.
    hope you could help me….
    what seems to be the problem?
    —————————————–

    [root@mail1 ~]# telnet localhost 143
    Trying 127.0.0.1…
    Connected to localhost.
    Escape character is ‘^]’.
    * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
    a LOGIN juan qwerty
    a NO [UNAVAILABLE] Temporary authentication failure.
    ——————————————-

    I already created a non-previlege user but still
    I can’t authenticate and bind to active directory…
    is there something wrong with my configuration files?
    Thanks!…

  22. goerge

    Hello again,..thanks for reply…and about the non-privileged user-LDAP User and the password,qwerty, is this an active directory user also, and do i have to specify OU?Hoping for your favorable response..

    • Mohammad Al-Shami

      Hey there,

      Postfix uses the non-privileged account to do lookups. Place it anywhere in Active Directory, it should work even inside an OU

  23. brent

    hi..Al-Shami..

    what is this shami.net?
    is this a freebsd host?

    coz’ i can’t deliver emails to localhost
    with postfix!

    it says: No Route to Host

    -my dovecot is running
    -in my mail log status=deferred

    what seems to be the problem?

    hope you reply!
    Thanks!

  24. Mohammad Al-Shami

    Hi Brent,

    shami.net is the email domain you want to host. Check your logs and documentation for details on how you can solve this problem

  25. Hi,

    windows 2008 server and dovecot working due to the underlying cause is available in the following error.

    Nov 7 11:13:43 mailsrv dovecot: auth(default): new auth connection: pid=35475
    Nov 7 11:13:52 mailsrv dovecot: auth(default): client in: AUTH 1 PLAIN service=imap secured lip=127.0.0.1 rip=127.0.0.1 lport=143 rport=51726 resp=AG1ha3N1ADY1NDMyMQ==
    Nov 7 11:13:52 mailsrv dovecot: auth(default): ldap(maksu,127.0.0.1): bind search: base=dc=gbb, dc=local filter=(&(ObjectClass=person)(sAMAccountName=maksu))
    Nov 7 11:13:52 mailsrv dovecot: auth(default): ldap(maksu,127.0.0.1): no fields returned by the server
    Nov 7 11:13:52 mailsrv dovecot: auth(default): client out: OK 1 user=maksu
    Nov 7 11:13:52 mailsrv dovecot: auth(default): master in: REQUEST 2 35473 1
    Nov 7 11:13:52 mailsrv dovecot: auth(default): ldap(maksu,127.0.0.1): user search: base=dc=gbb, dc=local scope=subtree filter=(&(ObjectClass=person)(sAMAccountName=maksu)) fields=sAMAccountName
    Nov 7 11:13:52 mailsrv dovecot: auth(default): ldap(maksu,127.0.0.1): result: sAMAccountName(home)=maksu
    Nov 7 11:13:52 mailsrv dovecot: auth(default): master out: USER 2 maksu home=maksu
    Nov 7 11:13:52 mailsrv dovecot: dovecot: Relative home directory paths not supported (user maksu): maksu
    Nov 7 11:13:52 mailsrv dovecot: imap-login: Internal login failure (auth failed, 1 attempts): user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured

    • Mohammad Al-Shami

      Sadly I’ve never used Windows 2008, so I’m not sure where to start. The guide is a bit outdated and the new Dovecot configuration is a bit different. I’ll update the guide if I can manage to get some free time and energy to do so.

  26. Rudy

    Hi Al-Shami, your howto is wonderfull ! I configured dovecot/postfix and all go fine! I have only a little problem with dovecot quota, when I want ovverride default quota for some users is impossible change value. I use a Debian Lenny with dovecot release 1.0.15-2.3+lenny1

    dovecot.conf

    userdb prefetch {
    }

    dovecot-ldap.conf

    user_attrs = sAMAccountName=home,phone=quota

    I wrote override value in win2k3 on phone field
    Please help me !

    Ciao from Italy
    Rudy

    p.s sorry for my poor english

    • Mohammad Al-Shami

      Hi Rudy, I’ve done this once but ages ago. I think your configuration is correct but I’m not sure. If I remember correctly the key is the value in the phone field. What are you populating it with?

  27. Ron

    I have recently installed postfix and Dovecot and can telnet to both ports successfully. LDAP authentication has been setup with Active Directory and this works too. Wehn I send a mail to myself from Outlook express, the mail is sent successfully, but I do not receive the mail. The mail log shows
    postfix/virtual[509]: 063BE107AD: to=, relay=virtual, delay=0, status=SOFTBOUNCE (unknown user: “[email protected]”)

    The main.cf, mail log and dovecot logs are pasted below. What does ‘no fields returned” in the dovecot log mean?

    main.cf file
    ————

    soft_bounce = yes
    queue_directory = /var/spool/postfix
    command_directory = /usr/sbin
    daemon_directory = /usr/lib/postfix
    mail_owner = postfix
    sendmail_path = /usr/sbin/sendmail
    newaliases_path = /usr/bin/newaliases
    mailq_path = /usr/bin/mailq
    setgid_group = maildrop
    html_directory = /usr/share/doc/packages/postfix/html
    manpage_directory = /usr/share/man
    sample_directory = /usr/share/doc/packages/postfix/samples
    readme_directory = /usr/share/doc/packages/postfix/README_FILES
    inet_protocols = all
    biff = no
    mail_spool_directory = /var/mail
    canonical_maps = hash:/etc/postfix/canonical
    virtual_alias_maps = hash:/etc/postfix/virtual
    virtual_alias_domains = hash:/etc/postfix/virtual
    relocated_maps = hash:/etc/postfix/relocated
    transport_maps = hash:/etc/postfix/transport
    sender_canonical_maps = hash:/etc/postfix/sender_canonical
    masquerade_exceptions = root
    masquerade_classes = envelope_sender, header_sender, header_recipient
    #myhostname = samplel.sample.local
    mydomain=sample.local
    myhostname = samplel.sample.local
    myorigin = $mydomain
    program_directory = /usr/lib/postfix
    inet_interfaces = all
    masquerade_domains =
    mydestination = $myhostname, localhost.$mydomain
    defer_transports =
    mynetworks = 10.0.0.0/8, 127.0.0.0/8, 192.0.0.0/8
    #relay_domains=$mydestination
    disable_dns_lookups = yes
    #relayhost = samplel.sample.local
    mailbox_command =
    mailbox_transport =
    strict_8bitmime = no
    disable_mime_output_conversion = no
    smtpd_sender_restrictions = hash:/etc/postfix/access
    smtpd_client_restrictions =
    smtpd_helo_required = no
    smtpd_helo_restrictions =
    strict_rfc821_envelopes = no
    smtpd_recipient_restrictions = permit_inet_interfaces, permit_mynetworks, reject_unauth_destination
    smtp_sasl_auth_enable = no
    smtpd_sasl_auth_enable = no
    smtpd_use_tls = no
    smtp_use_tls = no
    smtpd_reject_unlisted_recipient = yes
    alias_maps = hash:/etc/aliases
    mailbox_size_limit = 0
    message_size_limit = 10240000
    local_recipient_maps =
    debug_peer_list=sample.local
    debug_peer_level = 5
    virtual_mailbox_base = /var/vmail
    virtual_uid_maps = static:1009
    virtual_gid_maps = static:1003
    virtual_mailbox_domains = sample.local
    #LDAP Stuff
    #virtual_mailbox_maps = ldap:ldapvirtual
    ldapvirtual_server_host = 10.1.2.13
    ldapvirtual_search_base = DC=sample,DC=local
    ldapvirtual_bind = yes
    ldapvirtual_bind_dn = cn=ldapuser,OU=Service Accounts,DC=sample,DC=local
    ldapvirtual_bind_pw = ldappass
    ldapvirtual_query_filter = (sAMAccountName=%u)
    ldapvirtual_result_attribute = sAMAccountName
    ldapvirtual_version = 3
    ldapvirtual_chase_referrals = yes
    ldapvirtual_result_format=%s/

    mail log
    ——-

    Nov 25 14:40:52 samplel postfix/smtpd[502]: running: PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin? xxgdb /usr/lib/postfix/smtpd 502 & sleep 5
    Nov 25 14:40:57 samplel postfix/smtpd[502]: connect from unknown[10.7.3.11]
    Nov 25 14:40:57 samplel postfix/smtpd[502]: DB1A2107AB: client=unknown[10.7.3.11]
    Nov 25 14:40:58 samplel postfix/smtpd[502]: 063BE107AD: client=unknown[10.7.3.11]
    Nov 25 14:40:58 samplel postfix/cleanup[507]: 063BE107AD: message-id=
    Nov 25 14:40:58 samplel postfix/qmgr[432]: 063BE107AD: from=, size=1444, nrcpt=1 (queue active)
    Nov 25 14:40:58 samplel postfix/virtual[509]: 063BE107AD: to=, relay=virtual, delay=0, status=SOFTBOUNCE (unknown user: “[email protected]”)
    Nov 25 14:40:58 samplel postfix/smtpd[502]: disconnect from unknown[10.7.3.11]

    dovecot log
    ———–

    Nov 25 14:40:58 auth(default): Info: new auth connection: pid=511
    Nov 25 14:41:58 auth(default): Info: client in: AUTH 1 PLAIN service=imap lip=10.63.1.202 rip=10.7.3.11 lport=143 rport=4275 resp=
    Nov 25 14:41:58 auth(default): Info: ldap(tsd001,10.7.3.11): bind search: base=DC=sample,DC=local filter=(&(ObjectClass=*)(sAMAccountName=tsd001))
    Nov 25 14:41:58 auth(default): Info: ldap(tsd001,10.7.3.11): no fields returned by the server
    Nov 25 14:41:58 auth(default): Info: client out: OK 1 user=tsd001
    Nov 25 14:41:58 auth(default): Info: master in: REQUEST 213 511 1
    Nov 25 14:41:58 auth(default): Info: ldap(tsd001,10.7.3.11): user search: base=DC=sample,DC=local scope=subtree filter=(&(ObjectClass=*)(sAMAccountName=tsd001)) fields=homeDirectory,uidNumber,gidNumber
    Nov 25 14:41:58 auth(default): Info: ldap(tsd001,10.7.3.11): no fields returned by the server
    Nov 25 14:41:58 auth(default): Info: master out: USER 213 tsd001
    Nov 25 14:41:58 imap-login: Info: Login: user=, method=PLAIN, rip=10.7.3.11, lip=10.63.1.202
    Nov 25 14:41:58 IMAP(tsd001): Info: Disconnected in IDLE bytes=183/600
    Nov 25 14:41:58 auth(default): Info: client in: AUTH 1 PLAIN service=imap lip=10.63.1.202 rip=10.7.3.11 lport=143 rport=4276 resp=
    Nov 25 14:41:58 auth(default): Info: ldap(tsd001,10.7.3.11): bind search: base=DC=sample,DC=local filter=(&(ObjectClass=*)(sAMAccountName=tsd001))
    Nov 25 14:41:58 auth(default): Info: ldap(tsd001,10.7.3.11): no fields returned by the server
    Nov 25 14:41:58 auth(default): Info: client out: OK 1 user=tsd001
    Nov 25 14:41:58 auth(default): Info: master in: REQUEST 214 500 1
    Nov 25 14:41:58 auth(default): Info: ldap(tsd001,10.7.3.11): user search: base=DC=sample,DC=local scope=subtree filter=(&(ObjectClass=*)(sAMAccountName=tsd001)) fields=homeDirectory,uidNumber,gidNumber
    Nov 25 14:41:58 auth(default): Info: ldap(tsd001,10.7.3.11): no fields returned by the server
    Nov 25 14:41:58 auth(default): Info: master out: USER 214 tsd001
    Nov 25 14:41:58 imap-login: Info: Login: user=, method=PLAIN, rip=10.7.3.11, lip=10.63.1.202
    Nov 25 14:41:58 IMAP(tsd001): Info: Disconnected in IDLE bytes=259/1394
    Nov 25 14:41:58 auth(default): Info: new auth connection: pid=516
    Nov 25 14:41:58 auth(default): Info: new auth connection: pid=517

    • Mohammad Al-Shami

      Hey there, and sorry for the late reply.

      Since Dovecot is authenticating properly your problem is in Postfix. Your “virtual_mailbox_maps” seems to be commented out, so Postfix isn’t reading the maps from AD. Seems you skipped something in the HOWTO

  28. Nimnod

    Great walkthrough, though I do still miss one thing:
    if I set reject_sender_login_mismatch in smtpd_sender_restrictions section I cannot send anything, because: “: Sender address rejected: not owned by user fbar;”.
    The fbar user does have email attr set properly in Active Directory. Can you give me a hint on this one?

    • Mohammad Al-Shami

      Hi,

      Enable debugging and check the logs. That way you will be able to figure out where the error is an fix it. Good luck

  29. Gomes

    I have some e-mails which are aliases to other real e-mail, for example: some e-mail to [email protected] goes to [email protected], [email protected] and [email protected]; do you know how resolve that?? I’m using your how to.

    Thanks.

    • Mohammad Al-Shami

      Hi there,

      In order to add aliases you can use virtual_alias_maps in postfix, you have to do this manually though. Hope that helps. Good luck :)

  30. sendmail

    i would like you to help me in configuring backup mail server for our corporate “sendmail” mail server . i know that we can give an additional entry in dns with different preference value , thus the secondary mail server will accept the mail and try to route it once the primary server is up. There are lots of docs in the net for that . But what i want to concentrate is the availabilityredundency of the queue directory ,ie mail-box directory can be shared by both primary and secondary mail server , so if the primary goes down users can send and receive through the secondary server . When i googled i found NFS solutions but many are warning about the locking problem , Please advise.Also what are the options available for taking the backup of all incoming and outgoing mails in send mail server.
    We have 3 active directory domains so user details for authentication should be taken from these 3 domain servers not from /etc /passwd. Thanks in advance.

    • Mohammad Al-Shami

      Hello.

      I’m sorry but I haven’t had time in the past few months to check on my blog. You know, life and work.

      If you are still interested we can chat about putting together a solution for you. Let me know if you are

Leave a Reply

Your email address will not be published. Required fields are marked *