WafRule

class WafRule : KotlinCustomResource

Provides a Dcdn Waf Rule resource. For information about Dcdn Waf Rule and how to use it, see What is Waf Rule.

NOTE: Available since v1.201.0.

Example Usage

Basic Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.dcdn.WafPolicy;
import com.pulumi.alicloud.dcdn.WafPolicyArgs;
import com.pulumi.alicloud.dcdn.WafRule;
import com.pulumi.alicloud.dcdn.WafRuleArgs;
import com.pulumi.alicloud.dcdn.inputs.WafRuleConditionArgs;
import com.pulumi.alicloud.dcdn.inputs.WafRuleRateLimitArgs;
import com.pulumi.alicloud.dcdn.inputs.WafRuleRateLimitStatusArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var config = ctx.config();
final var name = config.get("name").orElse("tf_example");
var exampleWafPolicy = new WafPolicy("exampleWafPolicy", WafPolicyArgs.builder()
.defenseScene("waf_group")
.policyName(name)
.policyType("custom")
.status("on")
.build());
var exampleWafRule = new WafRule("exampleWafRule", WafRuleArgs.builder()
.policyId(exampleWafPolicy.id())
.ruleName(name)
.conditions(
WafRuleConditionArgs.builder()
.key("URI")
.opValue("ne")
.values("/login.php")
.build(),
WafRuleConditionArgs.builder()
.key("Header")
.subKey("a")
.opValue("eq")
.values("b")
.build())
.status("on")
.ccStatus("on")
.action("monitor")
.effect("rule")
.rateLimit(WafRuleRateLimitArgs.builder()
.target("IP")
.interval("5")
.threshold("5")
.ttl("1800")
.status(WafRuleRateLimitStatusArgs.builder()
.code("200")
.ratio("60")
.build())
.build())
.build());
}
}

Import

Dcdn Waf Rule can be imported using the id, e.g.

$ pulumi import alicloud:dcdn/wafRule:WafRule example <id>

Properties

Link copied to clipboard
val action: Output<String>?

Specifies the action of the rule. Valid values: block, monitor, js.

Link copied to clipboard
val ccStatus: Output<String>

Specifies whether to enable rate limiting. Valid values: on and off. NOTE: This parameter is required when policy is of type custom_acl.

Link copied to clipboard
val cnRegionList: Output<String>?

The blocked regions in the Chinese mainland, separated by commas (,).

Link copied to clipboard

Conditions that trigger the rule. See conditions below. NOTE: This parameter is required when policy is of type custom_acl or whitelist.

Link copied to clipboard
val defenseScene: Output<String>

The type of protection policy. The following scenarios are supported:-waf_group:Web basic protection-custom_acl: Custom protection policy-whitelist: whitelist

Link copied to clipboard
val effect: Output<String>?

The effective scope of the rate limiting blacklist. If you set ccStatus to on, you must configure this parameter. Valid values: rule (takes effect for the current rule) and service (takes effect globally).

Link copied to clipboard
val gmtModified: Output<String>

Revised the time. The date format is based on ISO8601 notation and uses UTC +0 time in the format of yyyy-MM-ddTHH:mm:ssZ.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val otherRegionList: Output<String>?

Blocked regions outside the Chinese mainland, separated by commas (,).

Link copied to clipboard
val policyId: Output<String>

The protection policy ID.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The rules of rate limiting. If you set cc_status to on, you must configure this parameter. See rate_limit below.

Link copied to clipboard
val regularRules: Output<List<String>>?

The regular expression.e, when waf_group appears in tags, this value can be filled in, and only one list of six digits in string format can appear with regultypes.

Link copied to clipboard
val regularTypes: Output<List<String>>?

Regular rule type, when waf_group appears in tags, this value can be filled in, optional values:"sqli", "xss", "code_exec", "crlf", "lfileii", "rfileii", "webshell", "vvip", "other"

Link copied to clipboard
val remoteAddrs: Output<List<String>>?

Filter by IP address.

Link copied to clipboard
val ruleName: Output<String>

The name of the protection rule. The name can be up to 64 characters in length and can contain letters, digits, and underscores (_). NOTE: This parameter cannot be modified when policy is of type region_block.

Link copied to clipboard
val scenes: Output<List<String>>?

The types of the protection policies.

Link copied to clipboard
val status: Output<String>

The status of the waf rule. Valid values: on and off. Default value: on.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val wafGroupIds: Output<String>?

The id of the waf rule group. The default value is "1012". Multiple rules are separated by commas.