Writing entries into /etc/postfix/virtual


#1

Hi,

we already managed to write entries to /etc/poostfix/transport through the Univention Configuration Registry.

Now we like to add an entry like the following to /etc/postfix/virtual:

user1@domain.de      user1@domain.de,user2@domain.de

When we try to add an entry like

/mail/maps/virtual/1  
user1@domain.de      user1@domain.de,user2@domain.de

it is not accepted.
I also had a look at the scripts in /etc/univention/templates/files/etc/postfix/ to find out, what a valid entry may be, but could find a hint.
Does anyone know how to add valid entries to the virtual file via the web interface?

Thanks for any hints or suggestions,

Stefan


#2

The file /etc/postfix/virtual is not managed by UCR; you can edit its content with any regular editor. You must call sudo postmap /etc/postfix/virtual afterwards to re-generate the database for Postfix.

The file is used as default_virtual_alias_maps, which also uses other databases:

/etc/univention/templates/files/etc/postfix/main.cf.d/30_maps:        default_virtual_alias_maps = 'hash:/etc/postfix/virtual, ldap:/etc/postfix/ldap.groups, ldap:/etc/postfix/ldap.distlist, ldap:/etc/postfix/ldap.virtual, ldap:/etc/postfix/ldap.external_aliases, ldap:/etc/postfix/ldap.sharedfolderremote, ldap:/etc/postfix/ldap.sharedfolderlocal_aliases'

Depending on what you are trying to archive, you can simply register the address user1@domain.de as a secondary email address at the user, e.g.

  1. open the UMC Users module
  2. edit the user user2@domain.de, which should (also) get emails to the first address
  3. go to Advanced SettingMail
  4. Add user1@domain.de to Alternative e-mail address
  5. Save the changes

Those “alternative” email addresses are explicitly not checked for duplicates, which easily allows you to subscribe to other peoples emails.
Read http://docs.software-univention.de/manual-4.2.html#mail::management::users for more details and other options.


#3

Great!
Thank you for the hint/solution!

Stefan


#4

Hi,

we tested it and have to admit, that is does not solve our problem: Your solution will only work, if the the alternative address is within the same domain as the first one. If e.g. we like to send a copy of every email to this account to an GMX account, the web interface refuses to the save the entry because gmx.de is not one of the configured mail domain.

And as far as I understand the documentation, a configured domain will be regarded as a local domain.

Kind regards,

Stefan


#5

Your original request was for

which uses the same domain domain.de everywhere. So you seem to want something like this instead:

user1@domain.deuser1@domain.de, user2@other.domain

which is something completely different.

First of all notice the loop from user1@domain.de to itself: this is a no-no!

Historically you would have used a ~/.forward file to configure the forwarding to an (additional) external address, but with delivery to IMAP that no longer works. (it is implemented by the local delivery agent of Postfix, but the lmtp delivery agent gets used to forward the email to the IMAP server.)
You can use recipient_bcc_maps instead, which should to the trick for you. But currently UCS does not provide a mechanism to set this (or any other used useful setting) - there is Bug #44473 which requests adding a local.conf file, which would allow you to add this.

As an alternative you can use the redirect :copy feature from SIEVE, so Dovecot as you IMAP server will do the forwarding on a user basis. (I did not check this myself if Dovecot implements that :copy extension)


#6

Since UCS 4.2 errata36 you can configure external email aliases for user accounts in the “Advanced Settings” tab → Mail → Mail forwarding.

You can configure multiple addresses to which every email received by the primary email address will be forwarded to. You can choose there if you want to “Redirect all e-mails to forward addresses” or “Keep e-mails and forward a copy”.