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/SafeLineDocker 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 thesafeline-luigi,safeline-fvmandsafeline-chaossupporting services - A per-VM
adminaccount with a generated password, created on first boot. SafeLine ships with no default password - Two systemd units:
safeline.service(a oneshot wrapper arounddocker compose up -d) andsafeline-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/tcpfrom your management CIDR, for SSH9443/tcpfrom the CIDR that needs the SafeLine management console80/tcpand443/tcpfrom 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)
Connect over SSH
Connect as azureuser, the default login user. Replace <vm-ip> with the public IP of your VM.
ssh azureuser@<vm-ip>Confirm the services are active
sudo systemctl is-active docker safeline docker --version docker compose versionThe output shows active twice, then the Docker Engine version and the Docker Compose v2 plugin version.
Confirm the SafeLine containers are running
cd /data/safeline && sudo docker compose -f compose.yaml --env-file .env psAll 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.
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/healthA response of 200 confirms the console is up.
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.txtThe file lists safeline.url (where to sign in), safeline.admin.user (admin) and safeline.admin.pass. Store the password somewhere safe.
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.
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.
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' || trueThe output shows the console listening on 9443. PostgreSQL on 5432 is deliberately absent from the host because it lives only on the container network.
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-pagerTo inspect the logs of a specific service, run:
cd /data/safeline && sudo docker compose -f compose.yaml --env-file .env logs --tail 50 mgtTo 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
admincredential withresetadminand 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