You can find our user documentation at docs.cpanel.net.

Check out our new API beta site!

Child pages
  • WHM API 1 Functions - modsec_assemble_config_text
Skip to end of metadata
Go to start of metadata

Description

This function adds text to a ModSecurity™ configuration file.

Important:

In cPanel & WHM version 76 and later, when you disable the Web Server role, the system disables this function.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/modsec_assemble_config_text?api.version=1&config=modsec_vendor_configs%2Fexample.conf&text=newtext&init=1&final=1&deploy=1
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/modsec_assemble_config_text?api.version=1&config=modsec_vendor_configs%2Fexample.conf&text=newtext&init=1&final=1&deploy=1
 Command Line
whmapi1 modsec_assemble_config_text config=modsec_vendor_configs%5C%2Fexample.conf text=newtext init=1 final=1 deploy=1


Notes:

  • Unless otherwise noted, you must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
    "data": {},
    "metadata": {
        "version": 1,
        "reason": "OK",
        "result": 1,
        "command": "modsec_assemble_config_text"
    }
}
 Output (XML)
<result>
  <data></data>
  <metadata>
    <command>modsec_assemble_config_text</command>
    <reason>OK</reason>
    <result>1</result>
    <version>1</version>
  </metadata>
</result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
configstring

Required

The ModSecurity™ configuration file's path and name.

A valid path and filename, relative to the /etc/apache2/conf/ directory. modsec_vendor_configs/example.conf
textstring

The text to add to the configuration file.

This parameter defaults to an empty string.

A valid string.newtext
initBoolean

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

This value defaults to 0.

Notes:

  • 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.
  • 1 — Initial upload.
  • 0Not the initial upload.
1
finalBoolean

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

This parameter defaults to 0.

Notes:

  • 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.
  • 1 — Final upload.
  • 0Not the final upload.
1
deployBoolean

Whether to deploy the new text to the system.

This parameter defaults to 0.

  • 1 — Deploy.
  • 0 — Do not deploy.
1

Returns

This function only returns metadata.