GCP'ye Wallarm Docker Görüntüsünün Dağıtımı¶
Bu hızlı rehber, NGINX tabanlı Wallarm node'un Docker görüntüsünü Google Compute Engine (GCE) bileşeni kullanarak Google Cloud Platform'a dağıtmanın adımlarını sunar.
Talimatların Sınırlamaları
Bu talimatlar, yük dengeleme ve node otomatik ölçeklendirme yapılandırmasını kapsamamaktadır. Bu bileşenleri kendiniz yapılandırıyorsanız, lütfen uygun GCP dokümantasyonunu okuyunuz.
Kullanım Durumları¶
Among all supported Wallarm deployment options, Wallarm deployment on Google Compute Engine (GCE) using the Docker image is recommended in these use cases:
-
If your applications leverage a microservices architecture, and are already containerized and operational on GCE.
-
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.
Gereksinimler¶
-
Aktif GCP hesabı
-
Etkinleştirilmiş Compute Engine API
-
Kurulmuş ve yapılandırılmış Google Cloud SDK (gcloud CLI)
-
Wallarm Console'da iki faktörlü doğrulama devre dışı bırakılmış Administrator rolüne sahip hesaba erişim (US Cloud veya EU Cloud)
-
Saldırı tespit kuralları güncellemelerinin indirilmesi, API specifications alınması ve allowlisted, denylisted, or graylisted ülkeler, bölgeler veya veri merkezleri için doğru IP'lerin elde edilebilmesi amacıyla aşağıdaki IP adreslerine erişim
Wallarm node Docker konteyner yapılandırması için Seçenekler¶
The filtering node configuration parameters should be passed to the deployed Docker container in one of the following ways:
-
In the environment variables. This option allows for the configuration of only basic filtering node parameters. Most directives cannot be configured through environment variables.
-
In the mounted configuration file. This option allows full filtering node configuration via any directives. With this configuration method, environment variables with the filtering node and Wallarm Cloud connection settings are also passed to the container.
Ortam Değişkenleri ile Yapılandırılmış Wallarm Node Docker Konteynerinin Dağıtılması¶
Sadece ortam değişkenleri ile yapılandırılmış konteynerleştirilmiş Wallarm filtreleme node'unu dağıtmak için GCP Console veya gcloud CLI kullanabilirsiniz. Bu talimatlarda gcloud CLI tercih edilmiştir.
-
Get Wallarm token of the appropriate type:
-
Instance'ı Wallarm Cloud'a bağlamak için kullanılacak Wallarm node token'ı ile yerel ortam değişkenini ayarlayın:
-
gcloud compute instances create-with-container
komutunu kullanarak Docker konteynerinin çalıştığı instance'ı oluşturun:gcloud compute instances create-with-container <INSTANCE_NAME> \ --zone <DEPLOYMENT_ZONE> \ --tags http-server \ --container-env WALLARM_API_TOKEN=${WALLARM_API_TOKEN} \ --container-env NGINX_BACKEND=<HOST_TO_PROTECT_WITH_WALLARM> \ --container-env WALLARM_API_HOST=us1.api.wallarm.com \ --container-image registry-1.docker.io/wallarm/node:5.3.0
<INSTANCE_NAME>
: instance'ın adı, örneğin:wallarm-node
.--zone
: instance'ı barındıracak zone.--tags
: instance etiketleri. Etiketler, instance'ın diğer kaynaklarla uyumluluğunu yapılandırmak için kullanılır. Bu örnekte, 80 nolu portu açmak üzerehttp-server
etiketi instance'a atanır.--container-image
: Filtreleme düğümünün Docker görüntüsüne bağlantı.-
--container-env
: Filtreleme düğümü yapılandırması için ortam değişkenleri (kullanılabilir değişkenler aşağıdaki tabloda listelenmiştir). LütfenWALLARM_API_TOKEN
değerinin açıkça geçirilmesinin önerilmediğini unutmayın.Environment variable Description Required WALLARM_API_TOKEN
Wallarm node or API token. Yes WALLARM_LABELS
Available starting from node 4.6. Works only if
WALLARM_API_TOKEN
is set to API token with theDeploy
role. Sets thegroup
label for node instance grouping, for example:WALLARM_LABELS="group=<GROUP>"
...will place node instance into the
<GROUP>
instance group (existing, or, if does not exist, it will be created).Yes (for API tokens) NGINX_BACKEND
Domain or IP address of the resource to protect with the Wallarm solution. Yes WALLARM_API_HOST
Wallarm API server: us1.api.wallarm.com
for the US Cloudapi.wallarm.com
for the EU Cloud
api.wallarm.com
.No WALLARM_MODE
Node mode: block
to block malicious requestssafe_blocking
to block only those malicious requests originated from graylisted IP addressesmonitoring
to analyze but not block requestsoff
to disable traffic analyzing and processing
monitoring
.
Detailed description of filtration modes →No WALLARM_APPLICATION
Unique identifier of the protected application to be used in the Wallarm Cloud. The value can be a positive integer except for 0
.
Default value (if the variable is not passed to the container) is-1
which indicates the default application displayed in Wallarm Console → Settings → Application.
More details on setting up applications →No SLAB_ALLOC_ARENA
(TARANTOOL_MEMORY_GB
[NGINX Node 5.x and earlier][what-is-new-wstore])Amount of memory allocated to wstore. The value can be a float (a dot .
is a decimal separator). By default: 1.0 (1 gygabyte).No NGINX_PORT
Sets a port that NGINX will use inside the Docker container.
Starting from the Docker image4.0.2-1
, thewallarm-status
service automatically runs on the same port as NGINX.
Default value (if the variable is not passed to the container) is80
.
Syntax isNGINX_PORT='443'
.No WALLARM_STATUS_ALLOW
Custom CIDRs that are allowed to access the /wallarm-status
endpoint from outside the Docker container. Example value:10.0.0.0/8
. If you need to pass several values, use a comma,
as a separator. To access the service externally, use the Docker container's IP, specifying the/wallarm-status
endpoint path.No DISABLE_IPV6
The variable with any value except for an empty one deletes the listen [::]:80 default_server ipv6only=on;
line from the NGINX configuration file which will stop NGINX from IPv6 connection processing.
If the variable is not specified explicitly or has an empty value""
, NGINX processes both IPv6 and IPv4 connections.No WALLARM_APIFW_ENABLE
This setting toggles API Specification Enforcement on or off, available from release 4.10 onwards. Please note that activating this feature does not substitute for the required subscription and configuration through the Wallarm Console UI.
Its default value istrue
, enabling the functionality.No WALLARM_APID_ONLY
(5.3.7 and higher)In this mode, attacks detected in your traffic are blocked locally by the node (if enabled) but not exported to Wallarm Cloud. Meanwhile, API Discovery and some other features remain fully functional, detecting your API inventory and uploading it to the Cloud for visualization. This mode is for those who want to review their API inventory and identify sensitive data first, and plan controlled attack data export accordingly. However, disabling attack export is rare, as Wallarm securely processes attack data and provides sensitive attack data masking if needed. More details
By default:false
.No -
gcloud compute instances create-with-container
komutunun tüm parametreleri GCP dokümantasyonunda açıklanmıştır.
-
GCP Console → Compute Engine → VM instances açarak instance'ın listede göründüğünden emin olun.
Bağlanmış Dosya Üzerinden Yapılandırılmış Wallarm Node Docker Konteynerinin Dağıtılması¶
Ortam değişkenleri ile ve bağlanmış dosya üzerinden yapılandırılmış konteynerleştirilmiş Wallarm filtreleme node'unu dağıtmak için, instance'ı oluşturmalı, bu instance dosya sisteminde filtreleme düğümü yapılandırma dosyasını bulmalı ve Docker konteynerini çalıştırmalısınız. Bu adımları GCP Console veya gcloud CLI ile gerçekleştirebilirsiniz. Bu talimatlarda gcloud CLI kullanılmaktadır.
-
Get Wallarm token of the appropriate type:
-
Compute Engine kayıt defterindeki herhangi bir işletim sistemi görüntüsünü temel alarak,
gcloud compute instances create
komutunu kullanarak instance'ı oluşturun:gcloud compute instances create <INSTANCE_NAME> \ --image <PUBLIC_IMAGE_NAME> \ --zone <DEPLOYMENT_ZONE> \ --tags http-server
<INSTANCE_NAME>
: instance'ın adı.--image
: Compute Engine kayıt defterindeki işletim sistemi görüntüsünün adı. Oluşturulan instance bu görüntüye dayalı olacak ve daha sonra Docker konteynerini çalıştırmak için kullanılacaktır. Bu parametre atlanırsa, instance Debian 10 görüntüsüne dayalı oluşturulacaktır.--zone
: instance'ı barındıracak zone.--tags
: Instance etiketleri. Bu etiketler, instance'ın diğer kaynaklarla uyum içinde kullanılmasını sağlamak içindir. Bu örnekte, 80 nolu portu açmak üzerehttp-server
etiketi instance'a atanır.gcloud compute instances create
komutunun tüm parametreleri GCP dokümantasyonunda açıklanmıştır.
-
GCP Console → Compute Engine → VM instances açarak instance'ın listede göründüğünden ve RUNNING durumunda olduğundan emin olun.
-
GCP dokümantasyonundaki SSH bağlantısı talimatlarını izleyerek instance'a SSH ile bağlanın.
-
Uygun işletim sistemi için talimatları izleyerek instance üzerinde Docker paketlerini kurun.
-
Instance'ı Wallarm Cloud'a bağlamak için kullanılacak Wallarm node token'ı ile yerel ortam değişkenini ayarlayın:
-
Instance içinde, filtreleme düğümü yapılandırmasını içeren
default
dosyasını barındıracak bir dizin oluşturun (örneğin, dizin adıconfigs
olabilir). Minimal ayarları içeren dosya örneği:server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; #listen 443 ssl; server_name localhost; #ssl_certificate cert.pem; #ssl_certificate_key cert.key; root /usr/share/nginx/html; index index.html index.htm; wallarm_mode monitoring; # wallarm_application 1; location / { proxy_pass http://example.com; include proxy_params; } }
Yapılandırma dosyasında belirtilmesi mümkün filtreleme düğümü yönergeleri seti →
-
Geçilen ortam değişkenleri ve bağlanmış yapılandırma dosyası ile
docker run
komutunu kullanarak Wallarm node Docker konteynerini çalıştırın:<INSTANCE_PATH_TO_CONFIG>
: Bir önceki adımda oluşturulan yapılandırma dosyasının yolu. Örneğin,configs
.-
<DIRECTORY_FOR_MOUNTING>
: Yapılandırma dosyasının konteyner içine monte edileceği dizin. Yapılandırma dosyaları, NGINX tarafından kullanılan aşağıdaki konteyner dizinlerine monte edilebilir:/etc/nginx/conf.d
— Ortak ayarlar/etc/nginx/sites-enabled
— Sanal host ayarları/var/www/html
— Statik dosyalar
Filtreleme düğümü yönergeleri,
/etc/nginx/sites-enabled/default
dosyasında belirtilmelidir. -
-p
: Filtreleme düğümünün dinlediği port. Değer, instance portu ile aynı olmalıdır. -
-e
: Filtreleme düğümü yapılandırması için ortam değişkenleri (kullanılabilir değişkenler aşağıdaki tabloda listelenmiştir). LütfenWALLARM_API_TOKEN
değerinin açıkça geçirilmesinin önerilmediğini unutmayın.Environment variable Description Required WALLARM_API_TOKEN
Wallarm node or API token. Yes WALLARM_API_HOST
Wallarm API server: us1.api.wallarm.com
for the US Cloudapi.wallarm.com
for the EU Cloud
api.wallarm.com
.No WALLARM_LABELS
Available starting from node 4.6. Works only if
WALLARM_API_TOKEN
is set to API token with theDeploy
role. Sets thegroup
label for node instance grouping, for example:WALLARM_LABELS="group=<GROUP>"
...will place node instance into the
<GROUP>
instance group (existing, or, if does not exist, it will be created).Yes (for API tokens) SLAB_ALLOC_ARENA
(TARANTOOL_MEMORY_GB
[NGINX Node 5.x and earlier][what-is-new-wstore])Amount of memory allocated to wstore. The value can be a float (a dot .
is a decimal separator). By default: 1.0 (1 gygabyte).No WALLARM_APID_ONLY
(5.3.7 and higher)In this mode, attacks detected in your traffic are blocked locally by the node (if enabled) but not exported to Wallarm Cloud. Meanwhile, API Discovery and some other features remain fully functional, detecting your API inventory and uploading it to the Cloud for visualization. This mode is for those who want to review their API inventory and identify sensitive data first, and plan controlled attack data export accordingly. However, disabling attack export is rare, as Wallarm securely processes attack data and provides sensitive attack data masking if needed. More details
By default:false
.No
Filtreleme Düğümünün Çalışmasını Test Etme¶
-
GCP Console → Compute Engine → VM instances açın ve External IP sütunundan instance IP adresini kopyalayın.
Eğer IP adresi boşsa, lütfen instance'ın RUNNING durumunda olduğundan emin olun.
-
Kopyaladığınız adrese test Path Traversal saldırısı içeren isteği gönderin:
-
Wallarm Console → Attacks bölümünü, US Cloud veya EU Cloud üzerinden açın ve saldırının listede göründüğünden emin olun.
Konteyner dağıtımı sırasında oluşan hataların detayları, instance menüsündeki View logs bölümünde görüntülenir. Instance erişilemezse, lütfen konteynere doğru değerlerle gerekli filtreleme düğümü parametrelerinin geçirildiğinden emin olun.