すべてのプロダクト
Search
ドキュメントセンター

Web Application Firewall:CreateProtectionModuleRule

最終更新日:May 24, 2024

Web侵入防止、データセキュリティ、高度な保護、ボット管理、アクセス制御およびスロットリングモジュールなど、特定のwebアプリケーションファイアウォール (WAF) 保護モジュールのルールを作成します。

使用上の注意

CreateProtectionModuleRuleオペレーションを呼び出すと、特定のWAF保護モジュールのルールを作成することができます。保護モジュールには、Web侵入防止、データセキュリティ、高度な保護、ボット管理、およびアクセス制御またはスロットリングが含まれます。を設定することができます。 DefenseType パラメータを使用して、保護モジュールを指定します。このパラメーターの値の詳細については、以下の説明を参照してください。DefenseType パラメータを使用します。

制限事項

この操作は、1アカウントにつき1秒間に10回まで呼び出すことができます。1秒間に呼び出す回数が制限を超えた場合、スロットリングが発生します。その結果、お客様の業務に支障をきたす可能性があります。本操作を呼び出す際には、制限値にご注意いただくことをお勧めします。

デバッグ

OpenAPI Explorer は署名値を自動的に計算します。 この操作は、OpenAPI Explorer で呼び出すことを推奨します。 OpenAPI Explorer は、さまざまな SDK に対して操作のサンプルコードを動的に生成します。

リクエストパラメーター

パラメーターデータ型必須/任意説明
操作String必須CreateProtectionModuleRule

実行する操作です。 への値です。CreateProtectionModuleRule

ドメインString必須www.example.com

保護ルールを作成するドメイン名。

説明 DescribeDomainNames操作を呼び出して、WAFによって保護されているドメイン名を照会できます。
DefenseTypeString必須ac_custom

ルールを作成する保護モジュール。 設定可能な値は以下のとおりです。

  • waf-codec: 保護ルールエンジン
  • tamperproof: ウェブサイトの改ざん防止
  • dlp: データリーク予防
  • ng_account: アカウントのセキュリティ
  • 不正防止: データリスク管理
  • antifraud_js: データリスク管理のためにJavaScriptプラグインを挿入するWebページの設定
  • bot_algorithm: intelligent algorithm for the bot management module
  • bot_wxbb_pkg: アプリ保護モジュールのバージョン保護
  • bot_wxbb: path protection for the app protection module
  • ac_カスタム: カスタム保護ポリシー
  • whitelist: website whitelist
RuleString必須 {"action":"monitor","name":"test","scene":"custom_acl","conditions":[{"opCode":1,"key":"URL","values":"/example"}]}

ルールの構成。値は、JSON 構造体を構成する文字列である。JSON構造体には、複数のパラメータが含まれる。

説明 The parameters vary based on the value of the DefenseType parameter. 詳細については、このトピックの「ルールパラメーターの説明」を参照してください。
InstanceIdString必須waf-cn-0xldbqt****

WAFインスタンスのID。

説明 DescribeInstanceInfo操作を呼び出して、WAFインスタンスのIDを照会できます。
ルールパラメーターの説明
  • DefenseTypeパラメーターがwaf-codecに設定されている場合、Ruleパラメーターの値は次のパラメーターで構成されます。
    • codecList: 有効なデコードの設定。 このパラメーターは必須です。 データ型:配列。このパラメータの有効値は、WAFコンソールで確認することができます。
    • Example
      
          {
              "codecList":["url","base64"]
          }
          
  • DefenseType パラメータに tamperproof, Content パラメータの値は、以下のパラメータで構成される。:
    • uri:保護したい URL を指定します。データ型:文字列。 このパラメーターは必須です。 データ型: 文字列。
    • name: ルールの名前。 このパラメーターは必須です。 データ型: 文字列。
    • 
          {
              "name":"example" 、
              "uri":"http://www.aliyundoc.com/example"
          }
          
  • DefenseTypeパラメーターがdIpに設定されている場合、Ruleパラメーターの値は次のパラメーターで構成されます。
    • name: ルールの名前。 このパラメーターは必須です。 データ型: 文字列。
    • conditions: WAFが機密データを検索して保護する条件。 条件は最大2つまで指定可能です。2つの条件はJSON文字列として指定され、and論理関係にある必要があります。 このパラメーターは必須です。 Dataタイプ: アレイ。 JSON文字列は、以下のパラメータで構成されています。:
      • key: 一致アイテム。 設定可能な値は以下のとおりです。
        • 0: URL
        • 10: sensitive data
        • 11: HTTP status code
          説明 You cannot specify HTTP status codes (11) and sensitive data (10) as the match items in the conditions parameter at the same time.
      • operation: マッチングロジックを設定します。に設定します。 1, は、インクルード論理演算子を示します。
      • value:JSON文字列で定式化されたマッチ値です。複数の値を指定できます。 JSON文字列は、以下のパラメータで構成されています。:
        • v: このパラメーターは、keyパラメーターが0または11に設定されている場合にのみ有効です。
          • URL: keyパラメーターが0に設定されている場合、vパラメーターの値はURLです。
          • HTTPステータスコード: keyパラメーターが11に設定されている場合、vパラメーターの有効な値は400401402403404405〜499500501502503504505〜599です。
        • k: このパラメーターは、keyパラメーターが10に設定されている場合にのみ有効です。 設定可能な値は以下のとおりです。
          • 100: IDカード番号
          • 101: クレジットカード番号
          • 102: 電話番号
          • 103: デフォルトの機密単語
    • アクション: 作用は後に実行ルール一致Valid値:
      • 3: generates alerts.
      • 10: filters sensitive data. This action is valid only when the key parameter is set to 10.
      • 11: システムの組み込みブロックページを返します。 This action is valid only when the key parameter is set to 11.
    • Example
      
        {
          "name":"example" 、
          "conditions":[{"key":11,"operation":1,"value":[{"v":401}]}},{"key":"0","operation":1,"value":[{"v":"www.aliyundoc.com"}]}] 、
          "アクション":3
        }
        
  • If the DefenseType parameter is set to ng_account, the value of the Rule parameter consists of the following parameters:
    • url_path: 検出されたリクエストのurlパス。 パスはスラッシュ (/) で始まる必要があります。 このパラメーターは必須です。 データ型: 文字列。
    • method: the method of the requests. このパラメーターは必須です。 データ型: 文字列。 有効な値: POST、GET、PUT、およびDELETE。 複数のリクエストメソッドを指定できます。 Separate the request methods with commas (,).
    • account_left: the account. このパラメーターは必須です。 データ型: 文字列。
    • password_left: パスワード。 このパラメーターはオプションです。 Data type: string.
    • action: the action that is performed after the rule is matched. このパラメーターは必須です。 Data type: string. 設定可能な値は以下のとおりです。
      • monitor: generates alerts.
      • block: blocks requests.
    • 
          {
              "url_path":"/example" 、
              "method":"POST,GET,PUT,DELETE",
              "account_left":"aaa",
              "password_left:" 123 "、
              "アクション":"モニター"
          }
          
  • If the DefenseType parameter is set to antifraud, the value of the Rule parameter consists of the following parameters:
    • uri: リクエストされたURL。 このパラメーターは必須です。 Data type: string.
    • Example
      
          {
              "uri": "http://1.example.com/example"
          }
          
  • If the DefenseType parameter is set to antifraud_js, the value of the Rule parameter consists of the following parameters:
    • uri: the URL path of the web page into which you want to insert a JavaScript plug-in for data risk control. The path must start with a forward slash (/). WAF inserts the JavaScript plug-in into all the web pages under the specified URL path. このパラメーターは必須です。 データ型: 文字列。
    • 
          {
              "uri": "/example/example"
          }
          
  • DefenseTypeパラメーターがbot_algorithmに設定されている場合、Ruleパラメーターの値は次のパラメーターで構成されます。
    • name: ルールの名前。 このパラメーターは必須です。 データ型: 文字列。
    • algorithmName: アルゴリズムの名前。 このパラメーターは必須です。 データ型: 文字列。 設定可能な値は以下のとおりです。
      • RR: the algorithm that is used to identify special resource crawlers
      • PR: the algorithm that is used to identify special path crawlers
      • DPR: the algorithm that is used to identify parameter round-robin crawlers
      • SR: 動的IPアドレスクローラーを識別するために使用されるアルゴリズム
      • IND: the algorithm that is used to identify proxy device crawlers
      • Periodicity: the algorithm that is used to identify periodic crawlers
    • timeInterval: The interval of detection. このパラメーターは必須です。 Data type: integer. Valid values: 30, 60, 120, 300, and 600. (単位:秒)
    • action: ルールが一致した後に実行されるアクション。 このパラメーターは必須です。 データ型: 文字列。 設定可能な値は以下のとおりです。
      • monitor: リクエストを監視します。
      • captcha: performs slider CAPTCHA verification.
      • js: JavaScript検証を実行します。
      • block: リクエストをブロックします。 If you set the action parameter to block, you must also specify the blocktime parameter.
    • blocktime: リクエストがブロックされる期間。 このパラメーターはオプションです。 データ型: 整数。 単位: 分。 Valid values: 1 to 600.
    • config: the configuration of the algorithm, which is formulated in a JSON string. このパラメーターは必須です。 Data type: string. The parameters that are contained in the JSON string vary based on the value of the algorithmName parameter.
      • algorithmNameパラメーターをRRに設定した場合、configパラメーターの値は次のパラメーターで構成されます。
        • resourceType: 要求されたリソースのタイプ。 このパラメーターはオプションです。 Data type: integer. 設定可能な値は以下のとおりです。
          • 1: 動的リソース。
          • 2: 静的リソース。
          • -1: custom resources. この場合、extensionsパラメーターを使用して、文字列でリソースサフィックスを指定する必要もあります。 Separate suffixes with commas (,). 例: css,jpg,xls
        • minRequestCountPerIp: the minimum number of requests from an IP address. WAFは、このIPアドレスからのリクエスト数がこのパラメーターの値以上の場合にのみ、IPアドレスを検出します。 このパラメーターは必須です。 データ型: 整数。 このパラメータは、アクセス要求の最小数を指定します。 有効な値: 5 ~ 10000
        • minRatio: IPアドレスから開始されたリクエストのうち、指定されたタイプのリソースまたは指定されたパスにアクセスするリクエストの割合のしきい値。 この閾値は、リスクが存在するか否かを判定する。 If the actual proportion is greater than the threshold, risks exist. 指定されたタイプのリソースにアクセスする要求は、特別なリソースクローラを識別するために使用されるアルゴリズムを使用して識別される。 指定されたパスにアクセスする要求は、特定のパスクローラを識別するために使用されるアルゴリズムを使用して識別される。 このパラメーターは必須です。 Data type: float. Valid values: 0.01 to 1.
      • algorithmNameパラメーターをPRに設定した場合、configパラメーターの値は次のパラメーターで構成されます。
        • keyPathConfiguration: リクエストされたURLパス。 最大10個のURLパスを指定できます。 このパラメーターは、algorithmNameパラメーターがPRに設定されている場合にのみ必要です。 このパラメーターはオプションです。 Data type: array. This parameter is a JSON string that consists of the following parameters:
          • method: the request method. このパラメーターは必須です。 データ型: 文字列。 有効な値: POSTGETPUTDELETEHEADOPTIONS
          • url: URLパスのキーワード。 パスはスラッシュ (/) で始まる必要があります。 このパラメーターは必須です。 データ型: 文字列。
          • matchType: the match method. このパラメーターは、URLパラメーターと組み合わせて、要求されたurlパスを指定します。 このパラメーターは必須です。 Data type: string. Valid values: all (exact match), prefix (prefix match), and regex (regular expression match).
        • minRequestCountPerIp: IPアドレスからのリクエストの最小数。 WAF detects an IP address only when the number of requests from this IP address is greater than or equal to the value of this parameter. このパラメーターは必須です。 Data type: integer. This parameter specifies the minimum number of access requests. 有効な値: 5 ~ 10000
        • minRatio: the threshold for the proportion of requests that access specified types of resources or specified paths in requests that are initiated from an IP address. This threshold is used to determine whether risks exist. 実際の割合がしきい値よりも大きい場合、リスクが存在します。 The requests that access specified types of resources are identified by using the algorithm that is used to identify special resource crawlers. The requests that access specified paths are identified by using the algorithm that is used to identify specific path crawlers. このパラメーターは必須です。 データ型: float。 Valid values: 0.01 to 1.
      • algorithmNameパラメーターをDPRに設定した場合、configパラメーターの値は次のパラメーターで構成されます。
        • method: リクエストメソッド。 このパラメーターは必須です。 データ型: 文字列。 Valid values: POST, GET, PUT, DELETE, HEAD, and OPTIONS.
        • urlPattern: キーパラメーターのパス。 パスはスラッシュ (/) で始まる必要があります。 このパラメーターは必須です。 Data type: string. You can specify multiple key parameters and enclose each parameter with a pair of braces {}. 例: /company/{}/{}/{}/user.php?uid ={} uid ={}
        • minRequestCountPerIp: IPアドレスからのリクエストの最小数。 WAFは、このIPアドレスからのリクエスト数がこのパラメーターの値以上の場合にのみ、IPアドレスを検出します。 このパラメーターは必須です。 データ型: 整数。 このパラメータは、アクセス要求の最小数を指定します。 Valid values: 5 to 10000.
        • minRatio: IPアドレスから開始されるリクエストで、指定したキーパラメーターを使用するリクエストの割合のしきい値。 この閾値は、リスクが存在するか否かを判定する。 実際の割合がしきい値よりも大きい場合、リスクが存在します。 このパラメーターは必須です。 データ型: float。 Valid values: 0.01 to 1.
      • If you set the algorithmName parameter to SR, the value of the config parameter consists of the following parameters:
        • maxRequestCountPerSrSession: 各セッションのリクエストの最小数。 If the number of requests in a single session is smaller than the value of this parameter, the session is considered abnormal. このパラメーターは必須です。 データ型: 整数。 有効値: 1~8。
        • minSrSessionCountPerIp: the threshold for the number of abnormal sessions in the requests that are initiated from an IP address. しきい値は、リスクが存在するかどうかを判断するために使用されます。 If an actual number is greater than the threshold, risks exist. このパラメーターは必須です。 データ型: 整数。 有効な値: 5 ~ 300
      • algorithmNameパラメーターをINDに設定した場合、configパラメーターの値は次のパラメーターで構成されます。
        • minIpCount: the threshold for the number of IP addresses that the Wi-Fi connected device accesses. このパラメータは、悪意のあるデバイスを識別するために使用される条件を指定します。 実際の数がしきい値より大きい場合、リスクが存在します。 このパラメーターは必須です。 データ型: 整数。 有効な値: 5 ~ 500
        • keyPathConfiguration: リクエストされたURLパス。 最大10個のURLパスを指定できます。 このパラメーターはオプションです。 Data type: array. This parameter is a JSON string that consists of the following parameters:
          • method: the request method. このパラメーターは必須です。 Data type: string. Valid values: POST, GET, PUT, DELETE, HEAD, and OPTIONS.
          • url: the keyword of the URL path. パスはスラッシュ (/) で始まる必要があります。 このパラメーターは必須です。 Data type: string.
          • matchType: the match method. このパラメーターは、URLパラメーターと組み合わせて、要求されたurlパスを指定します。 このパラメーターは必須です。 Data type: string. Valid values: all (exact match), prefix (prefix match), and regex (regular expression match).
      • algorymNameパラメーターをPeriodicityに設定した場合、configパラメーターの値は次のパラメーターで構成されます。
        • minRequestCountPerIp: the minimum number of requests from an IP address. WAF detects an IP address only when the number of requests from this IP address is greater than or equal to the value of this parameter. このパラメーターは必須です。 データ型: 整数。 This parameter specifies the minimum number of access requests. Valid values: 5 to 10000.
        • level: the risk level, which is the extent of obviousness of periodic access from IP addresses. このパラメーターは必須です。 データ型: 整数。 設定可能な値は以下のとおりです。
          • 0: obvious
          • 1: 中程度
          • 2: 弱い
    • Example
      
          {
              "name": "Crawler identification for proxy devices",
              "algorithmName":"IND",
              "timeInterval":"60" 、
              "アクション":"モニター" 、
              "config":{
                  "minIpCount":5、
                  "keyPathConfiguration":[{"url":"/index","method":"GET","matchType":"prefix"}]
              }
          }
          
  • DefenseTypeパラメーターがbot_wxbb_pkgに設定されている場合、Ruleパラメーターの値は次のパラメーターで構成されます。
    • name: ルールの名前。 このパラメーターは必須です。 Data type: string.
    • action: the action that is performed after the rule is matched. このパラメーターは必須です。 Data type: string. 設定可能な値は以下のとおりです。
      • test: monitors requests.
      • close: blocks requests.
    • nameList: the version information of valid package. You can specify the version information for a maximum of five valid packages. このパラメーターは必須です。 Data type: array. The value is a JSON string that contains the following parameters:
      • name: the name of the valid package. このパラメーターは必須です。 Data type: string.
      • signList: the signatures for the package. You can specify a maximum of 15 signatures. 複数ある場合、コンマ (,) で区切ります。 このパラメーターは必須です。 データ型: 配列。
    • 
          {
              "name":"test",
              "action":"close" 、
              "nameList":[{
                  "name":"apk-xxxx" 、
                  "signList":["xxxxxx","xxxxx","xxxx","xx"]
              }]
          }
          
  • If the DefenseType parameter is set to bot_wxbb, the value of the Rule parameter consists of the following parameters:
    • name: the name of the rule. このパラメーターは必須です。 データ型: 文字列。
    • uri: the keyword of the URL path that you want to protect. パスはスラッシュ (/) で始まる必要があります。 このパラメーターは、次のパラメーターで構成されるJSON文字列です。 このパラメーターは必須です。 Data type: string.
    • matchType: the match method. このパラメーターは必須です。 Data type: string. Valid values: all (exact match), prefix (prefix match), and regex (regular match).
    • arg: the included parameters. This parameter specifies a URL path in combination with the matchType parameter. このパラメーターは必須です。 Data type: string.
    • action: the action that is performed after the rule is matched. このパラメーターは必須です。 データ型: 文字列。 設定可能な値は以下のとおりです。
      • test: monitors requests.
      • close: blocks requests.
    • hasTag: This parameter specifies whether to add a custom signature field. このパラメーターは必須です。 データ型:Boolean
      • true: In this case, you must set the wxbbVmpFieldType and wxbbVmpFieldValue parameters to specify the type and value of the field.
      • false:
    • wxbbVmpFieldType: 署名フィールドのタイプ。 このパラメーターはオプションです。 Data type: integer. If you set the hasTag parameter to true, you must also specify this parameter. 設定可能な値は以下のとおりです。
      • 0: header
      • 1: parameter
      • 2: cookie
    • wxbbVmpFieldValue: the value of the signature field. このパラメーターはオプションです。 Data type: string. If you set the hasTag parameter to true, you must also specify this parameter.
    • blockInvalidSign: 無効な署名に対してアクションを実行するかどうかを指定します。 このパラメーターは必須です。 データ型: 整数。 値を1に設定します。 The value 1 specifies that the default protection policy for path protection rules is enabled.
    • blockProxy: This parameter specifies whether to take actions on a proxy. このパラメーターはオプションです。 Data type: integer. Set the value to 1. If you do not need to perform actions on the proxy, you can leave this parameter unspecified.
    • blockSimulator: This parameter specifies whether to take actions on a simulator. このパラメーターはオプションです。 Data type: integer. Set the value to 1. If you do not need to perform actions on the simulator, you can leave this parameter unspecified.
    • Example
      
          {
              "name":"test",
              "uri":"/index" 、
              "matchType":"すべて" 、
              "arg":"test" 、
              "action":"close" 、
              "hasTag":true,
              "wxbbVmpFieldType":2、
              "wxbbVmpFieldValue":"test",
              "blockInvalidSign":1,
              "blockProxy":1
          }
          
  • If the DefenseType parameter is set to ac_custom, the value of the Rule parameter varies based on the scene parameter.
    • ACLルールを作成するには、sceneパラメーターをcustom_aclに設定します。 The value of the Rule parameter consists of the following parameters:
      • name: the name of the rule. このパラメーターは必須です。 Data type: string.
      • scene: the type of the protection policy. このパラメーターは必須です。 Data type: string. If you want to create an ACL rule, set the value to custom_acl.
      • action: ルールが一致した後に実行されるアクション。 このパラメーターは必須です。 データ型: 文字列。 設定可能な値は以下のとおりです。
        • monitor: monitors requests.
        • captcha: performs slider CAPTCHA verification.
        • captcha_strict: performs strict slider CAPTCHA verification.
        • js: performs JavaScript verification.
        • block: blocks requests.
      • conditions: the match condition. You can specify a maximum of five match conditions. このパラメーターは必須です。 データ型: 配列。 The value is a JSON string that consists of the following parameters:
        • key: the match item. 値の値: URLIPRefererUser-AgentParamsCookieContent-TypeContent-LengthX-Forwarded-ForPost-BodyHttp-MethodHeaderURLPath
        • opCode: the logical operator. 設定可能な値は以下のとおりです。
          説明 カスタムルールを作成するとき、使用可能な論理演算子 (opCode) は一致項目 (key) によって異なります。 各一致項目で使用できる論理演算子の詳細については、WAFコンソールにログインします。 The information that is displayed in the WAF console shall prevail.
          • 11: equals
          • 10: does not equal
          • 41: equals one of multiple values
          • 50: 任意の値と等しくない
          • 1: includes
          • 0: does not include
          • 51: 複数の値のいずれかを含む
          • 52: does not include any value
          • 82: exists
          • 2: 存在しません
          • 21: 長さに等しい
          • 22: 長さより大きい
          • 20: length less than
          • 60: 一致しない定期的な表現
          • 61: matches a regular expression
          • 72: matches a prefix
          • 81: matches a suffix
          • 80: 空のコンテンツ
        • values: 一致する値。 このパラメーターは、ビジネス要件に基づいて指定できます。 データ型: 文字列。
          説明 The valid values of the opCode and values parameters in the match conditions vary based on the key parameter. 一致条件の詳細については、「一致条件のフィールド」をご参照ください。
      • 
                {
                    "アクション":"モニター" 、
                    "name":"test",
                    "scene":"custom_acl" 、
                    "conditions":[{"opCode":1,"key":"URL","values":"/example"}]
                }
                
    • HTTPフラッド保護ルールを作成するには、sceneパラメーターをcustom_aclに設定します。 Ruleパラメーターの値は、次のパラメーターで構成されます。
      • name: ルールの名前。 このパラメーターは必須です。 データ型: 文字列。
      • scene: 保護ポリシーのタイプ。 このパラメーターは必須です。 データ型: 文字列。 HTTPフラッド保護ルールを作成する場合は、値をcustom_ccに設定します。
      • conditions: 一致条件。 Youの最大指定することができ5一致条件。 このパラメーターは必須です。 データ型: 配列。 値は、次のパラメーターで構成されるJSON文字列です。
        • key: 一致アイテム。 値の値: URLIPRefererUser-AgentParamsCookieContent-TypeContent-LengthX-Forwarded-ForPost-BodyHttp-MethodHeaderURLPath
        • opCode: 論理演算子。 設定可能な値は以下のとおりです。
          説明 When you create a custom rule, the available logical operators (opCode) vary based on the match item (key). 各一致項目で使用できる論理演算子の詳細については、WAFコンソールにログインします。 WAFコンソールに表示される情報が優先されます。
          • 11: equals
          • 10: 等しくない
          • 41: 複数の値の1つに等しい
          • 50: does not equal any value
          • 1: includes
          • 0: 含まない
          • 51: 複数の値のいずれかを含む
          • 52: 値を含まない
          • 82: exists
          • 2: 存在しません
          • 21: 長さに等しい
          • 22: 長さより大きい
          • 20: 長さより小さい
          • 60: 正規表現と一致しません
          • 61: 正規表現に一致する
          • 72: プレフィックスに一致
          • 81: 接尾辞に一致する
          • 80: 空のコンテンツ
        • values: 一致する値。 このパラメーターは、ビジネス要件に基づいて指定できます。 データ型: 文字列。
          説明 一致条件のopCodeパラメーターとvaluesパラメーターの有効な値は、keyパラメーターによって異なります。
      • action: ルールが一致した後に実行されるアクション。 このパラメーターは必須です。 Data type: string. 設定可能な値は以下のとおりです。
        • monitor: monitors requests.
        • captcha: スライダーCAPTCHA検証を実行します。
        • captcha_strict: 厳密なスライダーCAPTCHA検証を実行します。
        • js: JavaScript検証を実行します。
        • block: リクエストをブロックします。
      • ratelimit: the maximum rate of requests from an object. このパラメーターは必須です。 データ型: JSON文字列。 値は、次のパラメーターで構成されるJSON文字列です。
        • target: リクエストレートが計算されるオブジェクトのタイプ。 このパラメーターは必須です。 データ型: 文字列。 設定可能な値は以下のとおりです。
          • remote_addr: IPアドレス。
          • cookie.acw_tc: sessions.
          • queryarg: カスタムパラメータ。 カスタムパラメーターを使用する場合は、subkeyパラメーターでカスタムパラメーターの名前を指定する必要があります。
          • cookie: カスタムクッキー。 カスタムcookieを使用する場合は、subkeyパラメーターでcookieの内容を指定する必要があります。
          • header: カスタムヘッダー。 カスタムヘッダーを使用する場合は、subkeyパラメーターでヘッダーの内容を指定する必要があります。
        • subkey: このパラメーターは、targetパラメーターをcookieheader、またはqueryargに設定した場合にのみ必要です。 subkeyパラメーターはオプションです。 データ型: 文字列。
        • interval: 指定されたオブジェクトからのリクエスト数が計算される期間。 このパラメーターは、thresholdパラメーターと一緒に使用する必要があります。 このパラメーターは必須です。 データ型: 整数。 (単位:秒)
        • threshold: 指定された期間中に個々のオブジェクトから許可されるリクエストの最大数。 このパラメーターは必須です。 データ型: 整数。
        • status: HTTPステータスコードの頻度。 このパラメーターはオプションです。 データ型: JSON文字列。 値は、次のパラメーターで構成されるJSON文字列です。
          • code: HTTPステータスコード。 このパラメーターは必須です。 データ型: 整数。
          • count: 指定されたHTTPステータスコードが返される回数のしきい値。 閾値は、ルールが一致するかどうかを判定するために使用される。 実際の数値がしきい値より大きい場合、nameパラメーターで指定されたルールが一致します。 このパラメーターはオプションです。 データ型: 整数。 有効な値: 1 ~ 999999999 countまたはratioパラメーターを設定できます。 両方のパラメーターを同時に設定することはできません。
          • ratio: 指定されたHTTPステータスコードが返される回数のしきい値。 閾値は、ルールが一致するかどうかを判定するために使用される。 実際のパーセンテージがしきい値より大きい場合、nameパラメーターで指定されたルールが一致します。 このパラメーターはオプションです。 データ型: 整数。 Valid values: 1 to 100. countまたはratioパラメーターを設定できます。 両方のパラメーターを同時に設定することはできません。
        • scope: このパラメーターは、設定を有効にするスコープを指定します。 このパラメーターは必須です。 Data type: string. 設定可能な値は以下のとおりです。
          • rule: the objects that match the specified conditions
          • domain: ルールが適用されるドメイン名
        • ttl: 指定されたアクションが実行される期間。 このパラメーターは必須です。 データ型: 整数。 有効値: 60 ~ 86400
      • 
                {
                    "name":"HTTP flood protection rule",
                    "conditions":[{"opCode":1,"key":"URL","values":"/example"}] 、
                    "action":"block" 、 
                    "scene":"custom_cc" 、  
                    "ratelimit":{
                        "target": "remote_addr", 
                        "interval": 300、
                        "threshold": 2000、
                        "status": {
                            "code": 404、
                            "count": 200
                        },
                        "scope": "rule" 、
                        "ttl": 1800
                    }
                }
                
  • DefenseTypeパラメーターがwhitelistに設定されている場合、Ruleパラメーターの値は次のパラメーターで構成されます。
    • name: ルールの名前。 このパラメーターは必須です。 Data type: string.
    • tags: チェックがバイパスされる保護モジュール。 このパラメーターは必須です。 データ型: 配列。 tagsパラメーターの値は、ホワイトリストのタイプによって異なります。
      説明 The values of the tags parameter can contain only the values that are listed in a specific whitelist. たとえば、tagsパラメーターの値にregularccの両方を含めることはできません。 This is because regular belongs to the whitelist for the web intrusion prevention module and cc belongs to the whitelist for the access control or throttling module.
      • グローバルホワイトリストを設定するには、tagsパラメーターを次の値に設定します。
        • waf: リクエストは、すべての保護モジュールのチェックをバイパスします。
      • To configure the whitelist for the web intrusion prevention module, set the tags parameter to one or more of the following values:
        • regular: リクエストは、保護ルールエンジンモジュールのチェックをバイパスします。 リクエストは、すべての保護ルールのチェックをバイパスします。
        • regular_rule: リクエストは、保護ルールエンジンモジュールの特定のルールのチェックをバイパスします。 tagsパラメーターを値に設定した場合、regularRulesパラメーターを設定してルールのIDを指定する必要があります。
        • regular_type: リクエストは、保護ルールエンジンモジュールのルールの特定のタイプのチェックをバイパスします。 tagsパラメーターを値に設定した場合、regularRulesパラメーターを設定してルールのタイプを指定する必要があります。
        • deeplearning: リクエストは、深層学習エンジンモジュールのチェックをバイパスします。
      • To configure the whitelist for the access control or throttling module, set the tags parameter to one or more of the following values:
        • cc: リクエストは、HTTPフラッド保護モジュールのチェックをバイパスします。
        • customrule: Requests bypass the checks of custom protection policies.
        • blacklist: リクエストは、IPアドレスブラックリストモジュールのチェックをバイパスします。
        • antiscan: 要求はスキャン保護モジュールの点検をバイパスします。
      • データセキュリティモジュールのホワイトリストを設定するには、tagsパラメーターを次の1つ以上の値に設定します。
        • dlp: リクエストは、データ漏洩防止モジュールのチェックをバイパスします。
        • tamperproof: リクエストは、Webサイトの改ざん防止モジュールのチェックをバイパスします。
        • account: リクエストは、アカウントセキュリティモジュールのチェックをバイパスします。
      • ボット管理モジュールのホワイトリストを設定するには、tagsパラメーターを次の1つ以上の値に設定します。
        • bot_intelligence: リクエストは、ボット脅威インテリジェンスモジュールのチェックをバイパスします。
        • bot_algorithm: リクエストは、一般的なボット動作識別モジュールのチェックをバイパスします。
        • bot_wxbb: リクエストはアプリ保護モジュールのチェックをバイパスします。
        • 不正防止: リクエストは、データリスク管理モジュールのチェックをバイパスします。
    • regularRules: チェックがバイパスされるルールのID。 このパラメーターはオプションです。 データ型: 配列。 tagsパラメーターの値にregular_ruleが含まれる場合、regularRulesパラメーターが必要です。 ルールグループを作成するときに、ルールのIDを表示できます。 ルールグループを作成するには、WAFコンソールに移動し、[保護ルールグループ] をクリックします。 表示されるページで、[ルールグループの作成] をクリックします。 詳細については、「保護ルールグループのカスタマイズ」をご参照ください。
    • regularTypes: チェックがバイパスされるルールのタイプ。 このパラメーターはオプションです。 データ型: 配列。 tagsパラメーターの値にregular_typeが含まれる場合、regularTypesパラメーターが必要です。 設定可能な値は以下のとおりです。
      • sqli: SQLインジェクション
      • xss: クロスサイトスクリプト
      • code_exec: コード実行
      • lfilei: ローカルファイルの包含
      • rfilei: リモートファイルの包含
      • webshell: webshell
      • vvip: custom protection rules
      • other: 他のタイプ
    • conditions: 一致条件。 最大5つの一致条件を指定できます。 このパラメーターは必須です。 Data type: array. 値は、次のパラメーターで構成されるJSON文字列です。
      • key: 一致アイテム。 値の値: URLIPRefererUser-AgentParamsCookieContent-TypeContent-LengthX-Forwarded-ForPost-BodyHttp-MethodHeaderURLPath
      • opCode: 論理演算子。 設定可能な値は以下のとおりです。
        説明 カスタムルールを作成するとき、使用可能な論理演算子 (opCode) は一致項目 (key) によって異なります。 各一致項目で使用できる論理演算子の詳細については、WAFコンソールにログインします。 WAFコンソールに表示される情報が優先されます。
        • 11: equals
        • 10: 等しくない
        • 41: 複数の値の1つに等しい
        • 50: 任意の値と等しくない
        • 1: 含まれている、またはに属する
        • 0: 含まれていない、または属していない
        • 51: 複数の値のいずれかを含む
        • 52: 値を含まない
        • 82: exists
        • 2: 存在しません
        • 21: 長さに等しい
        • 22: 長さより大きい
        • 20: 長さより小さい
        • 60: 正規表現と一致しません
        • 61: 正規表現に一致する
        • 72: matches a prefix
        • 81: 接尾辞に一致する
        • 80: 空のコンテンツ
        • 30: 値未満
        • 31: より大きい値
      • values: 一致する値。 このパラメーターは、ビジネス要件に基づいて指定できます。 データ型: 文字列。
        説明 一致条件のopCodeパラメーターとvaluesパラメーターの有効な値は、keyパラメーターによって異なります。
    • 
          {
              "name": "test" 、
              "tags": ["cc" 、"customrule"] 、
              "conditions":[{"opCode":1,"key":"URL","values":"/example"}] 、
         }
         

すべてのAlibaba Cloud API操作に共通のリクエストパラメーターを含める必要があります。 共通リクエストパラメーターの詳細については、「共通パラメーター」をご参照ください。

サンプルリクエストの詳細については、このトピックの「例」を参照してください。

レスポンスパラメーター

パラメーターデータ型説明
RequestIdStringD7861F61-5B61-46CE-A47C-6B19160D5EB0

リクエストの ID です。

リクエストの例

http(s)://[Endpoint]/?Action=CreateProtectionModuleRule
&Domain=www.example.com
&DefenseType=ac_custom
&Rule= {"action":"monitor","name":"test","scene":"custom_acl","conditions":[{"opCode":1,"key":"URL","values":"/example"}]}
&InstanceId=waf-cn-0xldbqt****
&Common request parameters

正常に処理された場合のレスポンス例

XML 形式

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateProtectionModuleRuleResponse>
    <RequestId>D7861F61-5B61-46CE-A47C-6B19160D5EB0</RequestId>
</CreateProtectionModuleRuleResponse>

JSON 形式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "D7861F61-5B61-46CE-A47C-6B19160D5EB0"
}

エラーコード

エラーコードリストについては、「API エラーセンター」をご参照ください。