コンテンツにスキップ

Docker Envoy‑ベースのイメージを実行する

これらの手順は、Envoy 1.18.4に基づくWallarm Dockerイメージの実行手順を説明します。このイメージには、正しいWallarmノード動作に必要なすべてのシステムが含まれています:

  • Envoyプロキシサービス(Wallarmモジュールを内蔵)

  • Tarantoolモジュール(ポストアナリティクス用)

  • その他のサービスおよびスクリプト

Wallarmモジュールは、リクエストプロキシ用のEnvoy HTTPフィルターとして設計されています。

サポートされている設定パラメーター

NGINXベースのフィルタリングノード設定のほとんどのディレクティブは、Envoyベースのフィルタリングノード設定ではサポートされていません。その結果、レート制限およびクレデンシャルスタッフィング検知は、このデプロイ方法では利用できません。

Envoy‑ベースのフィルタリングノード設定で利用可能なパラメーターの一覧 →

ユースケース

Among all supported Wallarm deployment options, Envoy-based Docker image is recommended for Wallarm deployment in these use cases:

  • If your organization utilizes Docker-based infrastructure, Wallarm Docker image is the ideal choice. It integrates effortlessly into your existing setup, whether you are employing a microservice architecture running on AWS ECS, Alibaba ECS, or other similar services. This solution also applies to those using virtual machines seeking a more streamlined management through Docker containers.

  • If you require fine-grained control over each container, the Docker image excels. It affords a greater level of resource isolation than typically possible with traditional VM-based deployments.

必要条件

  • Docker installed on your host system

  • Access to https://hub.docker.com/r/wallarm/envoy to download the Docker image. Please ensure the access is not blocked by a firewall

  • Access to the account with the Administrator role in Wallarm Console in the US Cloud or EU Cloud

  • Access to https://us1.api.wallarm.com if working with US Wallarm Cloud or to https://api.wallarm.com if working with EU Wallarm Cloud. Please ensure the access is not blocked by a firewall

  • Access to the IP addresses below for downloading updates to attack detection rules, as well as retrieving precise IPs for your allowlisted, denylisted, or graylisted countries, regions, or data centers

    34.96.64.17
    34.110.183.149
    35.235.66.155
    34.102.90.100
    34.94.156.115
    35.235.115.105
    
    34.160.38.183
    34.144.227.90
    34.90.110.226
    

コンテナ実行のオプション

フィルタリングノードの設定パラメーターは、以下の方法でdocker runコマンドに渡すことができます:

  • 環境変数内に.このオプションは基本的なフィルタリングノードパラメーターの設定のみを可能にし、ほとんどのパラメーターは環境変数を通じて変更することはできません.

  • マウントされた設定ファイル内に.このオプションにより、フィルタリングノードのすべてのパラメーターの設定が可能になります.

環境変数を渡してコンテナを実行する

コンテナを実行するには:

  1. Get Wallarm token of the appropriate type:

    1. Open Wallarm Console → SettingsAPI tokens in the US Cloud or EU Cloud.
    2. Find or create API token with the Node deployment/Deployment usage type.
    3. Copy this token.
    1. Open Wallarm Console → Nodes in the US Cloud or EU Cloud.
    2. Do one of the following:
      • Create the node of the Wallarm node type and copy the generated token.
      • Use existing node group - copy token using node's menu → Copy token.
  2. ノード付きでコンテナを実行します:

    docker run -d -e WALLARM_API_TOKEN='XXXXXXX' -e WALLARM_LABELS='group=<GROUP>' -e ENVOY_BACKEND='example.com' -e WALLARM_API_HOST='us1.api.wallarm.com' -p 80:80 wallarm/envoy:4.8.0-1
    
    docker run -d -e WALLARM_API_TOKEN='XXXXXXX' -e WALLARM_LABELS='group=<GROUP>' -e ENVOY_BACKEND='example.com' -p 80:80 wallarm/envoy:4.8.0-1
    

以下の基本的なフィルタリングノードの設定を、オプション-eを通じてコンテナに渡すことができます:

Environment variable 説明 必須
WALLARM_API_TOKEN WallarmノードまたはAPIトークン. Yes
ENVOY_BACKEND Wallarmソリューションで保護するリソースのドメインまたはIPアドレス. Yes
WALLARM_API_HOST Wallarm APIサーバ:
  • USクラウドの場合は us1.api.wallarm.com
  • EUクラウドの場合は api.wallarm.com
デフォルトは:api.wallarm.com
No
WALLARM_MODE ノードモード:
  • blockは悪意のあるリクエストをブロックします
  • safe_blockinggraylisted IP addressesから発生した悪意のあるリクエストのみをブロックします
  • monitoringはリクエストを解析しますがブロックはしません
  • offはトラフィックの解析と処理を無効にします
デフォルトは:monitoring
フィルトレーションモードの詳細な説明 →
No
WALLARM_LABELS ノード4.6以降で利用可能です。WALLARM_API_TOKENDeployロールのAPI tokenに設定されている場合にのみ動作します。ノードインスタンスのグループ化のためにgroupラベルを設定します.例えば:

WALLARM_LABELS="group=<GROUP>"

…はノードインスタンスを<GROUP>インスタンスグループに配置します(既存の場合、または存在しない場合は作成されます.)

Yes (for API tokens)
TARANTOOL_MEMORY_GB Tarantoolに割り当てられるメモリ量.値は整数または浮動小数点数で指定し、(ドット.は小数点の区切り文字です).デフォルトは0.2ギガバイトです. No

コマンドは以下の処理を行います:

  • /etc/envoyコンテナディレクトリ内に最小限のEnvoy設定を含むenvoy.yamlファイルを作成します.

  • /etc/wallarmコンテナディレクトリ内にWallarm Cloudへアクセスするためのフィルタリングノード認証情報のファイルを作成します:

    • node.yaml:フィルタリングノードのUUIDとシークレットキー
    • private.key:Wallarmプライベートキー
  • http://ENVOY_BACKEND:80のリソースを保護します.

envoy.yamlをマウントしてコンテナを実行する

用意したenvoy.yamlファイルは-vオプションを使用してDockerコンテナにマウントできます。ファイルには以下の設定が含まれている必要があります:

  • 手順に記載されているフィルタリングノード設定

  • Envoyの手順に記載されているEnvoy設定

コンテナを実行するには:

  1. Get Wallarm token of the appropriate type:

    1. Open Wallarm Console → SettingsAPI tokens in the US Cloud or EU Cloud.
    2. Find or create API token with the Node deployment/Deployment usage type.
    3. Copy this token.
    1. Open Wallarm Console → Nodes in the US Cloud or EU Cloud.
    2. Do one of the following:
      • Create the node of the Wallarm node type and copy the generated token.
      • Use existing node group - copy token using node's menu → Copy token.
  2. ノード付きでコンテナを実行します:

    docker run -d -e WALLARM_API_TOKEN='XXXXXXX' -e WALLARM_LABELS='group=<GROUP>' -e WALLARM_API_HOST='us1.api.wallarm.com' -v /configs/envoy.yaml:/etc/envoy/envoy.yaml -p 80:80 wallarm/envoy:4.8.0-1
    
    docker run -d -e WALLARM_API_TOKEN='XXXXXXX' -e WALLARM_LABELS='group=<GROUP>' -v /configs/envoy.yaml:/etc/envoy/envoy.yaml -p 80:80 wallarm/envoy:4.8.0-1
    
    • -eオプションは以下の必須環境変数をコンテナに渡します:
    Environment variable 説明 必須
    WALLARM_API_TOKEN Wallarmノードトークン.

    複数インストールで1つのトークンを使用する場合

    選択されたプラットフォームに関係なく、1つのトークンを複数のインストールで使用できます。これにより、Wallarm Console UIでノードインスタンスを論理的にグループ化できます。例:開発環境に複数のWallarmノードをデプロイし、各ノードが特定の開発者所有の別々のマシン上にある場合などです。

    Yes
    WALLARM_API_HOST Wallarm APIサーバ:
    • USクラウドの場合は us1.api.wallarm.com
    • EUクラウドの場合は api.wallarm.com
    デフォルトは:api.wallarm.com
    No
    • -vオプションは設定ファイルenvoy.yamlのあるディレクトリを/etc/envoyコンテナディレクトリにマウントします.

コマンドは以下の処理を行います:

  • envoy.yamlファイルを/etc/envoyコンテナディレクトリにマウントします.

  • /etc/wallarmコンテナディレクトリ内にWallarm Cloudへアクセスするためのフィルタリングノード認証情報のファイルを作成します:

    • node.yaml:フィルタリングノードのUUIDとシークレットキー
    • private.key:Wallarmプライベートキー
  • マウントされた設定ファイルに指定されたリソースを保護します.

ログローテーションの設定(オプション)

ログファイルのローテーションはあらかじめ設定され、デフォルトで有効になっています。必要に応じてローテーションの設定を調整できます。これらの設定はコンテナの/etc/logrotate.dディレクトリにあります.

Wallarmノードの動作テスト

  1. Send the request with test Path Traversal attack to a protected resource address:

    curl http://localhost/etc/passwd
    

    If traffic is configured to be proxied to example.com, include the -H "Host: example.com" header in the request.

  2. Open Wallarm Console → Attacks section in the US Cloud or EU Cloud and make sure the attack is displayed in the list.

    Attacks in the interface

  3. Optionally, [test][link-wallarm-health-check] other aspects of the node functioning.