Child pages
  • WHM API 1 Functions - modsec_check_rule

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

This function checks a ModSecurity™ rule's validity.

Multiexcerpt include
SpaceWithExcerptcom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@12665
MultiExcerptNameAPIDisabledWebServerRole
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples 


Panel
bgColor#FFFFFF
borderStylenone


Expand
titleJSON API


Code Block
languagexml
https://hostname.example.com:2087/cpsess##########/json-api/modsec_check_rule?api.version=1&rule=SecAction%20%22pass%2Cid%3A1234567%22



Expand
titleXML API


Code Block
languagexml
https://hostname.example.com:2087/cpsess##########/xml-api/modsec_check_rule?api.version=1&rule=SecAction%20%22pass%2Cid%3A1234567%22



Expand
titleCommand Line


Code Block
languagebash
whmapi1 modsec_check_rule rule=SecAction'"\pass,id:1234567\"'

Include Page
LIB:_WHMAPI1CLINote
LIB:_WHMAPI1CLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{  
   "metadata":{  
      "reason":"OK Invalid Rule",
      "version":1,
      "result":1,
      "command":"modsec_check_rule"
   },
   "data":{  
      "problem":"(XID 2zm4ka) The rule is invalid. Apache returned the following error: AH00526: Syntax error on line 1 of /var/tmp/15500._USR_LOCAL_CPANEL_WHOSTMGR_BIN_XML_API__.gl2t8wZ1.tmp/validate.conf:\nInvalid command 'OWASP', perhaps misspelled or defined by a module not included in the server configuration\n",
      "valid":0
   }
}



Expand
titleOutput (XML)


Code Block
languagetext
linenumberstrue
<result>
  <data>
    <problem>The rule is invalid. Apache returned the following error: AH00526: Syntax error on line 1 of /var/tmp/15500._USR_LOCAL_CPANEL_WHOSTMGR_BIN_XML_API__.gl2t8wZ1.tmp/validate.conf:\nInvalid command 'OWASP', perhaps misspelled or defined by a module not included in the server configuration\n</problem>
	<valid>0</valid>
  </data>
  <metadata>
    <version>1</version>
    <reason>OK invalid rule</reason>
    <result>1</result>
    <command>modsec_check_rule</command>
  </metadata>
</result>


Include Page
LIB:_WHMAPIShellNote
LIB:_WHMAPIShellNote


Parameters

ParameterTypeDescriptionPossible valuesExample
rulestring

Required

The rule to check.

A valid ModSecurity rule.

 


Expand
titleClick to view...
SecAction "pass,id:1234567"


Returns

ReturnTypeDescriptionPossible valuesExample
problemstringA string that describes any errors with the ModSecurity rule.A string value.


Expand
titleClick to view...
The rule is invalid. Apache returned the following error: AH00526: Syntax error on line 1 of /var/tmp/15500._USR_LOCAL_CPANEL_WHOSTMGR_BIN_XML_API__.gl2t8wZ1.tmp/validate.conf:\nInvalid command 'OWASP', perhaps misspelled or defined by a module not included in the server configuration\n


rule

Boolean

Whether the rule is valid.

  • 1 — Valid rule.
  • 0 — Invalid rule.

0