Configuring Custom Precise Protection Rules
You can combine common HTTP fields, such as IP, Path, Referer, User Agent, and Params in a protection rule to let WAF allow, block, or only log the requests that match the combined conditions.
A reference table can be added to a precise protection rule. The reference table takes effect for all protected domain names.
Prerequisites
You have added your website to a policy.
Constraints
- It takes several minutes for a new rule to take effect. After the rule takes effect, protection events triggered by the rule will be displayed on the Events page.
- The path content cannot contain the following special characters: (' "<>&*#%\?)
Application Scenarios
Precise protection rules are used for anti-leeching and website management background protection.
Procedure
- Log in to the management console.
- Click in the upper left corner of the management console and select a region or project.
- Click in the upper left corner and choose to go to the Dashboard page.
- In the navigation pane on the left, choose Policies.
- Click the name of the target policy to go to the protection configuration page.
- In the Precise Protection configuration area, change Status as needed and click Customize Rule to go to the Precise Protection page.
- On the Precise Protection page, set Detection Mode.
Two detection modes are available:
- Instant Detection: If a request matches a configured precise protection rule, WAF immediately ends threat detection and blocks the request.
- Full Detection: If a request matches a configured precise protection rule, WAF finishes its scan first and then blocks all requests that match the configured precise protection rule.
- In the upper left corner above the Precise Protection rule list, click Add Rule.
- In the displayed dialog box, add a rule by referring to Table 1.
To ensure that WAF blocks only attack requests, configure Protective Action to Log only first and check whether normal requests are blocked on the Events page. If no normal requests are blocked, configure Protective Action to Block.
If a visitor tries to access a URL containing /admin, WAF will block the request.
Table 1 Rule parameters Parameter
Description
Example Value
Rule Description
A brief description of the rule. This parameter is optional.
None
Condition List
Click Add to add conditions. At least one condition needs to be added. You can add up to 30 conditions to a protection rule. If more than one condition is added, all of the conditions must be met for the rule to be applied. A condition includes the following parameters:
Parameters for configuring a condition are described as follows:- Field
- Subfield: Configure this field only when Params, Cookie, or Header is selected for Field.
- Logic: Select a logical relationship from the drop-down list.
NOTE:
- If Include any value, Exclude any value, Equal to any value, Not equal to any value, Prefix is any value, Prefix is not any of them, Suffix is any value, or Suffix is not any of them is selected, select an existing reference table in the Content drop-down list. For details, see Creating a Reference Table to Configure Protection Metrics In Batches.
- Exclude any value, Not equal to any value, Prefix is not any of them, and Suffix is not any of them indicates, respectively, that WAF performs the protection action (block, allow, or log only) when the field in the access request does not contain, is not equal to, or the prefix or suffix is not any value set in the reference table. For example, assume that Path field is set to Exclude any value and the test reference table is selected. If test1, test2, and test3 are set in the test reference table, WAF performs the protection action when the path of the access request does not contain test1, test2, or test3.
- Content: Enter or select the content of condition matching.
NOTE:For more details about the configurations in general, see Table 1.
- Path Include /admin
- User Agent Prefix is not mozilla/5.0
- IP Equal to 192.168.2.3
- Cookie key1 Prefix is not jsessionid
Protective Action
- Block: The request that hit the rule will be blocked and a block response page is returned to the client that initiates the request. By default, WAF uses a unified block response page. You can also customize this page. For details, see Modifying the Alarm Page.
- Allow: Requests that hit the rule are forwarded to backend servers.
- Log only: Requests that hit the rule are not blocked, but will be logged. You can use WAF logs to query requests that hit the current rule and analyze the protection results of the rule. For example, check whether there are requests that are blocked mistakenly.
Block
Priority
Rule priority. If you have added multiple rules, rules are matched by priority. The smaller the value you set, the higher the priority.
NOTICE:If multiple precise access control rules have the same priority, WAF matches the rules in the sequence of time the rules are added.
5
Effective Date
Select Immediate to enable the rule immediately, or select Custom to configure when you wish the rule to be enabled.
Immediate
- Click Confirm. You can then view the added precise protection rule in the protection rule list.
- To disable a rule, click Disable in the Operation column of the rule. The default Rule Status is Enabled.
- To modify a rule, click Modify in the row containing the rule.
- To delete a rule, click Delete in the row containing the rule.
Protection Effect
If you have configured a precise protection rule for your domain name, to verify WAF is protecting your website (www.example.com) against the rule:
- Clear the browser cache and enter the domain name in the address bar to check whether the website is accessible.
- If the website is inaccessible, connect the website domain name to WAF by following the instructions in Website Settings.
- If the website is accessible, go to Step 2.
- Clear the browser cache and enter http://www.example.com/admin (or any page containing /admin) in the address bar. Normally, WAF blocks the requests that meet the conditions and returns the block page.
- Return to the WAF console. In the navigation pane, click Events. On the displayed page, view or download events data.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot