1 (edited by Mars 2024-03-27 21:59:52)

Topic: postfix turns user@my.domain into user@host.my.domain

- iRedMail version: 1.6.8 PGSQL edition
- Deployed with iRedMail Easy or the downloadable installer: yes
- Linux/BSD distribution name and version: Debian GNU/Linux 12 (bookworm)
- Store mail accounts in which backend: PGSQL
- Web server: Nginx
- Manage mail accounts with iRedAdmin-Pro: no

Hello there,

I recently set up iRedMail and linked it to my domain (FreeIPA) via LDAP. So far, everything is working quite well. The only thing that does not work is sending and receiving mails via alias addresses that do not correspond to the user name before the @. To change this, I have tried to add an alias mapping. For this I have:

1. extended the virtual_alias_maps line in /etc/postfix/main.cf:

virtual_alias_maps = proxy:ldap:/etc/postfix/ad_virtual_group_maps.cf, proxy:ldap:/etc/postfix/ad_alias_maps.cf

2. create the file /etc/postfix/ad_alias_maps.cf:

server_host     = ipa-dc.my.domain
server_port     = 389
version         = 3
bind            = yes
start_tls       = yes
bind_dn         = uid=ldap_reader,cn=users,cn=accounts,dc=my,dc=domain
bind_pw         = [ldap_readers pw]
search_base     = cn=users,cn=accounts,dc=my,dc=domain
scope           = sub
query_filter    = (&(mail=%s)(objectClass=person)(memberOf=cn=mail_user_group,cn=groups,cn=accounts,dc=my,dc=domain))
result_attribute= uid
debuglevel      = 0


postmap -q user@my.domain ldap:/etc/postfix/ad_alias_maps.cf

I could make sure that the mapping works the way I want it to. But as soon as I activate this configuration by reloading, the postfix always makes user@my.domain to user@mailserver.my.domain and the mail delivery fails. Without the additional alias mapping, it does not do this and I can send and receive mails to the standard addresses.

Can anyone give me a clue as to why this is happening?

Best regards and nice weekend


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


Re: postfix turns user@my.domain into user@host.my.domain

I'm afraid that you're on your own.

With default iRedMail installation, we know all detailed configurations of each software, but after large modification, especially switched SQL/LDAP backend, we don't know how it works and mostly importantly, we cannot test it with same environment at all.


Re: postfix turns user@my.domain into user@host.my.domain

I made the modifications according to the official instructions (docs.iredmail.org/active.directory.html). For FreeIPA I only had to modify minor things (especially paths). The backend for the e-mail database is still PostgreSQL. Only the backend for the logins has been adapted. I would have thought that this would still be supported here.

4 (edited by luke31 2024-04-02 21:24:45)

Re: postfix turns user@my.domain into user@host.my.domain

Hello Mars

I've recently set up an LDAP Connection for iRedMail.

What's strange to me is that the result_attribute is the uid. Now without researching about it I think that's the username witout @domain.tld attached. If that is the case, Postfix attaches the $myorigin to the username so the sender has a valid email address. Search for Postfix Address Rewriting for the specific info.

lmk if this helps

Regards, Luke