/security/modsec
0.2.30Unchanged since publicationChange the server's ModSecurity mode or who manages it
securityallProvide mode, managed, or both. The API returns 400 if neither field is supplied or either value is invalid. The API also accepts 1 and 0 for managed, meaning true and false respectively. While the administrator manages ModSecurity, UrbeStack saves the mode for use when it takes over.
When UrbeStack manages ModSecurity, it includes OWASP CRS if the server or any domain uses logging or blocking, unless another rule set uses overlapping rule numbers. When a change affects Apache's configuration, UrbeStack tests it and reloads Apache immediately. If Apache rejects the configuration, UrbeStack restores the previous configuration, discards the change, and returns Apache's error.
The response includes the same status information as GET /security/modsec and a set object with the results of the changes.
As a command
Run as root on the serverRequest body
JSON· 2 fieldsmanagedbooleanmodestring, one of off, logging, blockingExample
See the API overview for how to set $API and $TOKEN.curl -sS -X PATCH "$API/security/modsec" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"managed": true,
"mode": "off"
}'200 OK{
"by_hand": {
"directive": "text",
"file": "urbestack-panel-20260909T101500Z.json.enc",
"line": 1,
"mode": "text"
},
"decided": true,
"disabled_rules": {
"by_administrators": 1,
"by_owners": 1,
"domains": 1,
"gone": 1,
"server": 1,
"total": 1
},
"domains": {
"customized": 1,
"in_force": {
"blocking": 1,
"logging": 1,
"off": 1
},
"lowered": 1,
"own_mode": 1,
"total": 1
},
"files": {
"loader": "text",
"ours": "text",
"ours_written_at": "text",
"packaged": "text",
"yours": "text"
},
"installed": true,
"limits": {
"request": 1,
"request_without_files": 1
},
"loaded": true,
"managed": true,
"mode": "off",
"mode_set": {
"at": "text",
"by": "text"
},
"module": {
"file": "urbestack-panel-20260909T101500Z.json.enc",
"package": "basic",
"version": "0.0.1"
},
"other_rule_set": {
"file": "urbestack-panel-20260909T101500Z.json.enc"
},
"own_rules": {
"enabled": 1,
"file": "urbestack-panel-20260909T101500Z.json.enc",
"total": 1
},
"packaged_active": true,
"rule_set": {
"included": true,
"name": "alice",
"version": "0.0.1"
},
"set": {},
"state": "managed",
"wordpress_exclusions": {
"version": "0.0.1"
}
}Errors
33 errors, each a status and a sentence400'<zone>' is not a zone this machine knows: timedatectl list-timezones names them400--managed is true or false400A ModSecurity mode is off, logging or blocking400A new job is queued or running400Domain name required400Domain name too long400Invalid IPv4 address400Invalid IPv6 address400Invalid boolean400Invalid domain name400Invalid port400Invalid setting key400Job parameters must be an object400Nothing to set: give --mode, --managed or both400Nothing to set: give mode, managed or both400PHP <version> cannot be the default: it is hidden from new choices on this server400PHP <version> cannot be the default: it is not installed on this server400Unknown job type400Unknown setting '<key>'400jobs.keep_days (<keep>) may not be smaller than jobs.show_days (<show>): a job cannot be shown longer than it is kept; 0 keeps them for good400managed is true or false401Authentication required404Setting '<key>' not found409<key> cannot take that value: <SECOND>{<k>}{on} <sp> (<k>). <SECOND>{<k>}{move}, or choose another409<key> cannot take that value: the panel listens on port <port> (panel.port). Move the panel first, or choose another409<s.subject> cannot take port <port>: 409<s.subject> cannot take port <port>: <why>409<s.subject> cannot take port <port>: it is the panel's port (panel.port)409A change is already armed for revert (409Sharing is required with this license.409The panel cannot take port <port>: 409The panel cannot take port <port>: <why>409These are the nameservers of a distribution network with several nodes, and every node lists the same ones. To remove a nameserver or move it to another node, use the actions beside its name on DNS zones › Nameservers & addresses, or urbestack-dns-nameserverurbestack.com/docs/api/patch-security-modsec/