ALIYUN::DDoS::Policy类型用于创建防护策略。
语法
{
  "Type": "ALIYUN::DDoS::Policy",
  "Properties": {
    "PolicyName": String,
    "Type": String,
    "ActionType": String,
    "BlackIpList": List,
    "Content": Map,
    "WhiteIpList": List
  }
}属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| PolicyName | String | 是 | 是 | 策略名称。 | 无 | 
| Type | String | 是 | 否 | 策略类型。 | 取值: 
 | 
| ActionType | String | 否 | 否 | 动作类型。 | 取值 
 | 
| BlackIpList | List | 否 | 否 | IP 黑名单列表 | 最多支持配置1999个IP。 | 
| Content | Map | 否 | 是 | 策略内容。 | 更多信息,请参见Content属性。 | 
| WhiteIpList | List | 否 | 否 | IP 白名单列表 | 最多支持配置1999个IP。 | 
Content语法
"Content": {
  "WhitenGfbrNets": Boolean,
  "PortRuleList": List,
  "RegionBlockCountryList": List,
  "RegionBlockProvinceList": List,
  "FingerPrintRuleList": List,
  "SourceLimit": Map,
  "EnableDefense": Boolean,
  "EnableIntelligence": Boolean,
  "SourceBlockList": List,
  "EnableDropIcmp": Boolean,
  "IntelligenceLevel": String,
  "ReflectBlockUdpPortList": List,
  "BlackIpListExpireAt": Integer,
  "Layer4RuleList": List
}Content属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| BlackIpListExpireAt | Integer | 否 | 是 | IP 黑名单超时时间。 | 无 | 
| EnableDefense | Boolean | 否 | 是 | 是否开启端口防护。 | 无 | 
| EnableIntelligence | Boolean | 否 | 是 | 是否开启 AI 智能防护。 | 无 | 
| EnableDropIcmp | Boolean | 否 | 是 | 是否禁用 ICMP 协议。 | 无 | 
| FingerPrintRuleList | List | 否 | 是 | 指纹过滤规则列表。 | 最多支持配置8组规则,更多信息,请参见FingerPrintRuleList属性。 | 
| IntelligenceLevel | String | 否 | 是 | AI 智能防护的防护等级。 | 取值: 
 | 
| Layer4RuleList | List | 否 | 是 | 端口防护规则列表。 | 最多支持配置8组规则,更多信息,请参见Layer4RuleList属性。 | 
| PortRuleList | List | 否 | 是 | 端口封禁规则列表。 | 最多支持配置8组规则,更多信息,请参见PortRuleList属性。 | 
| RegionBlockCountryList | List | 否 | 是 | 区域封禁的国家列表。 | 无 | 
| RegionBlockProvinceList | List | 否 | 是 | 区域封禁的省份列表。 | 无 | 
| ReflectBlockUdpPortList | List | 否 | 是 | 反射攻击防护过滤的端口列表。 | {'Length': {'Min': 0, 'Max': 20}} | 
| SourceLimit | Map | 否 | 是 | 源限速。 | 更多信息,请参见SourceLimit属性。 | 
| SourceBlockList | List | 否 | 是 | 源限速拉黑列表。 | 更多信息,请参见SourceBlockList属性。 | 
| WhitenGfbrNets | Boolean | 否 | 是 | 是否开启 DDoS高防(中国内地&非中国内地)回源地址加白。 | 无 | 
PortRuleList语法
"PortRuleList": [
  {
    "SrcPortEnd": Integer,
    "SeqNo": Integer,
    "SrcPortStart": Integer,
    "PortRuleId": String,
    "DstPortStart": Integer,
    "DstPortEnd": Integer,
    "Protocol": String
  }
]PortRuleList属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| DstPortStart | Integer | 是 | 是 | 目的端口范围的起始值。 | 取值范围:0~65535。 | 
| DstPortEnd | Integer | 是 | 是 | 目的端口范围的结束值。 | 取值范围:0~65535。 | 
| Protocol | String | 是 | 是 | 协议类型。 | 取值: 
 | 
| SrcPortEnd | Integer | 是 | 是 | 源端口范围的结束值。 | 取值范围:0~65535。 | 
| SeqNo | Integer | 是 | 是 | 生效顺序号。 | 说明  数字越小,越靠前生效。 | 
| SrcPortStart | Integer | 是 | 是 | 源端口范围的起始值。 | 取值范围:0~65535。 | 
| PortRuleId | String | 否 | 是 | 封禁规则 ID。 | 无 | 
FingerPrintRuleList语法
"FingerPrintRuleList": [
  {
    "SrcPortEnd": Integer,
    "SeqNo": Integer,
    "SrcPortStart": Integer,
    "FingerPrintRuleId": String,
    "RateValue": Integer,
    "PayloadBytes": String,
    "DstPortStart": Integer,
    "MatchAction": String,
    "Offset": Integer,
    "MaxPktLen": Integer,
    "MinPktLen": Integer,
    "DstPortEnd": Integer,
    "Protocol": String
  }
]FingerPrintRuleList属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| DstPortStart | Integer | 是 | 是 | 目的端口范围的起始值。 | 取值范围:0~65535。 | 
| DstPortEnd | Integer | 是 | 是 | 目的端口范围的结束值。 | 取值范围:0~65535。 | 
| MatchAction | String | 是 | 是 | 匹配动作。 | 取值: 
 | 
| MaxPktLen | Integer | 是 | 是 | 最大包长。 | 取值范围:1~1500。 | 
| MinPktLen | Integer | 是 | 是 | 最小包长。 | 取值范围:1~1500。 | 
| Protocol | String | 是 | 是 | 协议类型。 | 取值: 
 | 
| SrcPortEnd | Integer | 是 | 是 | 源端口范围的结束值。 | 取值范围:0~65535。 | 
| SeqNo | Integer | 是 | 是 | 生效顺序号。 | 使用整数表示。 说明  数字越小,越靠前生效。 | 
| SrcPortStart | Integer | 是 | 是 | 源端口范围的开始值。 | 取值范围:0~65535。 | 
| FingerPrintRuleId | String | 否 | 是 | 过滤规则 ID。 | 无 | 
| Offset | Integer | 否 | 是 | 偏移量。 | 取值范围:0~1500。 | 
| PayloadBytes | String | 否 | 是 | 检测载荷。 | 无 | 
| RateValue | Integer | 否 | 是 | 限速值。 | 取值范围:1~100000。 说明  匹配后动作为源IP限速或者源 Session 限速时(MacthAction为ip_rate或session_rate),必须填写该参数。 | 
SourceLimit语法
"SourceLimit": {
  "Pps": Integer,
  "SynBps": Integer,
  "Bps": Integer,
  "SynPps": Integer
}SourceLimit属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| Bps | Integer | 否 | 是 | 源带宽限速。 | 单位 Byte/s。 | 
| Pps | Integer | 否 | 是 | 源PPS限速。 | 单位Packet/s。 | 
| SynBps | Integer | 否 | 是 | 源SYN带宽限速。 | 单位 Byte/s。 | 
| SynPps | Integer | 否 | 是 | 源SYN PPS限速。 | 单位Packet/s。 | 
SourceBlockList语法
"SourceBlockList": [
  {
    "Type": Integer,
    "ExceedLimitTimes": Integer,
    "EverySeconds": Integer,
    "BlockExpireSeconds": Integer
  }
]SourceBlockList属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| BlockExpireSeconds | Integer | 是 | 是 | 源 IP 加入黑名单的时长。 | 单位:秒。 | 
| ExceedLimitTimes | Integer | 是 | 是 | 源 IP 在 1 个统计周期内超过限速值的次数。 | 无 | 
| EverySeconds | Integer | 是 | 是 | 源限速拉黑的统计周期。 | 单位:秒。 | 
| Type | Integer | 是 | 是 | 源限速类型。 | 取值: 
 | 
Layer4RuleList语法
"Layer4RuleList": [
  {
    "Action": String,
    "ConditionList": List,
    "Priority": Integer,
    "Method": String,
    "Limited": Integer,
    "Name": String,
    "Match": String
  }
]Layer4RuleList属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| Action | String | 是 | 是 | 动作。 | 取值: 
 
 | 
| ConditionList | List | 是 | 是 | 检测条件列表。 | 更多信息,请参见ConditionList属性。 | 
| Limited | Integer | 是 | 是 | 会话流启动规则匹配的最小字节数。 | 取值范围:0~2048。 | 
| Method | String | 是 | 是 | 规则类型。 | 取值: 
 | 
| Match | String | 是 | 是 | 逻辑符。 | 取值: 
 | 
| Name | String | 是 | 是 | 规则名称。 | 无 | 
| Priority | Integer | 是 | 是 | 规则优先级。 | 取值范围:1~100。 说明  数值越小,优先级越高。 | 
ConditionList语法
"ConditionList": [
  {
    "Position": Integer,
    "Arg": String,
    "Depth": Integer
  }
]ConditionList属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| Arg | String | 是 | 是 | 检测内容。 | 说明  规则类型为char,必须为 ASCII 字符串;规则类型为hex,必须为十六进制字符串。最大长度 2048。 | 
| Depth | Integer | 是 | 是 | 检测窗口长度。 | 取值范围:1~2048。 | 
| Position | Integer | 是 | 是 | 检测起始位置。 | 取值范围:0~2047。 | 
返回值
Fn::GetAtt
- Type:规则类型。 
- Content:策略内容。 
- PolicyName:策略名称。 
- PolicyId:策略ID。 
示例
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  PolicyName:
    Description:
      en: The name of the policy.
    Required: true
    Type: String
    Default: test_policy_312
Resources:
  ExtensionResource:
    Properties:
      Content:
        EnableIntelligence: true
        SourceBlockList:
          - Type: 4
            ExceedLimitTimes: 5
            EverySeconds: 60
            BlockExpireSeconds: 1200
          - Type: 3
            ExceedLimitTimes: 5
            EverySeconds: 60
            BlockExpireSeconds: 2400
          - Type: 6
            ExceedLimitTimes: 5
            EverySeconds: 60
            BlockExpireSeconds: 3360
          - Type: 5
            ExceedLimitTimes: 5
            EverySeconds: 60
            BlockExpireSeconds: 180
        EnableDropIcmp: true
        PortRuleList:
          - SrcPortEnd: 65535
            SrcPortStart: 0
            SeqNo: 1
            DstPortStart: 0
            DstPortEnd: 65535
            MatchAction: drop
            Protocol: udp
          - SrcPortEnd: 65535
            SrcPortStart: 333
            SeqNo: 2
            DstPortStart: 666
            DstPortEnd: 65535
            MatchAction: drop
            Protocol: tcp
        IntelligenceLevel: weak
        RegionBlockProvinceList:
          - 11
        ReflectBlockUdpPortList:
          - 137
          - 99
          - 916
        FingerPrintRuleList:
          - SrcPortEnd: 65535
            SrcPortStart: 56
            SeqNo: 1
            PayloadBytes: '16'
            RateValue: 100
            DstPortStart: 69
            MatchAction: ip_rate
            Offset: 56
            MaxPktLen: 33
            DstPortEnd: 65535
            MinPktLen: 2
            Protocol: tcp
        SourceLimit:
          Pps: 66
          SynBps: 1024
          Bps: 1024
          SynPps: 66
        BlackIpListExpireAt: 1734489860
      PolicyName:
        Ref: PolicyName
    Type: ALIYUN::DDoS::Policy
Outputs:
  Content:
    Description: Configuration Content.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Content
  PolicyId:
    Description: The ID of the policy.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - PolicyId
  PolicyName:
    Description: The name of the policy.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - PolicyName
  Type:
    Description: The type of the policy.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Type
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "PolicyName": {
      "Description": {
        "en": "The name of the policy."
      },
      "Required": true,
      "Type": "String",
      "Default": "test_policy_312"
    }
  },
  "Resources": {
    "ExtensionResource": {
      "Properties": {
        "Content": {
          "EnableIntelligence": true,
          "SourceBlockList": [
            {
              "Type": 4,
              "ExceedLimitTimes": 5,
              "EverySeconds": 60,
              "BlockExpireSeconds": 1200
            },
            {
              "Type": 3,
              "ExceedLimitTimes": 5,
              "EverySeconds": 60,
              "BlockExpireSeconds": 2400
            },
            {
              "Type": 6,
              "ExceedLimitTimes": 5,
              "EverySeconds": 60,
              "BlockExpireSeconds": 3360
            },
            {
              "Type": 5,
              "ExceedLimitTimes": 5,
              "EverySeconds": 60,
              "BlockExpireSeconds": 180
            }
          ],
          "EnableDropIcmp": true,
          "PortRuleList": [
            {
              "SrcPortEnd": 65535,
              "SrcPortStart": 0,
              "SeqNo": 1,
              "DstPortStart": 0,
              "DstPortEnd": 65535,
              "MatchAction": "drop",
              "Protocol": "udp"
            },
            {
              "SrcPortEnd": 65535,
              "SrcPortStart": 333,
              "SeqNo": 2,
              "DstPortStart": 666,
              "DstPortEnd": 65535,
              "MatchAction": "drop",
              "Protocol": "tcp"
            }
          ],
          "IntelligenceLevel": "weak",
          "RegionBlockProvinceList": [
            11
          ],
          "ReflectBlockUdpPortList": [
            137,
            99,
            916
          ],
          "FingerPrintRuleList": [
            {
              "SrcPortEnd": 65535,
              "SrcPortStart": 56,
              "SeqNo": 1,
              "PayloadBytes": "16",
              "RateValue": 100,
              "DstPortStart": 69,
              "MatchAction": "ip_rate",
              "Offset": 56,
              "MaxPktLen": 33,
              "DstPortEnd": 65535,
              "MinPktLen": 2,
              "Protocol": "tcp"
            }
          ],
          "SourceLimit": {
            "Pps": 66,
            "SynBps": 1024,
            "Bps": 1024,
            "SynPps": 66
          },
          "BlackIpListExpireAt": 1734489860
        },
        "PolicyName": {
          "Ref": "PolicyName"
        }
      },
      "Type": "ALIYUN::DDoS::Policy"
    }
  },
  "Outputs": {
    "Content": {
      "Description": "Configuration Content.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Content"
        ]
      }
    },
    "PolicyId": {
      "Description": "The ID of the policy.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "PolicyId"
        ]
      }
    },
    "PolicyName": {
      "Description": "The name of the policy.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "PolicyName"
        ]
      }
    },
    "Type": {
      "Description": "The type of the policy.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Type"
        ]
      }
    }
  }
}