Updating Postfix Aliases from Horde

Last week, I setup my own mail server using Postfix, Dovecot, and Horde. The only problem I have with this setup is there’s no way to update Postfix’s aliases directly from Horde. This may not really seem like a problem, however I have several email addresses with new addresses being created all the time for email forwarding, etc., so that I can stop mail from being delivered by removing an email address from the aliases file should I somehow lose control of the original email address. To solve this problem, I wrote a script that would pull all horde identities and email aliases and use those to populate the virtual alias maps file.

Note that this only works properly if your horde login is a user on the underlying system that can receive mail, i.e., you’re somehow authenticating directly to the passwd file or indirectly through Dovecot or another server capable of authenticating with the passwd file, though this can probably be modified as well to use virtual identities if that’s what you’re using.

Anyway, here’s the script: https://gitlab.com/snippets/3341 or https://pastebin.com/fCJv217t

Leave a Reply