Security 6 min read

What Is the Best Web Application Firewall for DirectAdmin?

DirectAdmin already ships the engine for a web application firewall. Whether that is enough depends on your web server, your rule set and how many customers share the box.

By BashPilot Team
BashEdge WAF & DDoS protection Stop Layer 7 floods and malicious requests before they reach the app. Explore BashEdge

The best web application firewall for DirectAdmin is the one that protects every user and domain on the server without making you the person who explains to customers why their checkout returns 403. DirectAdmin gives you a solid starting point, ModSecurity installed through CustomBuild, so the real question is what you add around it and how you roll it out.

What DirectAdmin already gives you

ModSecurity is the engine, and a rule set is the policy that tells it what to look for. On DirectAdmin both come from CustomBuild. Pick a rule set, build the module, and rewrite the web server configuration.

enable ModSecurity with the OWASP rule set
da build set modsecurity yes
da build set modsecurity_ruleset owasp
da build modsecurity
da build rewrite_confs

Swap owasp for comodo to use the Comodo rules instead. If you run nginx rather than Apache, check that your chosen rule set supports the ModSecurity version your build uses before you commit. Community reports have been mixed on Comodo with nginx over the years, and the OWASP Core Rule Set is the more common choice there.

WhereWhat it controls
Admin: Server Manager > ModSecurityTurn the engine off server-wide or disable specific rules for everyone
User: Advanced Features > Web Application FirewallTurn the engine off for a domain or disable individual rules for it
/usr/local/directadmin/data/admin/modsecurity_rulesGlobal list of disabled rules
/usr/local/directadmin/data/users/USER/domains/DOMAIN.modsecurity_rulesPer-domain disabled rules
/var/log/httpd/modsec_audit.log or /var/log/nginx/modsec_audit.logAudit log, by web server

Five questions that separate a good DirectAdmin WAF from noise

  1. 1

    Does it understand users and domains?

    On a shared DirectAdmin box the first question after any block is which customer it affected. A firewall that reports only an IP and a URL makes you map that to a user by hand every time.

  2. 2

    Can you watch before you block?

    Rolling out a rule set in blocking mode on a live server is how you learn which plugins your customers use. You want a mode that records what would happen without changing traffic.

  3. 3

    Can you scope an exception?

    When one form trips one rule, the fix should be that rule for that path, not the rule for every site. DirectAdmin's per-domain disable list helps, and a path-scoped exclusion is narrower still.

  4. 4

    Does it see floods, not just payloads?

    SQL injection in a parameter is one request. A Layer 7 flood is thousands of harmless-looking requests. Signature rules handle the first well and the second poorly, so check what covers rate and repetition.

  5. 5

    Will you read its logs?

    An audit log nobody opens protects nobody. Check how a block is explained: the rule, the matched input, the domain, and what you can do about it.

Roll out rules without breaking customer sites

With raw ModSecurity the safe pattern is to set SecRuleEngine DetectionOnly for a few days, read the audit log for the requests your customers really send, add exclusions for the false positives, and then switch to On. DirectAdmin's documentation suggests putting your own settings in a file CustomBuild does not overwrite, such as /etc/httpd/conf/extra/httpd-includes.conf for Apache, or in the custom copy of the ModSecurity configuration under /usr/local/directadmin/custombuild/custom/.

watch what the rules would do, per domain
grep -o '\[id "[0-9]*"\]' /var/log/httpd/modsec_audit.log | sort | uniq -c | sort -rn | head -20
grep -h 'ModSecurity' /var/log/httpd/domains/*.error.log | tail -50

The first command ranks rules by how often they fire, which is usually a short list. The second shows recent hits in the per-domain error logs. When a single rule dominates and the matched data looks like normal content, that rule needs an exception. For the step-by-step version of that fix, see ModSecurity 403 on cPanel? Fix the False Positive Safely. The ModSecurity directives are the same on DirectAdmin, only the menus differ.

Where BashEdge fits on DirectAdmin

ModSecurity with a good rule set is a sound foundation, and many servers should start there. What it does not give you is one view that ties request rules to request rates, firewall policy and login abuse. BashEdge for DirectAdmin protects every reseller, user and domain with a WAF, Layer 7 DDoS protection, firewall controls and login defence. It installs with one command and begins in monitor mode, so you review the effect of each rule on real traffic before enforcing it. Each action is tied to the rule, the reason, the source and the targeted host, and you choose per rule whether to monitor, challenge or block.

If the problem you are actually facing is a flood rather than an exploit, read DirectAdmin Server Under DDoS: Find the Target and Block It and WAF vs Firewall: Which One Stops Layer 7 DDoS Attacks? before choosing a tool.

The practical decision

  • A few sites you control. ModSecurity with the OWASP rule set, rolled out in detection mode first, is often enough.
  • Many customers on one server. Add tooling that reports by user and domain, and decide your policy on user-level disabling up front.
  • Recurring floods or login attacks. Signature rules are not the main defence. Look for rate-aware protection and per-service thresholds.
  • Any of the above. Test with real traffic before you block, and keep a written record of every exception.
Share LinkedIn X
Questions

Frequently asked questions

Does DirectAdmin include a web application firewall?

It includes the ModSecurity engine through CustomBuild, with integrated OWASP and Comodo rule sets. You enable it with `da build set modsecurity yes`, choose a rule set with `da build set modsecurity_ruleset owasp` or `comodo`, then run `da build modsecurity` and rewrite the web server configuration.

Where is the ModSecurity log on DirectAdmin?

DirectAdmin documents the audit log at `/var/log/httpd/modsec_audit.log` for Apache, LiteSpeed and OpenLiteSpeed, and `/var/log/nginx/modsec_audit.log` for nginx. Per-domain error logs under `/var/log/*/domains/*.error.log` also show ModSecurity hits for that domain.

Can DirectAdmin users disable ModSecurity for their site?

Yes. Under Advanced Features, Web Application Firewall, a user can turn the engine off for a domain or disable individual rules. A rule disabled globally by the administrator cannot be re-enabled at user level. Admins can hide the page by adding `modsecurity` to the user's `commands.deny` file.

OWASP or Comodo rules on DirectAdmin?

Both are integrated. The OWASP Core Rule Set is open, widely documented and the more common choice on nginx. Whichever you pick, confirm it supports the ModSecurity version your web server uses, and roll it out in detection-only mode before blocking.

Can ModSecurity stop a DDoS attack on DirectAdmin?

Not reliably on its own. ModSecurity inspects each request for malicious content, while a Layer 7 flood is made of many ordinary-looking requests. Rate limits, connection limits and upstream filtering do that job. A WAF that also tracks request rates covers both.

Put your servers on autopilot.

Connect a server in about a minute. The first week is on us.