Global ModSecurity engine setting reset to Off after every DirectAdmin update — why isn't it preserved?

cautroi

New member
Joined
Dec 3, 2025
Messages
2
Hi,

I'm running DirectAdmin 1.715 (AlmaLinux / CloudLinux, Apache + ModSecurity with OWASP CRS) on three shared-hosting servers, with auto-update enabled in the panel.

I set the global ModSecurity engine to DetectionOnly in `/usr/local/directadmin/data/admin/modsecurity_rules`, and I also created per-domain DetectionOnly files for all domains. The per-domain files survive updates fine. But the global file does not: after every DirectAdmin update / CustomBuild install, it is rewritten to `SecRuleEngine Off`.

I have observed this three times now:

- Server 1: 24 Nov ~21:17 (during the 1.714 → 1.715 update)
- Server 2: 25 Nov 02:34 (same 1.714 → 1.715 update)
- Server 2 again: 26 Nov 06:24:59 (a reinstall of the same 1.715 build)

In each case the evidence lines up exactly: the custombuild.log entry `called: install` matches the global file's mtime to the second, the directadmin binary was replaced in the same minute, and DirectAdmin restarted right after. No one triggered these manually — the panel's auto-update did it.

My questions:

1. Is this intended behavior, or a bug? It seems wrong for an update to silently discard the administrator's setting.
2. Why is the global file rewritten from the default instead of preserving its current value?
3. Is there a supported way to make the global engine setting persistent across updates, other than setting it per-domain?

The practical concern: if an admin sets the global engine to DetectionOnly (or On) and doesn't re-check after every update, the global engine silently stays Off indefinitely — and any vhost relying on the global setting loses all ModSecurity protection/logging without any warning.

For now I have worked around it with per-domain DetectionOnly files on every domain, so my logging continues. But I'd like to understand whether the global reset is by design, and what the supported way to keep a global setting across updates is.

Thanks!
 
The official docs make an important distinction here. DirectAdmin documents the Admin-level global file as its managed configuration, but the documented management interface only supports enabling or disabling the engine. The original CMD_MODSECURITY API likewise lists SecRuleEngine as On or Off; DetectionOnly is not a documented value.

That means your timestamps clearly show the hand-set DetectionOnly value is being replaced, but they do not yet prove that a supported global On setting is also lost. I would do one controlled test: set the global engine to On through Server Manager > ModSecurity, record the file hash, then reinstall the same 1.715 build. If On also becomes Off, this is a clear persistence regression. If On survives, it is more likely unsupported-value normalisation plus a documentation gap.

The relevant file and inheritance behaviour are documented here:

Your per-domain DetectionOnly workaround is sensible meanwhile. I would avoid an automatic post-update rewrite until DirectAdmin confirms the supported global method, because a bad global rule can prevent a clean webserver reload.
 
Back
Top