How to Configure Azure Virtual Server for a WAF to Use Appdome MOBILEBot Defense

Last updated November 29, 2023 by Appdome


Web Application Firewalls (WAFs) play a crucial role in protecting web applications from a wide range of cyber threats. When combined with Appdome’s MOBILEBot™ Defense solution, businesses can achieve an unparalleled level of protection for their mobile applications. This article will guide you on configuring your Azure Virtual Server to connect to a WAF so it can work seamlessly with Appdome MOBILEBot Defense.

Before delving into the steps, let’s understand some of the terms used:

MTLS (Mutual Transport Layer Security): Mutual TLS (mTLS) is a method for mutual authentication in which both parties in a network connection validate the SSL certificates presented by each other against a trusted root Certificate Authority (CA) certificate.

Client Certificate: In cryptography, a client certificate is a type of digital certificate that is used by client systems to make authenticated requests to a remote server.

Safe Session: Represents sessions that are determined to be safe or not at risk of any threat.

At Risk Session: Represents sessions that are potentially under threat or have detected anomalies.

Header Payload: The data transferred in the header of HTTP requests or responses. Protecting this data ensures that it cannot be tampered with during transit.

RSA private and public keys: The RSA private key is used to generate digital signatures, and the RSA public key is used to verify digital signatures.

Prerequisites for Using Azure Virtual Server with Appdome-Protected Apps

In order to use the Azure Virtual Server in conjunction with Appdome, you’ll need:

  • A configured and accessible Azure Virtual Linux Server
  • An Android or iOS app secured by Appdome MOBILEBot Defense
  • An Appdome MOBILEBot Defense License

How to Configure the WAF to Parse Safe Session and At Risk Session

When Appdome’s code is integrated into the Azure Virtual Server, it enhances the firewall’s capability to determine the validity of a session. To categorize sessions as “Safe Session” or “At Risk Session”, Appdome’s code analyzes specific headers within incoming requests: Timestamp, Nonce, and SignedMessage. The Timestamp header allows Appdome’s code to detect potential delay attacks by comparing the request’s timestamp with the server’s time. The Nonce, a unique random value, ensures the uniqueness of each request, protecting against replay attacks. The SignedMessage, typically an RSA-encrypted SHA256 hash of the timestamp, nonce, and a shared secret, ensures the integrity of the request.

Getting Started with Azure Virtual Server Setup and Configuration

Follow these steps to configure a Linux server on GCP and Azure, and launch a Docker container with open network settings.

Note: Make sure to replace placeholders such as YOUR_VM_NAME, your-docker-image, your-username, and your-vm-ip with your own custom values and preferences.

Setting up a Linux Server on Azure

  1. Create a Resource Group
    • In the Azure portal, navigate to Resource groups.
    • Create a new resource group to organize your resources.
      To learn more about managing Resource Groups on Azure, please read this article.
  2. Create a Virtual Machine (VM)
    • In the Azure portal, go to Create a resource -> Compute -> Virtual machine
    • Configure your VM instance, including selecting the Linux distribution you prefer (e.g., Ubuntu, CentOS).
      Note: Make sure to allow HTTP/HTTPS traffic when configuring the firewall rules.
  3. SSH into Your VM
    Use SSH to connect to your VM:

    ssh your-username@your-vm-ip
  4. Running a Docker Container on Azure
    Inside your VM, install Docker:

    sudo apt-get update
    sudo apt-get install
  5. Pull and run a Docker container of your choice, exposing the required ports:
    sudo apt-get update

Configure Appdome’s Docker Image

Appdome’s Docker Image is a custom solution to secure apps built on the Appdome platform, with the Anti-Bot service enabled. This service functions within a Docker container that’s based on nginx. To facilitate its operation, users must supply an SSL certificate, a private RSA key, and designated environment variables.

Prerequisites: Familiarity with Docker and UNIX-based machines is beneficial.

How Does It Work?

The service is based on nginx and Lua, it uses the Lua module to decrypt the payload and validate the signature, then it uses the request to be proxied to the AD_TARGET route.

The module can be used with either the built-in LRU cache or with Redis, but it is recommended to use the built-in LRU to reduce the overhead of making the calls to Redis and ease the setup.


The following steps are required to set up the service.

  • Mount SSL certificates to the container, under /etc/ssl/certs/{ssl_certificate.crt, ssl_certificate_key.key}.
  • Mount CA certificate that wil be used for mTLS to the container, under /etc/nginx/client_certs/ca.crt.
  • Mount a private RSA key for payload decryption to the container, the pair to the public key provided in the build process. under /home/lua/private.pem
  • Provide AD_SERVER_NAME – domain to which the service will respond.
  • Provide AD_HOST – host header to override.
  • Provide AD_TARGET – target URL to which the request will be proxied.
  • Provide AD_SHARED_SECRET – shared secret used in the encrypted message.
  • Provide COMPROMISED_SECRET – compromised secret used in the compromised encrypted message.
  • Provide AD_MODULE of redis if you plan on using Redis as the cache. Make sure it is accessible from the container and is located as close as possible to the container, be it on the same network, same availability zone or same server rack.
  • If AD_MODULE is redis, provide AD_REDIS_HOST.

How to run

Setup the following environment variables.

  1. Copy the following files from your local machine onto the VM:
    • Copy SSL certificates to:
    • Copy the Root CA certificate to:
    • Copy a private RSA key for payload decryption, the pair to the public key provided in the build process to:

      Example command:

      scp mykey.key ec2-user@INSTANCE_IP:/home/ec2-user/certs/ssl_certificate_key.key
  2. Connect to your VM, and run the following commands:
    • Pull the docker image from our public repository:
      docker pull

Note: If you are using Radware and Azure, make sure to populate the <server name> field with the domain name that is registered for this service. It needs to be the same server name that was configured in your Radware Origin server setup.

    • Run the docker image with the following command:
      docker run -p 443:443 -p 80:80 \  
      -v "$(pwd)"/certs/ssl:/etc/ssl/ \  
      -v "$(pwd)"/private.pem:/home/lua/private.pem \  
      -v "$(pwd)"/rootCA.crt:/etc/nginx/client_certs/ca.crt \  
      -e AD_SERVER_NAME= <domain to which the service will respond> \  
      -e AD_TARGET= <target URL to which the request will be proxied> \  
      -e AD_HOST= <host header to override> \  
      -e AD_SHARED_SECRET= <shared secret used in the encrypted message> \  
      -e AD_COMPROMISED_SECRET= <compromised secret used in the compromised encrypted message>  \


Integrating Azure Virtual Server with Appdome provides robust protection for mobile apps. By understanding and applying the configurations above, businesses can ensure that their mobile app traffic is both secure and optimized.

Related Articles:

Thank you!

Thanks for visiting Appdome! Our mission is to secure every app on the planet by making mobile app defense easy. We hope we’re living up to the mission with your project. If you don’t already have an account, you can sign up for free.


let's solve it together

JingMaking your security project a success!
By filling out this form, you opt-in to recieve emails from us.