Add ModSecurity configuration file text

This function adds text to a ModSecurity™ configuration file.

Important:

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

SecurityBasicAuth
Request
query Parameters
config
required
string

The ModSecurity™ configuration filename and file path, relative to the /etc/apache2/conf/ directory.

Example: config=modsec_vendor_configs/example.conf
deploy
integer
Default: 0

Whether to deploy the new text to the system.

  • 1 — Deploy.
  • 0 — Do not deploy.
Enum: 1 0
Example: deploy=1
final
integer
Default: 0

Whether to add the text as the final upload to the configuration file.

  • 1 — Final upload.
  • 0Not the final upload.

Note:

  • You must use this parameter if you wish to add the text as the final change to the configuration file.
  • You must use the init parameter with this parameter if you wish to only make one change to the configuration file.
Enum: 1 0
Example: final=1
init
integer
Default: 0

Whether to add the text as the initial upload to the configuration file.

  • 1 — Initial upload.
  • 0Not the initial upload.

Note:

  • You must use this parameter if you wish to add the text as the initial change to the configuration file.
  • You must use the final parameter with this parameter if you wish to only make one change to the configuration file.
Enum: 1 0
Example: init=1
text
string
Default: ""

The text to add to the configuration file.

Example: text=newtext
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
get/modsec_assemble_config_text
Request samples
whmapi1 --output=jsonpretty \
  modsec_assemble_config_text \
  config='modsec_vendor_configs/example.conf'
Response samples
application/json
{
  • "metadata": {
    • "command": "modsec_assemble_config_text",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}