Managing domains automatically

uk_user

Active Member
Nov 26, 2019
16
4
43
Hi all,

We will be accepting email for around 80k domains. We are putting together custom scripts to manage the relay domains and transports via the API so that only new/changed/deleted domains generate a call to the API which works fine for us. The issue that we have is that the initial input of all domains takes 2-3 hours when done via our scripts that interact with the PMG API.

I notice that relay domains are shown in /etc/pmg/domains and transports in /etc/pmg/transport. Is there any issue with manipulating these files directly instead of using the API as this will be much quicker for our scripts to do? I realise that "pmgconfig sync -restart" will need running each time.

Thanks.
 
Last edited:
Currently /etc/pmg/transport and /etc/pmg/domains are the authoritative source of the information in the API - so it should work fine to just edit those files.
This might change in the future (for all readers who read this later) - so check the changelogs/release notes for versions after 9.0

You'd need to run `postmap` on both files after changing them - otherwise postfix will not see the new information.

I hope this helps!
 
Does "postmap" need running in addition?
from a quick look in the code and a quick check on a testsystem - no
(the part rewriting the postfix config templates calls postmap for all needed files)