I have recently started to deploy a mail server with Postfix and Dovecot on my Ubuntu 18.04. LTS. Unfortunately recieving mails does not work, and I have yet to understand why.
The Setup
Dovecot
In Dovecot, I have enabled IMAPS on port 993, LMTP over 127.0.0.1:24 and SMTP-auth via the unix_listener
. The authentication is against a LDAP-Server, that should also provide all users for my mail server.
The user_filter
in my dovecot-ldap.conf.ext
is set to (&(objectClass=rspfMember)(uid=%Ln))
, as all users with this objectClass should be able to send/recieve mails. The uid
of the LDAP entries equals the local part of the mail address, thus I used %Ln
for the filter.
Postfix
I enabled the following restrictions:
smtpd_recipient_restrictions =
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_sender_domain,
reject_unknown_recipient_domain,
permit_sasl_authenticated,
permit_mynetworks,
reject_unauth_destination,
reject_rbl_client zen.spamhaus.org,
reject_rbl_client ix.dnsbl.manitu.net,
check_policy_service inet:127.0.0.1:10023,
reject_unverified_recipient,
permit
Test Case
First of all, running sudo doveadm user myusername
finds the user I am searching for, and sudo doveadm auth test myusername mypassword
returns auth succeeded
, so I am assuming that my LDAP setup is correct.
Sending mails from the accounts is also possible, so I can login to the account via SMTP with any mail client, and so it succeeds with IMAP.
If I send a mail to one of the users, I can see in the log files that the RBL restrictions as well as postgrey let the mail pass, but after that Postfix is not able to locate the user (or dovecot not able to deliver the mail, i can't really tell):
postfix/smtpd[22142]: maps_find: local_recipient_maps: myuser: not found
postfix/smtpd[22142]: dict_proxy_lookup: table=unix:passwd.byname flags=lock|utf8_request key=@mydomain.com -> status=1 result=
postfix/smtpd[22142]: maps_find: local_recipient_maps: @mydomain.com: not found
postfix/smtpd[22142]: mail_addr_find: myuser@mydomain.com -> (not found)
postfix/smtpd[22142]: NOQUEUE: reject: RCPT from senderdomain.de[185.26.XX.XX]: 550 5.1.1 <myuser@mydomain.com>: Recipient address rejected: User unknown in local recipient table; from=<myuser@senderdomain.de> to=<myuser@mydomain.com> proto=ESMTP helo=<senderdomain.de>
postfix/smtpd[22142]: > senderdomain.de[185.26.XX.XX]: 550 5.1.1 <myuser@mydomain.com>: Recipient address rejected: User unknown in local recipient table
If I run postmap -s btree:/var/lib/postfix/verify_cache
, however, I get the result
_LAST_CACHE_CLEANUP_COMPLETED_ 1552662532
myuser@mydomain.com 0:0:1552662532:250 2.1.5 OK
so I assume the recipient validation works properly. Also, the correct maildir gets created in /srv/vmail/myuser
.
Where can I look for further information why the mail delivery fails?
Thank you very much in advance.
Update
I updated my LDAP configuration for the local_recipient_maps
, the search query is query_filter = (rspfMail=%s)
where rspfMail
is the attribute in which the users mail is stored.
When I test the query with postmap -vq 'myuser@mydomain.com' ldap:/etc/postfix/local_recipient_maps.cf
I get:
postmap: dict_ldap_connect: Successful bind to server ldap://192.168.**.**:389 with dn cn=**,ou=**,dc=**
postmap: dict_ldap_connect: Cached connection handle for LDAP source /etc/postfix/local_recipient_maps.cf
postmap: dict_ldap_lookup: /etc/postfix/local_recipient_maps.cf: Searching with filter (rspfMail=myuser@mydomain.com)
postmap: dict_ldap_get_values[1]: Search found 1 match(es)
postmap: dict_ldap_get_values[1]: Leaving dict_ldap_get_values
postmap: dict_ldap_lookup: Search returned nothing
So the search finds exactly one result, as expected, but returns nothing. I would really appreciate any help.