Update ModSecurity configuration file

This function sets the contents of a specified ModSecurity™ configuration file. The system stages any changes to the configuration file. To deploy the changes, call WHM API 1's modsec_deploy_rule_changes function.

Important:

When you disable the Web Server role, the system disables this function.

Authorizations:
query Parameters
config
required
string

The configuration file name.

Example: config=modsec2.example.conf
text
required
string

The configuration text.

Example: text=SecRule REQUEST_URI "example" "deny,id:123456789" SecAction "pass,auditlog,id"

Responses

Response Schema: application/json
data
any
object

Request samples

whmapi1 --output=jsonpretty \
  modsec_set_config_text \
  config='modsec2.example.conf' \
  text='SecRule REQUEST_URI "example" "deny,id:123456789" SecAction "pass,auditlog,id"'

Response samples

Content type
application/json
{
  • "data": null,
  • "metadata": {
    • "command": "modsec_set_config_text",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}