Short answer: DirectAdmin CustomBuild rewrites /etc/dovecot/dovecot.conf, /etc/dovecot/conf/*.conf, /etc/exim.conf and /etc/exim.variables.conf from its templates, so direct edits there are lost on the next rebuild. Put Dovecot settings in your own file in /etc/dovecot/conf.d/, or a custom template under custombuild/custom/dovecot/2.4/conf/ (the folder must match the Dovecot version), and put Exim variables in /etc/exim.variables.conf.custom, then run da build exim_conf. (Reviewed October 2026.)
A raised connection limit or a tightened setting that silently disappears after an update is a classic DirectAdmin CustomBuild surprise. We edited each config file directly and through every supported custom location on a DirectAdmin 1.712 test server, ran the config rebuilds and the full Dovecot and Exim rebuilds, and recorded what survived.
Table of Contents
Which DirectAdmin CustomBuild commands rewrite the files
| Command | What it rewrites | Time on our 1-core server |
|---|---|---|
da build dovecot_conf | dovecot.conf and /etc/dovecot/conf/*.conf from the templates, then restarts Dovecot | 6.7 seconds |
da build exim_conf | exim.conf and exim.variables.conf, then restarts Exim | 0.3 seconds |
da build dovecot | compiles Dovecot from source, then writes the configs as above | 10 minutes 4 seconds |
da build exim | rebuilds Exim, then writes the configs as above | 39.6 seconds |
The same rewrites happen when CustomBuild updates Dovecot or Exim on its own, for example from its daily cron when automatic updates are on (da build options shows the cron and updates settings). So a change that survives a manual da build dovecot_conf today also has to survive an update next month. DirectAdmin describes the custom folders in its CustomBuild customisation docs.
Dovecot: what survived and what did not
| Where the change was made | After dovecot_conf / full dovecot rebuild |
|---|---|
Edited /etc/dovecot/dovecot.conf | Lost |
Edited /etc/dovecot/conf/limits.conf (or any file in /etc/dovecot/conf/) | Lost |
Own file /etc/dovecot/conf.d/99-local.conf | Kept |
Template in custombuild/custom/dovecot/2.4/conf/ | Kept, applied on every rebuild |
Template in custombuild/custom/dovecot/conf/ | Ignored on Dovecot 2.4 |
Template in custombuild/custom/dovecot/2.3/conf/ | Ignored on Dovecot 2.4 |
Option 1: your own file in conf.d
DirectAdmin’s dovecot.conf ends with !include conf.d/*.conf, so a .conf file you add there is read last, and a plain setting in it replaces the same setting made earlier at the same level. This is the simplest choice for settings that DirectAdmin does not manage. The block runs in a subshell that stops at the first failed command: if the file exists, it is copied to a new, uniquely named file in /root/ and checked before anything is edited; the line is added only once; and Dovecot is reloaded only if the whole configuration is valid:
( set -eu # stop at the first error: no backup, no edit
F=/etc/dovecot/conf.d/99-local.conf
if [ -f "$F" ]; then
B=$(mktemp /root/99-local.conf.bak-XXXXXX); cp -a "$F" "$B"; cmp -s "$F" "$B"
echo "Backup: $B"
fi
touch "$F"
grep -q '^auth_failure_delay' "$F" || echo 'auth_failure_delay = 3 secs' >> "$F"
if doveconf -n > /dev/null; then systemctl reload dovecot
else echo "Config error: Dovecot not reloaded" >&2; exit 1; fi
doveconf -h auth_failure_delay
)
If the configuration has an error, doveconf names the file and line and exits with an error code, so the reload does not run; on our server a misspelt setting gave Unknown setting and exit code 89. Fix the line, or put the copy back from the Backup: path the block printed and run doveconf -n && systemctl reload dovecot. We tested the block on 19 October 2026 with no file, with an existing file (one backup, the line not added twice), with a backup that could not be written (stopped before the edit) and with a misspelt setting (not reloaded). Settings inside a block such as protocol imap { } or remote 127.0.0.1 { } are more specific and still apply to those connections, wherever they sit in the files; check the value for a given context with doveconf -f. On our server doveconf -h mail_max_userip_connections gave 40, while doveconf -f remote=127.0.0.1 -h mail_max_userip_connections gave 150.
Option 2: replace one of DirectAdmin’s template files
For a setting that already lives in one of DirectAdmin’s files, copy that file into the custom folder for your Dovecot version, edit the copy, and rebuild. Check the version first with dovecot --version; on DirectAdmin 1.712 that is 2.4.
mkdir -p /usr/local/directadmin/custombuild/custom/dovecot/2.4/conf
cp /etc/dovecot/conf/mail_max_userip_connections.conf \
/usr/local/directadmin/custombuild/custom/dovecot/2.4/conf/
# edit the copy, for example:
# mail_max_userip_connections = 40
da build dovecot_conf
doveconf -n | grep mail_max_userip_connections
Upgrade trap: templates in custom/dovecot/conf/ or custom/dovecot/2.3/conf/ were not applied on Dovecot 2.4. A server that was customised under Dovecot 2.3 loses those changes, without any warning, when CustomBuild moves it to 2.4. After a Dovecot upgrade, move your files to the 2.4 folder and check that the syntax is still valid for 2.4, then run doveconf -n. Login problems after that upgrade are covered in Dovecot 2.4 mail login failed.
Exim: what survived and what did not
| Where the change was made | After exim_conf / full exim rebuild |
|---|---|
Edited /etc/exim.conf | Lost |
Edited /etc/exim.variables.conf | Lost |
/etc/exim.variables.conf.custom | Kept, merged into exim.variables.conf on every rebuild |
Whole template custombuild/custom/exim/exim.conf | Kept, but replaces DirectAdmin’s template entirely |
For variables such as connection limits, use the .custom file. It is not read live: Exim only sees it after a rebuild merges it in. Before our rebuild, exim -bP smtp_accept_max still showed the old value of 100.
grep -q '^smtp_accept_max=' /etc/exim.variables.conf.custom 2>/dev/null \
|| echo 'smtp_accept_max=200' >> /etc/exim.variables.conf.custom
da build exim_conf
exim -bP smtp_accept_max # smtp_accept_max = 200
A full copy of exim.conf in custombuild/custom/exim/ works, but it freezes your Exim configuration: when DirectAdmin ships a fixed or improved template (for example after an Exim security release), your server keeps the old one. Use it only when the variables and the files Exim already includes cannot do the job, and compare it with the new template after every update.
Check your server for edits that will be lost
Before the next update, look for changes made directly in the managed files: keep a copy of the current config, rebuild at a quiet time, and compare:
mkdir -p /root/mailconf-before
cp -a /etc/dovecot /etc/exim.conf /etc/exim.variables.conf /root/mailconf-before/
da build dovecot_conf && da build exim_conf
diff -r /root/mailconf-before/dovecot /etc/dovecot
diff /root/mailconf-before/exim.conf /etc/exim.conf
diff /root/mailconf-before/exim.variables.conf /etc/exim.variables.conf
Treat each difference as something to review, not to restore automatically: it can be a hand edit the rebuild removed, but also a change from a newer DirectAdmin template or a value DirectAdmin generates. Keep only the settings you made on purpose, move those to conf.d, a 2.4 template or exim.variables.conf.custom, rebuild again, and confirm with doveconf -n and exim -bP. Mail is restarted twice during this, so pick a quiet hour.
How we tested
- Server: DirectAdmin 1.712 on AlmaLinux 9.8 (1 vCPU, 4 GB RAM), Dovecot 2.4.5, Exim 4.100.1, CustomBuild 2.0, 19 October 2026.
- Changes:
default_process_limitin conf/limits.conf,mail_max_userip_connectionsvia templates in three custom folders,auth_failure_delayin conf.d,smtp_accept_maxin exim.variables.conf and in the .custom file, and a full custom exim.conf. - Rebuilds:
da build dovecot_conf,da build exim_conf, then the fullda build dovecotandda build exim. Values checked withdoveconf -n,exim -bPand file checksums; Dovecot and Exim were running after each step. - Not tested: Dovecot 2.3 servers, the Exim SpamBlocker include files, and CustomBuild’s automatic update run itself (it uses the same rebuild commands).
FAQ
Why did my Dovecot setting disappear after a DirectAdmin update?
CustomBuild regenerates dovecot.conf and the files in /etc/dovecot/conf/ from templates on every Dovecot update or config rebuild. Put the setting in /etc/dovecot/conf.d/99-local.conf or in a template under custombuild/custom/dovecot/2.4/conf/.
Where do I put custom Exim settings on DirectAdmin?
Variables go in /etc/exim.variables.conf.custom, followed by da build exim_conf. A complete custombuild/custom/exim/exim.conf also survives, but it stops DirectAdmin template updates from reaching your server.
Is exim.variables.conf.custom read when Exim restarts?
No. It is merged into exim.variables.conf only when CustomBuild writes the config, so run da build exim_conf after editing it.
My custom Dovecot templates stopped working after the 2.4 upgrade. Why?
CustomBuild only reads templates from the folder for the installed major version, custom/dovecot/2.4/conf/. Files in custom/dovecot/conf/ or 2.3/conf/ were ignored on our 2.4 server.
At a glance

