Secure Your Website(1)-Quick Installation of "Free WAF" SafeLine

ButterflyI8 - Sep 3 - - Dev Community

Background

I have multiple websites. However, the servers were not equipped with adequate security configurations. Only Nginx was used to intercept irregular requests, prevent hotlinking, and restrict IP access, with the restriction rules added after being attacked. Since we are not specialized in security, our understanding of attack behaviors is limited. Without automation, it is imperative to use security tools for protection.

Research

After comprehensively comparing various WAF tools, we found that SafeLine's ecosystem is relatively complete, offering both free and commercial versions, and is continuously maintained and updated (which is crucial). (There are many open-source WAFs that have not been updated in recent years.)

Introduction of SafeLine

SafeLine Official Website
SafeLine's core detection capabilities are driven by its intelligent semantic analysis algorithm. The project has open-sourced the core engine of the semantic analysis algorithm and related security plugins, but the control panel is not open-sourced. It offers excellent protection effects, rapid project iterations, and a clean and user-friendly interface. Although its functionality is less than the Pro version, it fully meets the basic needs of WAF.

For users with higher security requirements, it is recommended to upgrade to the Pro version, which offers even richer protection features.

  • Protection Effectiveness: It demonstrates good protection against both common and uncommon vulnerabilities, with few false alarms.
  • Technological Advancement: The core technology is the semantic analysis algorithm, which offers higher resilience and better performance compared to regular expression rules.
  • Project Quality: It possesses all the basic capabilities of a WAF. The documentation is relatively complete, and there are discussion groups where staff members actively respond to various questions in a timely manner.
  • Community Recognition: With over 11.3k stars and over 170k installations, it enjoys a high level of community recognition.
  • Community Activity: Continuous updates are provided (with plans for weekly updates for the free version), and the Pro version offers even better support services.

Image description

Installation

Automatic Deploy

Recommended

Use the following command to start the automated installation of SafeLine. (This process requires root privileges)

bash -c "$(curl -fsSLk https://waf.chaitin.com/release/latest/setup.sh)"
After the command is executed, it means the installation is successfully. Please go to Use Web UI directly.

Mannually Deploy

Install Docker

Install the latest version of Docker.

If you already have Docker installed, please skip this step.

curl -sSL "https://get.docker.com/" | bash

Create SafeLine Directory

Create a directory for SafeLine to use, SafeLine will write its configuration and data to this directory. (You need to have at least 5GB of disk space)

mkdir -p "/data/safeline"

Docker Compose Script

Download the latest docker compose script by using the following command.

cd "/data/safeline"
wget "https://waf.chaitin.com/release/latest/compose.yaml"
Write Environment variables
cd "/data/safeline"
touch ".env"
Enter fullscreen mode Exit fullscreen mode

Write the following content in the ".env" file

SAFELINE_DIR=/data/safeline
IMAGE_TAG=latest
MGT_PORT=9443
POSTGRES_PASSWORD={postgres-password}
SUBNET_PREFIX=172.22.222
IMAGE_PREFIX=chaitin
NOTE: Replace the placeholders in the file

  • SAFELINE_DIR: 123
  • IMAGE_TAG: SafeLine version to be used
  • MGT_PORT: Web console port to be used
  • POSTGRES_PASSWORD: Postgres db initialization password
  • SUBNET_PREFIX: SafeLine internal network communication address prefix
  • IMAGE_PREFIX: Mirror repository prefix ### Launch SafeLine Everything is ready to start the SafeLine service.

This process may take several minutes, so don't worry.
docker compose up -d

Use Web UI

Open the web console page https://:9443/ in the browser, then you will see below.

Image description

Get Administrator Account

docker exec safeline-mgt resetadmin
After the command is successfully executed, you will see the following content
Please must remember this content

[SafeLine] Initial username:admin
[SafeLine] Initial password:**********
[SafeLine] Done
Enter fullscreen mode Exit fullscreen mode

Login

Enter the password in the previous step and you will successfully logged into SafeLine.

Image description

. . . . . . . . .
Terabox Video Player