انتقل إلى المحتوى

تشغيل صورة Docker المبنية على Envoy لـ Wallarm

تصف هذه التعليمات الخطوات لتشغيل صورة Docker الخاصة بـ Wallarm والمبنية على Envoy 1.18.4. تحتوي الصورة على كل الأنظمة المطلوبة لتشغيل عقدة Wallarm بشكل صحيح:

  • خدمات الوكيل Envoy مع وحدة Wallarm المدمجة

  • وحدات Tarantool للتحليلات بعد الحدث

  • خدمات وسكربتات أخرى

تم تصميم وحدة Wallarm كفلتر HTTP لـ Envoy لتوكيل الطلبات.

المعلمات التكوينية المدعومة

يرجى العلم بأن معظم المديريات الخاصة بتكوين عقدة التصفية المبنية على 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:

متغير البيئة الوصف مطلوب
WALLARM_API_TOKEN رمز عقدة أو API الخاص بـ Wallarm. نعم
ENVOY_BACKEND نطاق أو عنوان IP للمورد المراد حمايته بواسطة حل Wallarm. نعم
WALLARM_API_HOST خادم API Wallarm:
  • us1.api.wallarm.com للسحابة الأمريكية
  • api.wallarm.com للسحابة الأوروبية
الافتراضي: api.wallarm.com.
لا
WALLARM_MODE وضع العقدة:
  • block لحجب الطلبات الخبيثة
  • safe_blocking لحجب الطلبات الخبيثة الصادرة من عناوين IP في القائمة الرمادية فقط
  • monitoring لتحليل الطلبات دون حجبها
  • off لتعطيل تحليل ومعالجة الحركة
الافتراضي: monitoring.
وصف مفصل لأوضاع التصفية →
لا
WALLARM_LABELS

متاح بدءًا من العقدة 4.6. يعمل فقط إذا تم ضبط WALLARM_API_TOKEN على رمز API بدور التوزيع. يضبط تصنيف group لتجميع نماذج عقدة، على سبيل المثال:

WALLARM_LABELS="group=<GROUP>"

...سيضع نموذج العقدة في مجموعة النماذج <GROUP> (موجودة، أو، إذا لم تكن موجودة، سيتم إنشاؤها).

نعم (لرموز API)
TARANTOOL_MEMORY_GB كمية الذاكرة المخصصة لـ Tarantool. يمكن أن تكون القيمة عددًا صحيحًا أو عائمًا (النقطة . هي فاصلة عشرية). بشكل افتراضي: 0.2 غيغابايت. لا

الأمر يقوم بما يلي:

  • ينشئ ملف envoy.yaml بتكوين Envoy الأدنى في دليل /etc/envoy الخاص بالحاوية.

  • ينشئ ملفات بأوراق اعتماد عقدة التصفية للوصول إلى سحابة Wallarm في دليل /etc/wallarm الخاص بالحاوية:

    • node.yaml بـ UUID العقدة ومفتاح السر.
    • private.key بمفتاح Wallarm الخاص.
  • يحمي المورد http://ENVOY_BACKEND:80.

تشغيل الحاوية بتركيب envoy.yaml

يمكنك تركيب ملف envoy.yaml الجاهز إلى حاوية Docker عبر الخيار -v. يجب أن يحتوي الملف على الإعدادات التالية:

لتشغيل الحاوية:

  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 يمرر المتغيرات البيئية المطلوبة التالية إلى الحاوية:
    متغير البيئة الوصف مطلوب
    WALLARM_API_TOKEN رمز عقدة Wallarm.

    استخدام رمز واحد لعدة تثبيتات

    يمكنك استخدام رمز واحد في عدة تثبيتات بغض النظر عن النظام الأساسي المختار platform. يسمح ذلك بتجميع منطقي لنماذج العقد في واجهة استخدام Wallarm. مثال: تقوم بنشر عدة عقد Wallarm في بيئة تطوير، كل عقدة على جهاز خاص بمطور معين.

    نعم
    WALLARM_API_HOST خادم API Wallarm:
    • us1.api.wallarm.com للسحابة الأمريكية
    • api.wallarm.com للسحابة الأوروبية
    الافتراضي: api.wallarm.com.
    لا
    • الخيار -v يركب دليل الملف التكويني envoy.yaml إلى دليل /etc/envoy الخاص بالحاوية.

الأمر يقوم بما يلي:

  • يركب ملف envoy.yaml إلى دليل /etc/envoy الخاص بالحاوية.

  • ينشئ ملفات بأوراق اعتماد عقدة التصفية للولوج إلى سحابة Wallarm في دليل /etc/wallarm الخاص بالحاوية:

    • 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 other aspects of the node functioning.