ルール
Rulesは、Siteへの受信リクエストを許可またはブロックするための条件を定義します。各ルールには、タイプ、式のセット、およびアクションがあります。
ルールのプロパティ
| フィールド | 説明 |
|---|---|
| Type | The kind of matching to perform (see below). |
| Expressions | One or more conditions to evaluate. All expressions in a rule are evaluated together. |
| Action | Allow or Block — what to do when the rule matches. |
| Status code | リクエストがブロックされた場合に返されるHTTPステータスコード(例: 403)。 |
| Reason | Message included in the blocked response. |
| 詳細モード | Log detailed information for each request evaluated by this rule. |
ルールのタイプ
IP
クライアントのIPアドレスによるリクエストのマッチング。式は以下をサポートします:
| 演算子 | 説明 |
|---|---|
is in | IP is within a specific CIDR range (e.g. 192.168.0.0/24). |
is not in | IP is outside a CIDR range. |
equals | IP matches exactly. |
does not equal | IP does not match exactly. |
is abroad | IP is detected as originating outside the server's country (requires IP geolocation). |
複数のIP値は、単一の式内でカンマ区切りで指定できます。
User-Agent
User-Agentヘッダーによるリクエストのマッチング。式は以下をサポートします:
| 演算子 | 説明 |
|---|---|
contains | User-Agent contains the specified string. |
does not contain | User-Agent does not contain the string. |
equals | User-Agent matches exactly. |
does not equal | User-Agent does not match. |
matches regex | User-Agent matches a regular expression. |
does not match regex | User-Agentが正規表現と一致しません。 |
IPレート制限
一定の時間窓内でのIPごとのリクエスト数を制限します。リクエスト制限、時間窓、および制限を超えた場合の応答を設定します。
WAF
リクエストの内容(ヘッダー、ボディ、クエリパラメータ)に基づいてWeb Application Firewall(WAF)ルールを適用します。SQLインジェクション、XSS、パストラバーサルなどの一般的な攻撃パターンを検出・ブロックするために、modsecurity互換のルール構文を使用します。
複合
複数のサブルール(任意のタイプ)を単一のルールに結合します。複合ルールは、すべてのサブルール条件が同時に満たされた場合に一致します。
サイトへのルールの添付
ルールは Site の編集ページに添付されます。ルールはリストされた順序で評価され、最初に一致した時点で評価が停止します。ルールリストの矢印を使用してルールの順序を変更できます。
ヒント
開発中は Verbose mode を使用して、ルールの評価詳細をログに記録し、本番環境で有効にする前に式を調整してください。