コンテンツにスキップ

Wallarm NGINXモジュールのアップグレード

本手順では、個別パッケージからインストールされたWallarm NGINXモジュール4.xをバージョン6.xにアップグレードする手順を説明します。以下のいずれかの手順に従ってインストールされたモジュールが対象です:

  • NGINX stable向けの個別パッケージ

  • NGINX Plus向けの個別パッケージ

  • ディストリビューション提供のNGINX向けの個別パッケージ

all-in-one installerでのアップグレード

バージョン4.10以降、個別のLinuxパッケージは非推奨となり、Wallarmのall-in-one installerを使用してアップグレードします。この方法は、以前のアプローチと比べて、アップグレード作業と継続的なデプロイ運用を簡素化します。

インストーラーは次の処理を自動で実行します:

  1. OSとNGINXのバージョンを確認します。
  2. 検出されたOSおよびNGINXのバージョンに対応するWallarmリポジトリを追加します。
  3. これらのリポジトリからWallarmパッケージをインストールします。
  4. インストール済みのWallarmモジュールをNGINXに接続します。
  5. 提供されたトークンを使用してフィルタリングノードをWallarm Cloudに接続します。

手動手順とAll-in-oneの比較

サポート終了のノード(3.6以下)をアップグレードする場合は、別の手順を使用してください。

要件

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

  • Access to https://meganode.wallarm.com to download all-in-one Wallarm installer. Ensure the access is not blocked by a firewall.

  • Access to https://us1.api.wallarm.com for working with US Wallarm Cloud or to https://api.wallarm.com for working with EU Wallarm Cloud. If access can be configured only via the proxy server, then use the instructions.

  • Executing all commands as a superuser (e.g. root).

  • Access to the IP addresses and their corresponding hostnames (if any) listed below. This is needed for downloading updates to attack detection rules and API specifications, as well as retrieving precise IPs for your allowlisted, denylisted, or graylisted countries, regions, or data centers.

    node-data0.us1.wallarm.com - 34.96.64.17
    node-data1.us1.wallarm.com - 34.110.183.149
    us1.api.wallarm.com - 35.235.66.155
    34.102.90.100
    34.94.156.115
    35.235.115.105
    
    node-data1.eu1.wallarm.com - 34.160.38.183
    node-data0.eu1.wallarm.com - 34.144.227.90
    api.wallarm.com - 34.90.110.226
    

アップグレード手順

  • フィルタリングノードとpostanalyticsモジュールが同一サーバーにインストールされている場合は、以下の手順に従って両方をアップグレードしてください。

    クリーンなマシンでall-in-one installerを使用して新しいバージョンのノードを起動し、動作をテストしたうえで、旧ノードを停止し、トラフィックが旧マシンではなく新マシンを経由するように構成する必要があります。

  • フィルタリングノードとpostanalyticsモジュールが別サーバーにインストールされている場合は、こちらの手順に従い、最初にpostanalyticsモジュールを、次にフィルタリングモジュールをアップグレードしてください。

手順1: クリーンなマシンを準備する

When upgrading modules with all-in-one installer, you cannot upgrade an old package installation - instead you need to use a clean machine. Thus, as step 1, prepare a machine with one of the supported OS:

  • Debian 10, 11 and 12.x

  • Ubuntu LTS 18.04, 20.04, 22.04

  • CentOS 7, 8 Stream, 9 Stream

  • Alma/Rocky Linux 9

  • RHEL 8.x

  • RHEL 9.x

  • Oracle Linux 8.x

  • Oracle Linux 9.x

  • Redox

  • SuSe Linux

  • Others (the list is constantly widening, contact Wallarm support team to check if your OS is in the list)

Using new clean machine will lead to that at some moment you will have both old and new node, which is good: you can test the new one working properly without stopping the old one.

手順2: 最新のNGINXと依存関係をインストールする

Install the latest NGINX version of:

  • NGINX stable (the latest supported version is v1.28.0) - see how to install it in the NGINX documentation.

  • NGINX Mainline (the latest supported version is v1.27.5) - see how to install it in the NGINX documentation.

  • NGINX Plus (the latest supported version is NGINX Plus R33) - see how to install it in the NGINX documentation.

  • Distribution-Provided NGINX - to install, use the following commands:

    sudo apt update 
    sudo apt -y install --no-install-recommends nginx
    
    sudo apt-get update
    sudo apt-get install nginx
    
    sudo yum -y update 
    sudo yum install -y nginx
    
    sudo yum -y update 
    sudo yum install -y nginx
    
    sudo yum -y update 
    sudo yum install -y nginx
    

手順3: Wallarmトークンを準備する

To install node, you will need a Wallarm token of the appropriate type. To prepare a token:

  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.

手順4: Wallarmのall-in-one installerをダウンロードする

Wallarm suggests all-in-one installations for the following processors:

  • x86_64

  • ARM64 (beta)

To download all-in-one Wallarm installation script, execute the command:

curl -O https://meganode.wallarm.com/6.5/wallarm-6.5.1.x86_64-glibc.sh
curl -O https://meganode.wallarm.com/6.5/wallarm-6.5.1.aarch64-glibc.sh

手順5: Wallarmのall-in-one installerを実行する

同一サーバー上のフィルタリングノードとpostanalytics

  1. Run downloaded script:

    # If using the x86_64 version:
    sudo env WALLARM_LABELS='group=<GROUP>' sh wallarm-6.5.1.x86_64-glibc.sh
    
    # If using the ARM64 version:
    sudo env WALLARM_LABELS='group=<GROUP>' sh wallarm-6.5.1.aarch64-glibc.sh
    

    The WALLARM_LABELS variable sets group into which the node will be added (used for logical grouping of nodes in the Wallarm Console UI).

    # If using the x86_64 version:
    sudo sh wallarm-6.5.1.x86_64-glibc.sh
    
    # If using the ARM64 version:
    sudo sh wallarm-6.5.1.aarch64-glibc.sh
    
  2. Select US Cloud or EU Cloud.

  3. Enter Wallarm token.

別サーバー上のフィルタリングノードとpostanalytics

フィルタリングノードとpostanalyticsモジュールをアップグレードする手順の順序

フィルタリングノードとpostanalyticsモジュールが別サーバーにインストールされている場合は、フィルタリングノードのパッケージを更新する前に、postanalyticsのパッケージをアップグレードする必要があります。

  1. こちらの手順に従ってpostanalyticsモジュールをアップグレードします。

  2. フィルタリングノードをアップグレードします:

    # x86_64版を使用する場合:
    sudo env WALLARM_LABELS='group=<GROUP>' sh wallarm-6.4.1.x86_64-glibc.sh filtering
    
    # ARM64版を使用する場合:
    sudo env WALLARM_LABELS='group=<GROUP>' sh wallarm-6.4.1.aarch64-glibc.sh filtering
    

    WALLARM_LABELS変数は、ノードが追加されるグループを設定します(Wallarm Console UIでのノードの論理グルーピングに使用します)。

    # x86_64版を使用する場合:
    sudo sh wallarm-6.4.1.x86_64-glibc.sh filtering
    
    # ARM64版を使用する場合:
    sudo sh wallarm-6.4.1.aarch64-glibc.sh filtering
    

手順6: 旧ノードのマシンから新しいマシンへNGINXとpostanalyticsの設定を移行する

必要なディレクティブやファイルをコピーして、旧マシンから新マシンへノード関連のNGINXおよびpostanalyticsの設定を移行します:

  • /etc/nginx/conf.d/default.conf または /**etc/nginx/nginx.conf** のhttpレベルに関するNGINX設定

    フィルタリングノードとpostanalyticsノードが別サーバーにある場合は、フィルタリングノードのマシン上の/etc/nginx/nginx.confhttpブロック内で、wallarm_tarantool_upstreamwallarm_wstore_upstreamにリネームします。

  • /etc/nginx/sites-available/default トラフィックルーティングのためのNGINXおよびWallarm設定

  • /etc/nginx/conf.d/wallarm-status.conf → 新しいマシン上の /etc/nginx/wallarm-status.conf にコピーします

    詳細はリンク内にあります。

  • /etc/wallarm/node.yaml → 新しいマシン上の /opt/wallarm/etc/wallarm/node.yaml にコピーします

    別のpostanalyticsサーバーでカスタムのホストとポートを使用している場合は、postanalyticsノードのマシン上でコピーしたファイル内のtarantoolセクションをwstoreにリネームします。

手順7: NGINXを再起動する

Restart NGINX using the following command:

sudo systemctl restart nginx

手順8: Wallarmノードの動作をテストする

新しいノードの動作をテストするには、次を実行します:

  1. テスト用のSQLインジェクションおよびクロスサイトスクリプティング(XSS)を含むリクエストを保護対象のリソースアドレスに送信します:

    curl http://localhost/?id='or+1=1--a-<script>prompt(1)</script>'
    
  2. US CloudまたはEU CloudのWallarm Console → Attacksセクションを開き、攻撃が一覧に表示されていることを確認します。

  3. Cloudに保存されているデータ(ルール、IP lists)が新しいノードと同期されたら、いくつかテスト攻撃を実行してルールが期待どおりに動作することを確認します。

手順9: トラフィックをWallarmノードへ送信するよう構成する

ロードバランサーの転送先を更新して、トラフィックをWallarmインスタンスへ送信するようにします。詳細は、使用しているロードバランサーのドキュメントを参照してください。

トラフィックを新しいノードへ完全に切り替える前に、まず一部のみをリダイレクトし、新しいノードが期待どおりに動作することを確認することを推奨します。

手順10: 旧ノードを削除する

  1. Wallarm Console → Nodesで対象のノードを選択し、Deleteをクリックして旧ノードを削除します。

  2. 操作を確認します。

    Cloudからノードを削除すると、アプリケーションへのリクエストのフィルタリングは停止します。フィルタリングノードの削除は元に戻せません。ノードはノード一覧から完全に削除されます。

  3. 旧ノードが動作しているマシンを削除するか、Wallarmノードのコンポーネントのみを削除します:

    sudo apt remove wallarm-node nginx-module-wallarm
    
    sudo apt remove wallarm-node nginx-module-wallarm
    
    sudo yum remove wallarm-node nginx-module-wallarm
    
    sudo yum remove wallarm-node nginx-module-wallarm
    
    sudo yum remove wallarm-node nginx-module-wallarm