Deployment guide

SafeLine

Overview

SafeLine is a self-hosted Web Application Firewall and reverse proxy that protects web applications from attacks and exploits. Instead of matching requests against long lists of regular-expression signatures, its semantic detection engine parses each request the way the target application would. It recognises the intent behind SQL injection, cross-site scripting, command injection, path traversal and other common web attacks, and lets legitimate traffic through.

You place a protected site in front of your upstream server and choose the port it listens on. Every request is inspected before it reaches your application, and attacks are answered with a branded interception page. This SecureAnyCloud image installs SafeLine 9.3.10 as the official Chaitin SafeLine Docker Compose stack and runs it as a systemd service, so a working management console and WAF are online within minutes of launch.

What you get:

  • SafeLine 9.3.10 (GPL-3.0) deployed from the official chaitin/SafeLine Docker Compose stack, pinned to the v9.3.10 images so the image never silently upgrades
  • Docker Engine (Docker CE) and the Docker Compose plugin, installed from the official Docker package repository
  • The SafeLine Compose stack of seven containers: safeline-mgt (the management API and web console, published on host port 9443 over HTTPS), safeline-tengine (the tengine reverse proxy that filters traffic to your protected sites), safeline-detector (the semantic detection engine), safeline-pg (PostgreSQL, the management database, reachable only on the internal container network), and the safeline-luigi, safeline-fvm and safeline-chaos supporting services
  • A per-VM admin account with a generated password, created on first boot. SafeLine ships with no default password
  • Two systemd units: safeline.service (a oneshot wrapper around docker compose up -d) and safeline-firstboot.service
  • 24/7 SecureAnyCloud support

Prerequisites

You need an active Azure subscription, an SSH key, and a VNet with a subnet. The recommended size is Standard_B2s (2 vCPU / 4 GB RAM).

Configure the network security group (NSG) with these inbound rules:

  • 22/tcp from your management CIDR, for SSH
  • 9443/tcp from the CIDR that needs the SafeLine management console
  • 80/tcp and 443/tcp from the internet, for the web traffic you want the WAF to protect (SafeLine's tengine proxy binds the listen ports of the sites you add)
1

Connect over SSH

Connect as azureuser, the default login user. Replace <vm-ip> with the public IP of your VM.

ssh azureuser@<vm-ip>
2

Confirm the services are active

sudo systemctl is-active docker safeline docker --version docker compose version

The output shows active twice, then the Docker Engine version and the Docker Compose v2 plugin version.

3

Confirm the SafeLine containers are running

cd /data/safeline && sudo docker compose -f compose.yaml --env-file .env ps

All seven SafeLine containers should be in the Up / running state: safeline-mgt, safeline-tengine, safeline-detector, safeline-pg, safeline-luigi, safeline-fvm and safeline-chaos.

4

Confirm the management console is healthy

The management console is served over HTTPS on port 9443. It exposes an unauthenticated health endpoint that returns HTTP 200 when SafeLine is ready. The console uses a self-signed certificate on first launch, so the command below passes -k to curl.

curl -ks -o /dev/null -w "%{http_code}\n" https://localhost:9443/api/open/health

A response of 200 confirms the console is up.

5

Read the per-VM admin credentials

SafeLine has no default password. On first boot, your instance creates a unique admin credential and writes it to a root-only file. Read it with sudo:

sudo cat /root/safeline-credentials.txt

The file lists safeline.url (where to sign in), safeline.admin.user (admin) and safeline.admin.pass. Store the password somewhere safe.

6

Sign in to the SafeLine console

Browse to https://<vm-ip>:9443/. The console uses a self-signed certificate on first launch, so your browser warns once. Accept the warning to continue.

On the first visit, SafeLine shows a one-time software licence agreement. Read it and choose Agree, start using. On the sign-in page, log in with the username admin and the safeline.admin.pass from Step 5.

After you sign in, the Statistics dashboard summarises request volume, blocked attacks, the geographic origin of traffic and the current security posture. SafeLine recommends binding an authenticator app for two-factor authentication on first sign-in. You can do this from Auth at any time.

7

Protect your first web application

To put SafeLine in front of a web application, open Applications in the console and choose Add Application.

Enter the domain (or Match All Host), the port SafeLine should listen on (for example 80 or 443), and the upstream address of your origin server (for example http://127.0.0.1:8080 or http://10.0.0.4:3000).

SafeLine's tengine proxy then binds that port. The detection engine inspects every request before it reaches your origin.

8

How SafeLine blocks attacks

Once a site is protected, SafeLine passes clean traffic straight through to your origin and intercepts attacks. A benign request returns your application's normal response. An obvious SQL injection or cross-site scripting probe is answered with an HTTP 403 interception page and never reaches your origin.

The visitor who sends the malicious request sees SafeLine's branded interception page. It carries a unique event id, which also appears in the console under Attacks.

Secure by default

The management console requires authentication, and a wrong password is rejected. The PostgreSQL database is bound to the internal container network only and is never published on a host port. To check which ports are exposed on the host, run:

sudo ss -tlnp | grep -E ':9443|:5432' || true

The output shows the console listening on 9443. PostgreSQL on 5432 is deliberately absent from the host because it lives only on the container network.

9

Manage the stack

The safeline.service systemd unit manages the whole stack. It wraps docker compose under /data/safeline.

sudo systemctl restart safeline.service
sudo systemctl status safeline.service --no-pager

To inspect the logs of a specific service, run:

cd /data/safeline && sudo docker compose -f compose.yaml --env-file .env logs --tail 50 mgt

To create a fresh admin credential, run sudo docker exec safeline-mgt resetadmin. It prints a new username and password.

Enabling HTTPS on your own domain

The management console already serves HTTPS on port 9443 with a self-signed certificate. For the sites you protect, add your own TLS certificate under Certificates in the console and bind it to the site. SafeLine then terminates HTTPS for your application on port 443. Add 443/tcp to your NSG inbound rules.

First-boot security model

On the first boot of each VM, safeline-firstboot.service runs once and does the following:

  • Regenerates the PostgreSQL password and initialises the database clean, so no build-time database or secret ships in the image
  • Creates a fresh, strong admin credential with resetadmin and writes it to /root/safeline-credentials.txt (root-only, mode 0600)
  • Records a sentinel so the stack only starts once the credential has been rotated

No shared or default login and no preexisting protected site ship in the image. This per-VM credential protects the management console the moment it comes up.

Support

24/7 technical support is included. Contact SecureAnyCloud at sales@secureanycloud.com for help with deployment, protecting your applications, the detection engine and custom rules, rate limiting, bot and authentication defence, TLS certificates and custom domains, and the SafeLine Open API.

SafeLine is a trademark of Beijing Chaitin Technology Co., Ltd. PostgreSQL is a trademark of the PostgreSQL Community Association of Canada. Docker is a trademark of Docker, Inc. All other product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.

Deploy on Azure

Launch SafeLine 9.3.10 on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View this image

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure