- Created by Documentation, last modified on Oct 05, 2018
disable_authentication_provider
disable_failing_authentication_providers
enable_authentication_provider
get_available_authentication_providers
get_provider_client_configurations
get_provider_configuration_fields
get_provider_display_configurations
get_users_authn_linked_accounts
set_provider_client_configurations
set_provider_display_configurations
twofactorauth_generate_tfa_config
twofactorauth_get_user_configs
cpgreylist_is_server_netblock_trusted
cpgreylist_list_entries_for_common_mail_provider
cpgreylist_load_common_mail_providers_config
cpgreylist_save_common_mail_providers_config
cpgreylist_trust_entries_for_common_mail_provider
cpgreylist_untrust_entries_for_common_mail_provider
create_cpgreylist_trusted_host
delete_cpgreylist_trusted_host
Description
This function copies a ModSecurity™ rule with a new rule ID.
Important:
WebServer
role, the system disables this function. For more information, read our How to Use Server Profiles documentation.Examples
https://hostname.example.com:2087/cpsess##########/json-api/modsec_clone_rule?api.version=1&config=modsec2.user.conf&id=123456789
https://hostname.example.com:2087/cpsess##########/xml-api/modsec_clone_rule?api.version=1&config=modsec2.user.conf&id=123456789
whmapi1 modsec_clone_rule config=modsec2.user.conf id=123456789
Notes:
- 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
{ "data": { "rule": { "disabled": 0, "vendor_id": "", "vendor_active": "1", "rule": "SecRule REQUEST_URI "/rejected.php" "deny,auditlog,msg:'Rejected request',id:'1'"n", "config_active": "1", "staged": 0, "id": "1", "config": "modsec2.user.conf", "meta_msg": "Rejected request" } }, "metadata": { "version": 1, "reason": "OK", "result": 1, "command": "modsec_clone_rule" } }
<result> <data> <rule> <config>modsec2.user.conf</config> <config_active>1</config_active> <disabled>0</disabled> <id>1</id> <meta_msg>Rejected request</meta_msg> <rule>SecRule REQUEST_URI "/rejected.php" "deny,auditlog,msg:'Rejected request',id:'1'"</rule> <staged>0</staged> <vendor_active>1</vendor_active> <vendor_id /> </rule> </data> <metadata> <command>modsec_clone_rule</command> <reason>OK</reason> <result>1</result> <version>1</version> </metadata> </result>
Note:
Parameters
Parameter | Type | Description | Possible values | Example |
---|---|---|---|---|
config | string | Required The rule's ModSecurity configuration file. | A valid ModSecurity configuration file. |
|
| string | Required The existing rule's ID. | A valid ModSecurity rule ID. | 123456789 |
Returns
Return | Type | Description | Possible values | Example |
---|---|---|---|---|
rule | hash | A hash of information about the cloned rule. | This hash contains the disabled , vendor_id , vendor_active , rule , config_active , staged , id , config , and meta_msg returns. | |
| Boolean | Whether the rule is disabled. The function returns this value in the |
| 0 |
| string | The vendor's unique short name. The function returns this value in the Note: Any rule that does not belong to a vendor rule set will not return a value. | A valid string. | YourVendor |
| Boolean | Whether the vendor is active. The function returns this value in the |
| 0 |
| string | The rule's text. The function returns this value in the | The text of the new rule that includes the new rule ID. | Click to view... SecRule REQUEST_URI "/rejected.php" "deny,auditlog,msg:'Rejected request',id:'1'" |
| Boolean | Whether the configuration file is active. The function returns this value in the |
|
|
| Boolean | Whether the rule is staged. The function returns this value in the |
|
|
| integer | The rule's ID number. The function returns this value in the | A positive integer. | 123456789 |
| string | The rule's configuration file. The function returns this value in the | A valid ModSecurity configuration file. |
|
| string | The rule's description. The function returns this value in the | A valid string. |
|
Function information
API Version:
Available in:
WHM 11.48+
Methods:
GET, POST
Required Parameters:
config
, id
Return Formats:
About WHM API 1
WHM API 1 performs functions and accesses data in WHM.
Notes:
- Some functions and parameters may require that you authenticate as the
root
user. - You must use the appropriate WHM ports (
2086
or2087
) to call WHM API functions.
Find a function
Related functions
-
Page:WHM API 1 Sections - ModSecurity — ModSecurity functions allow you to manage ModSecurity rules and vendors on your server.
-
Page:WHM API 1 Functions - modsec_add_rule — This function adds a new rule to a ModSecurity™ configuration staging file.
-
Page:WHM API 1 Functions - modsec_assemble_config_text — This function adds text to a ModSecurity™ configuration file.
-
Page:WHM API 1 Functions - modsec_add_vendor — This function adds a new ModSecurity™ vendor rule set to the server.
-
Page:WHM API 1 Functions - modsec_clone_rule — This function copies a ModSecurity™ rule with a new rule ID.