I recently came across a free and highly praised WAF (Web Application Firewall) called SafeLine. After giving it a try, I found it to be a good fit for small website owners, even though there’s room for improvement. It's easy to set up, learn from, and use for basic protection. Without further ado, let's dive into the experience.
Getting Ready
Before starting, here’s what you need:
- A custom website: This can be a site you own or any open-source website for learning purposes.
- A Linux server: Make sure the system version is up-to-date. SafeLine's Docker version requires Docker 20.10.14 or above, so older systems might not support it.
Step 1: Deploy SafeLine
Start by following the official tutorial: SafeLine Installation Guide
To install, log in as root on your server and run the following command:
bash -c "$(curl -fsSLk https://waf.chaitin.com/release/latest/setup.sh)"
Once installation is complete, verify the status using the docker ps
command. The containers should all display as healthy
.
By default, SafeLine runs on port 9443. You can check if SafeLine is listening on this port by running: ss -antp | grep LISTEN
Access the SafeLine dashboard using your server’s IP and port like this: https://<your-ip>:9443
Step 2: Configuring Site Protection
SafeLine WAF works as a reverse proxy, meaning it will hide your original site's IP address. After configuration, all traffic to your site will first go through SafeLine, which inspects and filters it before forwarding it to the original server.
For HTTP, the setup is straightforward—no need to input a domain name, as SafeLine defaults to *
. In my case, I was testing with HTTPS.
After configuration, the basic idea is that SafeLine exposes its IP address and port (in this case, 50005
), and all requests to that port will be forwarded to your site. SafeLine effectively hides the real IP of your web server.
Step 3: Testing for Attacks
Now comes the fun part: testing SafeLine’s ability to block attacks. You can use SafeLine’s SQL injection test:https://chaitin.com/?id=1+and+1=2+union+select+1
Once you’ve run the tests, explore SafeLine’s ability to block various types of malicious requests, such as SQL injections, XSS, and other attacks.
Final Thoughts
SafeLine Community Edition is a powerful free tool for small site owners who want to protect their websites without paying for expensive solutions. It acts as both a reverse proxy and a WAF, providing solid protection against many types of attacks.
GitHub: https://github.com/chaitin/SafeLine
Demo: https://demo.waf.chaitin.com:9443/dashboard
Feel free to test it on your own site and experiment with various security configurations!
Top comments (0)