1

Topic: Ldap Alias Domains

==== ==== Required information ====
- iRedMail version: none
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Linux/BSD distribution name and version: Ubuntu 12.04.1
- Related log if you're reporting an issue:
====


Hey,

i hope someone on this forum can help me with my problem. I'm trying to move my current postfix+dovecot setup from mysql backend to ldap backend. Everything is done on a test system. To administer the ldap server i'm currently using phpldapadmin.
I ported your iredmail.schema and imported it into my ldap server. Furthermore dovecot is already using the ldap backend for imap login and the dovecot lda. Postfix is also using ldap to determine where to deliver the mail. I can send mail to an account on the first domain and an alias for that account as well. Catchall is also working. The only thing i cant get to work are alias domains. When trying to send an email from telnet to the alias domain i get the following reply:

Recipient address rejected: User unknown in virtual mailbox table; from=<dqdq> to=<test@main.epac.to> proto=ESMTP helo=<asd>

So i guess postfix recognizes that the mail server is responsible for the alias domain, but can't find the user. Any help would be highly appriciated as i'm someone who wants to know how it works and can't let it go until i got it how i want ^^.  Here are the postfix files and the current ldif. If you need anymore information i will provide it.


domains.cf

server_host     = 127.0.0.1
server_port     = 389
version         = 3
search_base      = cn=vmail,dc=main,dc=com
scope            = one
query_filter     = (&(objectClass=mailDomain)(|(domainName=%s)(domainAliasName=%s)))
result_attribute = domainName
debuglevel       = 0


mailboxes.cf

server_host     = 127.0.0.1
server_port     = 389
version         = 3
search_base      = cn=vmail,dc=main,dc=com
scope            = sub
query_filter     = (&(objectClass=mailUser)(|(mail=%s)(shadowAddress=%s)))
result_attribute = mailMessageStore
debuglevel       = 0


aliases.cf

server_host     = 127.0.0.1
server_port     = 389
version         = 3
search_base      = cn=vmail,dc=main,dc=com
scope            = sub
query_filter     = (&(objectClass=mailAlias)(|(mail=%s)(shadowAddress=%s)))
result_attribute = mailForwardingAddress
debuglevel       = 0


domain_catchall.cf

server_host     = 127.0.0.1
server_port     = 389
version         = 3
search_base      = cn=vmail,dc=main,dc=com
scope            = sub
query_filter     = (&(objectClass=mailAlias)(mail=@%d))
result_attribute = mailForwardingAddress
debuglevel       = 0


main.cf

# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = _______
myorigin = /etc/mailname
mydestination = ________
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

virtual_mailbox_base = /var/vmail
#virtual_mailbox_limit_override = yes
#virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please try again later.
#virtual_overquota_bounce = yes
virtual_minimum_uid = 150
virtual_uid_maps = static:1003
virtual_gid_maps = static:1003
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
mailbox_command = /usr/lib/dovecot/deliver

virtual_mailbox_domains =
    proxy:ldap:$config_directory/maps/domains.cf
virtual_mailbox_maps =
    proxy:ldap:$config_directory/maps/mailboxes.cf
virtual_alias_maps =
    proxy:ldap:$config_directory/maps/aliases.cf,
    proxy:ldap:$config_directory/maps/domain_catchall.cf


master.cf (dovecot only)

dovecot unix    -       n       n       -       -      pipe
    flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${domain} -m ${extension}


# LDIF Export for cn=vmail,dc=main,dc=com
# Server: My LDAP Server (127.0.0.1)
# Search Scope: sub
# Search Filter: (objectClass=*)
# Total Entries: 4
#
# Generated by phpLDAPadmin (http://phpldapadmin.sourceforge.net) on December 11, 2012 11:27 pm
# Version: 1.2.2

version: 1

# Entry 1: cn=vmail,dc=main,dc=com
dn: cn=vmail,dc=main,dc=com
cn: vmail
objectclass: organizationalRole
objectclass: top

# Entry 2: cn=main.com,cn=vmail,dc=main,dc=com
dn: cn=main.com,cn=vmail,dc=main,dc=com
cn: main.com
domainaliasname: main.epac.to
domainname: main.com
objectclass: mailDomain
objectclass: top

# Entry 3: mail=@main.com,cn=main.com,cn=vmail,dc=main,dc=com
dn: mail=@main.com,cn=main.com,cn=vmail,dc=main,dc=com
mail: @main.com
mailforwardingaddress: test@main.com
objectclass: mailAlias
objectclass: top

# Entry 4: uid=test,cn=main.com,cn=vmail,dc=main,dc=com
dn: uid=test,cn=main.com,cn=vmail,dc=main,dc=com
cn: test
gidnumber: 1003
homedirectory: /var/vmail/main.com/test@main.com
mail: test@main.com
mailmessagestore: main.com/test@main.com
objectclass: account
objectclass: top
objectclass: mailUser
objectclass: posixAccount
shadowaddress: test2@main.com
uid: test
uidnumber: 1003
userpassword: {SHA}----

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Ldap Alias Domains

Dear meld0,

We don't support manual mail server installation, because we don't know your system environment. Please either try iRedMail directly, or try to solve them yourself.

Also, all sample Postfix LDAP query files are available below, it's better to use it directly if you use "iredmail.schema":
https://bitbucket.org/zhb/iredmail/src/ … at=default

Here's shell script used to configure Postfix parameters (and other stuffs):
https://bitbucket.org/zhb/iredmail/src/ … postfix.sh