コンテンツにスキップ

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

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

  • 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に接続

手動方式との比較

サポート終了のノード (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 below 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.

    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
    

アップグレード手順

  • 同じサーバーにフィルタリングノードと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:all-in-one Wallarmインストーラーのダウンロード

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.1/wallarm-6.1.0.x86_64-glibc.sh
curl -O https://meganode.wallarm.com/6.1/wallarm-6.1.0.aarch64-glibc.sh

ステップ5:all-in-one Wallarmインストーラーの実行

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

  1. Run downloaded script:

    # If using the x86_64 version:
    sudo env WALLARM_LABELS='group=<GROUP>' sh wallarm-6.1.0.x86_64-glibc.sh
    
    # If using the ARM64 version:
    sudo env WALLARM_LABELS='group=<GROUP>' sh wallarm-6.1.0.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.1.0.x86_64-glibc.sh
    
    # If using the ARM64 version:
    sudo sh wallarm-6.1.0.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-5.3.0.x86_64-glibc.sh filtering
    
    # ARM64バージョンを使用する場合:
    sudo env WALLARM_LABELS='group=<GROUP>' sh wallarm-5.3.0.aarch64-glibc.sh filtering
    

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

    # x86_64バージョンを使用する場合:
    sudo sh wallarm-5.3.0.x86_64-glibc.sh filtering
    
    # ARM64バージョンを使用する場合:
    sudo sh wallarm-5.3.0.aarch64-glibc.sh filtering
    

ステップ6:古いノードマシンから新しいノードマシンへのNGINXおよびpostanalytics構成の転送

古いマシン上の構成ファイルから新しいマシン上のファイルへ、ノードに関連するNGINX構成およびpostanalytics構成を転送します。必要なディレクティブをコピーすることで実施できます。

ソースファイル

古いマシンでは、OSおよびNGINXのバージョンに応じて、NGINX構成ファイルが異なるディレクトリに存在し、名前も異なる場合があります。最も一般的なものは次の通りです:

  • /etc/nginx/conf.d/default.conf (NGINX設定)

  • /etc/nginx/conf.d/wallarm-status.conf (Wallarmノード監視設定。詳細はリンクに記載)

また、postanalyticsモジュールの構成(Tarantoolデータベース設定)は通常、以下の場所にあります:

  • /etc/default/wallarm-tarantoolまたは

  • /etc/sysconfig/wallarm-tarantool

ターゲットファイル

all-in-one installerはOSおよびNGINXのバージョンの組み合わせに応じて動作するため、新しいマシン上のターゲットファイルは名前が異なったり、異なるディレクトリに配置される場合があります。

ステップ7:NGINXの再起動

Restart NGINX using the following command:

sudo systemctl restart nginx

ステップ8:Wallarmノードの動作確認

新しいノードの動作確認を行うには:

  1. テスト用のSQLIおよびXSS攻撃を保護対象リソースのアドレスに送信してください:

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

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

ステップ9:Wallarmノードへのトラフィック送信の設定

使用している展開手法に応じて、以下の設定を実施してください:

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

トラフィックを新しいノードに完全にリダイレクトする前に、部分的にリダイレクトし、新しいノードが期待通りに動作するかを確認することを推奨します。

ウェブサーバまたはプロキシサーバ(例:NGINX, Envoy)を構成し、受信トラフィックをWallarmノードにミラーリングしてください。構成の詳細についてはお使いのウェブまたはプロキシサーバのドキュメントを参照することを推奨します。

リンク内に、最も普及しているウェブおよびプロキシサーバ(NGINX, Traefik, Envoy)のサンプル構成例が記載されています。

ステップ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