<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Lulu</title>
    <description>The latest articles on DEV Community by Lulu (@lulu_liu_c90f973e2f954d7f).</description>
    <link>https://dev.to/lulu_liu_c90f973e2f954d7f</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1727122%2F53dd7966-b3bb-45a6-93de-d26563277b50.png</url>
      <title>DEV Community: Lulu</title>
      <link>https://dev.to/lulu_liu_c90f973e2f954d7f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lulu_liu_c90f973e2f954d7f"/>
    <language>en</language>
    <item>
      <title>Do You Have a Website? Are You Worried About Hackers Attacking It?</title>
      <dc:creator>Lulu</dc:creator>
      <pubDate>Sat, 14 Sep 2024 07:16:41 +0000</pubDate>
      <link>https://dev.to/lulu_liu_c90f973e2f954d7f/do-you-have-a-website-are-you-worried-about-hackers-attacking-it-lme</link>
      <guid>https://dev.to/lulu_liu_c90f973e2f954d7f/do-you-have-a-website-are-you-worried-about-hackers-attacking-it-lme</guid>
      <description>&lt;p&gt;Did you know that &lt;strong&gt;30% of all traffic on the internet&lt;/strong&gt; comes from malicious attacks? If you’ve done web development or managed a website, you’re probably familiar with terms like &lt;strong&gt;SQL injection&lt;/strong&gt;, &lt;strong&gt;CC attacks&lt;/strong&gt;, &lt;strong&gt;XSS&lt;/strong&gt;, and &lt;strong&gt;WebShell&lt;/strong&gt;. If your website logs show strange, suspicious requests, it could be a sign that hackers are already targeting your site.&lt;/p&gt;

&lt;p&gt;Today, I’d like to recommend &lt;strong&gt;SafeLine&lt;/strong&gt;, a highly regarded web protection tool in the security community. Simply put, it’s an enhanced version of Nginx with built-in security features. Developed using industry-leading &lt;strong&gt;semantic analysis detection technology&lt;/strong&gt;, SafeLine acts as a reverse proxy, protecting your website from hacker attacks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp38ie90oxcmr1ci5hx5w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp38ie90oxcmr1ci5hx5w.png" alt="Image description" width="800" height="468"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SafeLine is backed by Chaitin Technology, a company with deep expertise in web security. Since 2015, they’ve been delivering commercial WAF (Web Application Firewall) solutions. Now, they’ve released an &lt;strong&gt;open-source version of SafeLine&lt;/strong&gt;, making key features like its detection algorithms, communication protocols, and plugins available to the public. Although the control panel isn’t open-sourced, this doesn’t affect its usability. &lt;/p&gt;

&lt;p&gt;You can check out the project on &lt;strong&gt;GitHub&lt;/strong&gt;:  &lt;a href="https://github.com/chaitin/safeline" rel="noopener noreferrer"&gt;https://github.com/chaitin/safeline&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation Experience
&lt;/h3&gt;

&lt;p&gt;SafeLine offers various deployment options on its official website, with the simplest being a &lt;strong&gt;one-click installation&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/chaitin/SafeLine.git
&lt;span class="nb"&gt;cd &lt;/span&gt;SafeLine
bash ./release/latest/setup.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the command is executed, open your browser and visit &lt;code&gt;127.0.0.1:9443&lt;/code&gt; to access the SafeLine control panel, where you can log in and start using it immediately.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgta8tidegbjy82wx6hn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgta8tidegbjy82wx6hn.png" alt="Image description" width="800" height="467"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Features from Leading Tech Companies:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Attack Logs:&lt;/strong&gt; View logs and statistics of hacker attacks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Access Control:&lt;/strong&gt; Configure blacklists and whitelists based on IP, Host, Path, Header, and Body.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rate Limiting:&lt;/strong&gt; Limit client access based on IP and session to effectively defend against CC attacks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Human vs Bot Verification:&lt;/strong&gt; Detect whether a client is a human or a bot, helping to block web crawlers and automated attacks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Semantic Analysis Engine:&lt;/strong&gt; An enterprise-grade detection engine with high performance, capable of &lt;strong&gt;0-day protection&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Real-World Testing
&lt;/h3&gt;

&lt;p&gt;How does SafeLine perform in a production environment?&lt;br&gt;
To test its effectiveness, I used &lt;strong&gt;blazeHTTP&lt;/strong&gt;, an attack validation tool, to launch attacks against a website protected by SafeLine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa3e0su8ap0y9ao0g6l79.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa3e0su8ap0y9ao0g6l79.png" alt="Image description" width="800" height="242"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The results were impressive: SafeLine achieved an accuracy rate of &lt;strong&gt;over 99%&lt;/strong&gt;, while maintaining a processing latency of under &lt;strong&gt;1 millisecond&lt;/strong&gt;. These numbers outperform even the enterprise-level WAF solutions provided by major security vendors.&lt;/p&gt;

&lt;h3&gt;
  
  
  Unique Features
&lt;/h3&gt;

&lt;p&gt;SafeLine, developed over a span of &lt;strong&gt;10 years&lt;/strong&gt;, is a &lt;strong&gt;next-generation web application firewall&lt;/strong&gt;. Its detection engine is powered by &lt;strong&gt;intelligent semantic analysis&lt;/strong&gt;, which interprets the behavioral patterns of attacks to recognize and block them effectively.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Traditional WAF&lt;/th&gt;
&lt;th&gt;SafeLine&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ease of Use&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Complex configuration, prone to errors&lt;/td&gt;
&lt;td&gt;Simple and user-friendly, shields complex underlying security details&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Free version is insufficient, professional version is expensive&lt;/td&gt;
&lt;td&gt;Free community version, fully sufficient for personal sites&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Performance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Performance degrades significantly, good results require professional hardware&lt;/td&gt;
&lt;td&gt;Latency under 1ms, single-core TPS over 2000, no need for specialized hardware&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  In Conclusion
&lt;/h3&gt;

&lt;p&gt;SafeLine is a &lt;strong&gt;simple to use&lt;/strong&gt;, &lt;strong&gt;powerful&lt;/strong&gt;, and &lt;strong&gt;free&lt;/strong&gt; WAF that you can trust for website security. As the only next-gen WAF to have been showcased at the &lt;strong&gt;Black Hat Arsenal&lt;/strong&gt;, its security credentials are solid.&lt;/p&gt;

&lt;p&gt;Check it out on GitHub and give it a &lt;strong&gt;star&lt;/strong&gt; if you’re interested:&lt;a href="https://github.com/chaitin/safeline" rel="noopener noreferrer"&gt;https://github.com/chaitin/safeline&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>webdev</category>
      <category>opensource</category>
      <category>waf</category>
    </item>
    <item>
      <title>Why You Need This Decade-Old Open-Source WAF for Ultimate Web Protection</title>
      <dc:creator>Lulu</dc:creator>
      <pubDate>Sat, 14 Sep 2024 03:49:45 +0000</pubDate>
      <link>https://dev.to/lulu_liu_c90f973e2f954d7f/why-you-need-this-decade-old-open-source-waf-for-ultimate-web-protection-2b2</link>
      <guid>https://dev.to/lulu_liu_c90f973e2f954d7f/why-you-need-this-decade-old-open-source-waf-for-ultimate-web-protection-2b2</guid>
      <description>&lt;p&gt;Here’s a strong recommendation for an open-source WAF (Web Application Firewall) that’s been developed for nearly 10 years. It comes in both community and professional editions, and the community edition(free) is more than capable of handling most use cases.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fayxz115bfdwa89xsj54t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fayxz115bfdwa89xsj54t.png" alt="Image description" width="800" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. What is a WAF?
&lt;/h3&gt;

&lt;p&gt;Let’s start with the basics for those who might not be familiar:&lt;br&gt;&lt;br&gt;
A &lt;strong&gt;WAF (Web Application Firewall)&lt;/strong&gt; is a security solution deployed in front of websites at the application layer, offering protection through the following features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Web Vulnerability Protection:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Detects and blocks common web attacks like SQL injection, XSS (cross-site scripting), and more via predefined rules.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Anti-CC Attack:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Provides protection against large-scale attacks like DDoS by filtering malicious traffic.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Access Control:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Allows filtering based on IP address, region, or suspicious requests.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Security Policy Enforcement:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Ensures input validation and error masking based on security standards like OWASP and PCI-DSS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Encrypted Communication:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Supports SSL certificates and HTTPS traffic control to secure communication.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  2. Introducing Safeline WAF
&lt;/h3&gt;

&lt;p&gt;Today, I’m recommending &lt;strong&gt;Safeline&lt;/strong&gt;, a WAF developed by Chaitin Technology over the last 10 years. Powered by an intelligent semantic analysis algorithm, it’s built for the community, and its robust detection capabilities ensure hackers won’t breach your defenses.&lt;/p&gt;
&lt;h4&gt;
  
  
  Installation
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Operating System:&lt;/strong&gt; Linux
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Architecture:&lt;/strong&gt; x86_64
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Software Dependencies:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Docker version 20.10.6 or higher
&lt;/li&gt;
&lt;li&gt;Docker Compose version 2.0.0 or higher
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Minimal Setup:&lt;/strong&gt; 1 CPU core, 1 GB RAM, 10 GB disk space&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can install it with just one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bash &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-fsSLk&lt;/span&gt; https://waf.chaitin.com/release/latest/setup.sh&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To log into the management console, open your browser and visit &lt;code&gt;https://&amp;lt;your-ip&amp;gt;:9443&lt;/code&gt;. Follow the instructions on the screen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0fh5zsaz8cfl19ygvqmw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0fh5zsaz8cfl19ygvqmw.png" alt="Image description" width="800" height="612"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you can access GitHub, download it directly from: &lt;a href="https://github.com/chaitin/safeline" rel="noopener noreferrer"&gt;https://github.com/chaitin/safeline&lt;/a&gt;&lt;br&gt;&lt;br&gt;
If GitHub is inaccessible, try the demo at: &lt;a href="https://demo.waf.chaitin.com:9443/dashboard" rel="noopener noreferrer"&gt;https://demo.waf.chaitin.com:9443/dashboard&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Key Features
&lt;/h3&gt;

&lt;p&gt;Here’s a breakdown of Safeline’s major highlights:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ease of Use:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The WAF is containerized for quick deployment with a single command, reducing installation complexity. Pre-configured security settings allow you to use it right out of the box, simplifying management.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Security Performance:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Safeline uses an in-house developed intelligent semantic analysis algorithm to detect unknown threats. It doesn’t rely on traditional signature rules, making it effective against 0-day attacks. The detection is precise with low false-positive rates, offering reliable protection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Detection Performance:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Safeline operates with a rule-free engine and high-efficiency algorithms that keep latency in the millisecond range. Its high concurrency handling allows a single CPU core to support heavy traffic, with excellent horizontal scaling capability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;High Availability:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The WAF’s traffic processing engine is built on Nginx, ensuring stability and reliability. It also comes with a built-in health-check mechanism, providing an impressive uptime of 99.99%.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>opensource</category>
      <category>webdev</category>
      <category>docker</category>
      <category>cybersecurity</category>
    </item>
    <item>
      <title>Protect Your Site from Hackers with SafeLine: A Free and Open-Source WAF</title>
      <dc:creator>Lulu</dc:creator>
      <pubDate>Sat, 14 Sep 2024 03:29:52 +0000</pubDate>
      <link>https://dev.to/lulu_liu_c90f973e2f954d7f/protect-your-site-from-hackers-with-safeline-a-free-and-open-source-waf-abh</link>
      <guid>https://dev.to/lulu_liu_c90f973e2f954d7f/protect-your-site-from-hackers-with-safeline-a-free-and-open-source-waf-abh</guid>
      <description>&lt;p&gt;Today, I want to introduce you to a highly praised open-source Web Application Firewall (WAF) — &lt;strong&gt;&lt;a href="https://demo.waf.chaitin.com:9443/dashboard" rel="noopener noreferrer"&gt;Safeline&lt;/a&gt;&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Safeline is a free, simple-to-use, and powerful WAF that can protect your website from hacker attacks. It’s based on industry-leading semantic detection technology and functions as a reverse proxy, making it easy to integrate into your existing infrastructure. With its intelligent semantic analysis engine, Safeline was built for the community and ensures hackers can’t breach your defenses.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F17u9atnzavctzodhi7sf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F17u9atnzavctzodhi7sf.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F71a9ca58araub4drp9c7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F71a9ca58araub4drp9c7.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Features
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. &lt;strong&gt;Ease of Use&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Safeline is containerized, so you can deploy it with a single command. It’s a zero-cost setup, and its security configuration works out of the box with no manual intervention needed. You can enjoy peace of mind with hands-off security management.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. &lt;strong&gt;Top-Tier Security&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;At the core of Safeline is an industry-first intelligent semantic analysis algorithm. This technology offers precise detection, low false positives, and is difficult to bypass. Because the detection engine doesn’t rely on traditional rule sets, it can effectively handle unknown zero-day attacks without a hitch.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. &lt;strong&gt;High Performance&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Safeline operates with a rule-free engine and a linear detection algorithm, boasting an average request inspection latency of just 1 millisecond. It’s highly scalable too, easily handling over 2,000 TPS (transactions per second) per core. With the right hardware, Safeline can support virtually unlimited traffic.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. &lt;strong&gt;High Availability&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The traffic handling engine is built on Nginx, ensuring both performance and stability. It also comes with a robust health-check mechanism, providing 99.99% uptime for your service.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation Guide
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Requirements
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Operating System&lt;/strong&gt;: Linux&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Architecture&lt;/strong&gt;: x86_64&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Software Dependencies&lt;/strong&gt;: Docker version 20.10.6 or above, Docker Compose version 2.0.0 or above&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Minimal Environment&lt;/strong&gt;: 1 CPU core, 1 GB RAM, 10 GB disk space&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  One-Click Installation
&lt;/h4&gt;

&lt;p&gt;Run this command to install Safeline:&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;p&gt;bash &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-fsSLk&lt;/span&gt; &lt;a href="https://waf.chaitin.com/release/latest/setup.sh" rel="noopener noreferrer"&gt;https://waf.chaitin.com/release/latest/setup.sh&lt;/a&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Quick Setup&lt;br&gt;
&lt;/h4&gt;

&lt;p&gt;Open your browser and go to &lt;code&gt;https://&amp;lt;your-ip&amp;gt;:9443&lt;/code&gt; to access the admin panel. Follow the on-screen instructions to log in.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu6a1i7vgzh7836usujd7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu6a1i7vgzh7836usujd7.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Configure Your Protected Sites
&lt;/h4&gt;

&lt;p&gt;Safeline works as a reverse proxy, intercepting traffic before it reaches your web server. It detects and filters out malicious requests, forwarding only clean traffic to your server.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fecbgzi310gq6zcz4d5ym.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fecbgzi310gq6zcz4d5ym.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TIP&lt;/strong&gt;: After configuration, use the following command to check if your site is properly set up:&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;p&gt;curl &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Host: &amp;lt;your-domain&amp;gt;"&lt;/span&gt; http://:&amp;lt;port&amp;gt;&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Testing the WAF&lt;br&gt;
&lt;/h3&gt;

&lt;p&gt;To test Safeline’s protection, simulate a hacker attack by visiting the following URLs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;http://&amp;lt;your-IP-or-domain&amp;gt;:&amp;lt;port&amp;gt;/?id=1%20AND%201=1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;http://&amp;lt;your-IP-or-domain&amp;gt;:&amp;lt;port&amp;gt;/?a=&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0rhi60wbqbz5is7ru5st.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0rhi60wbqbz5is7ru5st.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;If you’re looking for a free and open-source WAF, give Safeline a try. It’s a great option for protecting your website from the ever-growing threat of hacker attacks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Official Website: &lt;a href="https://waf.chaitin.com" rel="noopener noreferrer"&gt;https://waf.chaitin.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;GitHub Repository: &lt;a href="https://github.com/chaitin/safeline" rel="noopener noreferrer"&gt;https://github.com/chaitin/safeline&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>opensource</category>
      <category>cybersecurity</category>
      <category>docker</category>
      <category>devops</category>
    </item>
    <item>
      <title>How to Configure and Use SafeLine's Syslog for Real-Time Attack Logging</title>
      <dc:creator>Lulu</dc:creator>
      <pubDate>Fri, 13 Sep 2024 11:22:12 +0000</pubDate>
      <link>https://dev.to/lulu_liu_c90f973e2f954d7f/how-to-configure-and-use-safelines-syslog-for-real-time-attack-logging-3hpi</link>
      <guid>https://dev.to/lulu_liu_c90f973e2f954d7f/how-to-configure-and-use-safelines-syslog-for-real-time-attack-logging-3hpi</guid>
      <description>&lt;p&gt;To configure Syslog with &lt;a href="https://waf.chaitin.com" rel="noopener noreferrer"&gt;SafeLine&lt;/a&gt; and ensure real-time synchronization of attack logs to a third-party server, follow the instructions below:&lt;/p&gt;

&lt;h3&gt;
  
  
  Syslog Configuration for SafeLine
&lt;/h3&gt;

&lt;p&gt;1.&lt;strong&gt;Enable Syslog Forwarding&lt;/strong&gt;:&lt;br&gt;&lt;br&gt;
   Go to the &lt;strong&gt;System&lt;/strong&gt; page in SafeLine, and configure the Syslog settings by providing the necessary details. Syslog forwarding uses the &lt;strong&gt;UDP protocol&lt;/strong&gt; and follows the RFC-5424 standard for log formatting.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd62myehvf8p0maws58na.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd62myehvf8p0maws58na.png" alt="Image description" width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2.&lt;strong&gt;Test Syslog Configuration&lt;/strong&gt;:&lt;br&gt;&lt;br&gt;
   After configuring Syslog, click the &lt;strong&gt;Test&lt;/strong&gt; button. If the Syslog server receives the following message, it indicates successful configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   &amp;lt;30&amp;gt;1 2024-03-20T20:02:38+08:00 55ae65e87e75 /matio/mario 1 safeline_event - Connectivity test requested.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Syslog Event Format in SafeLine
&lt;/h3&gt;

&lt;p&gt;SafeLine logs sent via Syslog are formatted in JSON and contain detailed information about each request, including attack events. Below is an example of the SafeLine Syslog event format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scheme"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"http"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"src_ip"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"12.123.123.123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"src_port"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;53008&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"socket_ip"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"10.2.71.103"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"upstream_addr"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"10.2.34.20"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_start_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1712819316749&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"rsp_start_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_end_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1712819316749&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"rsp_end_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"host"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"safeline-ce.chaitin.net"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"method"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"GET"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"query_string"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"event_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"32be0ce3ba6c44be9ed7e1235f9eebab"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"session"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"site_uuid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"35"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"site_url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"http://safeline-ce.chaitin.net:8083"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_detector_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1276d0f467e4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_detect_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;286&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_proxy_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"16912fe30d8f"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_rule_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"m_rule/9bf31c7ff062936a96d3c8bd1f8f2ff3"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_location"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"urlpath"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_payload"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_decode_path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_rule_module"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"m_rule"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_http_body_is_truncate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"rsp_http_body_is_truncate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_skynet_rule_id_list"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;65595&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;65595&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"http_body_is_abandoned"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"country"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"US"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"province"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"city"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"timestamp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1712819316&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"payload"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"location"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"urlpath"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"rule_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"m_rule/9bf31c7ff062936a96d3c8bd1f8f2ff3"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"decode_path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"cookie"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sl-session=Z0WLa8mjGGZPki+QHX+HNQ=="&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"user_agent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"PostmanRuntime/7.28.4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"referer"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"timestamp_human"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2024-04-11 15:08:36"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"resp_reason_phrase"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"module"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"m_rule"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"reason"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"proxy_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"16912fe30d8f"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1276d0f467e4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"dest_port"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;8083&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"dest_ip"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"10.2.34.20"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"urlpath"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/webshell.php"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"protocol"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"http"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"attack_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"backdoor"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"risk_level"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"high"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"deny"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_header_raw"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"GET /webshell.php HTTP/1.1&lt;/span&gt;&lt;span class="se"&gt;\r\n&lt;/span&gt;&lt;span class="s2"&gt;Host: safeline-ce.chaitin.net:8083&lt;/span&gt;&lt;span class="se"&gt;\r\n&lt;/span&gt;&lt;span class="s2"&gt;User-Agent: PostmanRuntime/7.28.4&lt;/span&gt;&lt;span class="se"&gt;\r\n&lt;/span&gt;&lt;span class="s2"&gt;Accept: */*&lt;/span&gt;&lt;span class="se"&gt;\r\n&lt;/span&gt;&lt;span class="s2"&gt;Accept-Encoding: gzip, deflate, br&lt;/span&gt;&lt;span class="se"&gt;\r\n&lt;/span&gt;&lt;span class="s2"&gt;Cache-Control: no-cache&lt;/span&gt;&lt;span class="se"&gt;\r\n&lt;/span&gt;&lt;span class="s2"&gt;Cookie: sl-session=Z0WLa8mjGGZPki+QHX+HNQ==&lt;/span&gt;&lt;span class="se"&gt;\r\n&lt;/span&gt;&lt;span class="s2"&gt;Postman-Token: 8e67bec1-6e79-458c-8ee5-0498f3f724db&lt;/span&gt;&lt;span class="se"&gt;\r\n&lt;/span&gt;&lt;span class="s2"&gt;X-Real-Ip: 12.123.123.123&lt;/span&gt;&lt;span class="se"&gt;\r\n&lt;/span&gt;&lt;span class="s2"&gt;SL-CE-SUID: 35&lt;/span&gt;&lt;span class="se"&gt;\r\n\r\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_block_reason"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"web"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_attack_type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"backdoor"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_risk_level"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"high"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"req_action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"deny"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This format includes critical details like the source IP, request method, target URL, detected attack type, risk level, and actions taken by SafeLine.&lt;/p&gt;

&lt;p&gt;By setting up Syslog forwarding in SafeLine, administrators can seamlessly integrate with external monitoring and security systems to analyze attack events and ensure enhanced security management.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub&lt;/strong&gt;:&lt;a href="https://github.com/chaitin/SafeLine" rel="noopener noreferrer"&gt;https://github.com/chaitin/SafeLine&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Website&lt;/strong&gt;:&lt;a href="https://waf.chaitin.com" rel="noopener noreferrer"&gt;https://waf.chaitin.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>webdev</category>
      <category>opensource</category>
      <category>waf</category>
    </item>
    <item>
      <title>How to Set Up SSL Protocols and Cipher Suites with SafeLine WAF</title>
      <dc:creator>Lulu</dc:creator>
      <pubDate>Fri, 13 Sep 2024 10:59:42 +0000</pubDate>
      <link>https://dev.to/lulu_liu_c90f973e2f954d7f/how-to-set-up-ssl-protocols-and-cipher-suites-with-safeline-waf-314i</link>
      <guid>https://dev.to/lulu_liu_c90f973e2f954d7f/how-to-set-up-ssl-protocols-and-cipher-suites-with-safeline-waf-314i</guid>
      <description>&lt;h3&gt;
  
  
  SSL Protocol and Cipher Configuration Guide for SafeLine
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/chaitin/SafeLine" rel="noopener noreferrer"&gt;SafeLine&lt;/a&gt; allows you to configure SSL protocols and encryption settings for your web applications. Below are the steps for setting up SSL certificates, adjusting SSL protocol versions, and customizing SSL cipher suites.&lt;/p&gt;

&lt;h3&gt;
  
  
  SSL Certificate Configuration
&lt;/h3&gt;

&lt;p&gt;If your site requires HTTPS access, you can enable SSL by uploading an SSL certificate when configuring the corresponding port.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Femjug8iiyqd3r49r3c7u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Femjug8iiyqd3r49r3c7u.png" alt="Image description" width="578" height="658"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  SSL Protocol Version Configuration
&lt;/h3&gt;

&lt;p&gt;SafeLine supports several SSL and TLS protocol versions. You can modify the SSL version in the &lt;strong&gt;SSL Protocol&lt;/strong&gt; section, choosing from:&lt;code&gt;TLSv1&lt;/code&gt; &lt;code&gt;TLSv1.1&lt;/code&gt; &lt;code&gt;TLSv1.2&lt;/code&gt; &lt;code&gt;TLSv1.3&lt;/code&gt; &lt;code&gt;SSLv2&lt;/code&gt; &lt;code&gt;SSLv3&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6d85c6btfxmw5igclxrt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6d85c6btfxmw5igclxrt.png" alt="Image description" width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  SSL Cipher Configuration
&lt;/h3&gt;

&lt;p&gt;In some cases, specific SSL encryption algorithms may need to be adjusted due to security concerns or vulnerabilities. SafeLine allows for custom SSL cipher suites. Here are some commonly used SSL cipher combinations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nginx Official Example&lt;/strong&gt;: &lt;code&gt;AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://github.com/cloudflare/sslconfig/blob/master/conf" rel="noopener noreferrer"&gt;Cloudflare Recommended&lt;/a&gt;&lt;/strong&gt;: &lt;code&gt;[ECDHE-ECDSA-AES128-GCM-SHA256|ECDHE-ECDSA-CHACHA20-POLY1305|ECDHE-RSA-AES128-GCM-SHA256|ECDHE-RSA-CHACHA20-POLY1305]:ECDHE+AES128:RSA+AES128:ECDHE+AES256:RSA+AES256:ECDHE+3DES:RSA+3DES&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://wiki.mozilla.org/Security/Server_Side_TLS#Nginx" rel="noopener noreferrer"&gt;Mozilla Modern (TLS 1.3)&lt;/a&gt;&lt;/strong&gt;: &lt;code&gt;TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://wiki.mozilla.org/Security/Server_Side_TLS#Nginx" rel="noopener noreferrer"&gt;Mozilla Intermediate (TLS 1.2)&lt;/a&gt;&lt;/strong&gt;: &lt;code&gt;ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mozilla Old Backward Compatibility (TLS 1.0 - 1.2)&lt;/strong&gt;: &lt;code&gt;ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cipherli Recommendation&lt;/strong&gt;: &lt;code&gt;EECDH+AESGCM:EDH+AESGCM&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;High-Strength Cipher Suite&lt;/strong&gt;: &lt;code&gt;HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4:!RSA&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;By customizing these configurations, you can ensure a secure and optimized SSL setup tailored to your application’s requirements.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>webdev</category>
      <category>opensource</category>
      <category>waf</category>
    </item>
    <item>
      <title>Deploying Static Files for Website Hosting in SafeLine</title>
      <dc:creator>Lulu</dc:creator>
      <pubDate>Fri, 13 Sep 2024 10:05:13 +0000</pubDate>
      <link>https://dev.to/lulu_liu_c90f973e2f954d7f/deploying-static-files-for-website-hosting-in-safeline-1kmk</link>
      <guid>https://dev.to/lulu_liu_c90f973e2f954d7f/deploying-static-files-for-website-hosting-in-safeline-1kmk</guid>
      <description>&lt;h3&gt;
  
  
  How to Host a Website Using Static Files with SafeLine
&lt;/h3&gt;

&lt;p&gt;In &lt;a href="https://waf.chaitin.com" rel="noopener noreferrer"&gt;SafeLine&lt;/a&gt; version 6.6.0 and above, you can easily host websites using static files. This guide will walk you through the steps to set up a site using static resources and provide solutions for common issues you might encounter.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1: Select Static File Hosting
&lt;/h4&gt;

&lt;p&gt;When adding a new site in SafeLine, choose the &lt;strong&gt;Static Files&lt;/strong&gt; option for site creation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkhlkemrg70pq3y9285i3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkhlkemrg70pq3y9285i3.png" alt="Image description" width="582" height="642"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2: Verify Success
&lt;/h4&gt;

&lt;p&gt;After setting up the site, try visiting the site’s URL. If you see the default page, it means the static hosting setup was successful.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsxtq1w3qduus9dkvkaf7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsxtq1w3qduus9dkvkaf7.png" alt="Image description" width="774" height="704"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 3: Upload Your Static Files
&lt;/h4&gt;

&lt;p&gt;Once the default page is visible, you can go to the &lt;strong&gt;Site Details&lt;/strong&gt; section and upload your custom static files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fghb4iy8r3i355zlaq9nz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fghb4iy8r3i355zlaq9nz.png" alt="Image description" width="800" height="258"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  FAQ
&lt;/h3&gt;

&lt;h4&gt;
  
  
  What if the uploaded files exceed the size limit?
&lt;/h4&gt;

&lt;p&gt;If your static files exceed the upload limit, you can manually upload them to the appropriate directory on the WAF server.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Directory path&lt;/strong&gt;: &lt;code&gt;installation_directory/resources/nginx/static/static_${SITE_ID}&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can find the &lt;strong&gt;SITE_ID&lt;/strong&gt; by looking at the site details URL. For example, if the URL is &lt;code&gt;https://xxxx:9443/sites/detail?id=12&lt;/code&gt;, the site ID is &lt;code&gt;12&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;By following these steps, you’ll be able to quickly host static websites using SafeLine and manage your site with ease!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub&lt;/strong&gt;:&lt;a href="https://github.com/chaitin/SafeLine" rel="noopener noreferrer"&gt;https://github.com/chaitin/SafeLine&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Website&lt;/strong&gt;:&lt;a href="https://waf.chaitin.com" rel="noopener noreferrer"&gt;https://waf.chaitin.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>staticwebapps</category>
      <category>cybersecurity</category>
      <category>devops</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Guide to SafeLine Open API: Secure Your Access with API Tokens</title>
      <dc:creator>Lulu</dc:creator>
      <pubDate>Fri, 13 Sep 2024 09:39:17 +0000</pubDate>
      <link>https://dev.to/lulu_liu_c90f973e2f954d7f/guide-to-safeline-open-api-secure-your-access-with-api-tokens-413k</link>
      <guid>https://dev.to/lulu_liu_c90f973e2f954d7f/guide-to-safeline-open-api-secure-your-access-with-api-tokens-413k</guid>
      <description>&lt;h3&gt;
  
  
  SafeLine Open API Guide: API Token Authentication
&lt;/h3&gt;

&lt;p&gt;In the latest version of SafeLine (v6.6.0 and above), the Open API now supports API token-based authentication. Although official API documentation is not currently available, you can scrape it yourself if needed.&lt;/p&gt;

&lt;h4&gt;
  
  
  Requirements:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;You must be logged in using the default admin account to access this feature.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://waf.chaitin.com/" rel="noopener noreferrer"&gt;SafeLine&lt;/a&gt; version must be at least 6.6.0.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;GitHub&lt;/strong&gt;:&lt;a href="https://github.com/chaitin/SafeLine" rel="noopener noreferrer"&gt;https://github.com/chaitin/SafeLine&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Demo&lt;/strong&gt;:&lt;a href="https://demo.waf.chaitin.com:9443/dashboard" rel="noopener noreferrer"&gt;https://demo.waf.chaitin.com:9443/dashboard&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  How to Use the Open API
&lt;/h3&gt;
&lt;h4&gt;
  
  
  Step 1: Create an API Token
&lt;/h4&gt;

&lt;p&gt;First, navigate to &lt;strong&gt;System Management&lt;/strong&gt; in SafeLine and generate an API token.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi8f75u3ksrntntain7s7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi8f75u3ksrntntain7s7.png" alt="Image description" width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Step 2: Include the API Token in Your Requests
&lt;/h4&gt;

&lt;p&gt;When making API calls, you need to include the token in the request headers like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"X-SLCE-API-TOKEN"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Your API Token from SafeLine"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Example: Using API Token in Python to Add a Site
&lt;/h3&gt;

&lt;p&gt;Below is an example of how to use the SafeLine Open API with an API token to add a new site in Python.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;

&lt;span class="c1"&gt;# Define the header with your API token
&lt;/span&gt;&lt;span class="n"&gt;header&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;X-SLCE-API-TOKEN&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Your API Token from SafeLine&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# API endpoint to add a site
&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;https://&amp;lt;safeline_ip&amp;gt;:9443/api/open/site&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;

&lt;span class="c1"&gt;# Payload containing site details
&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ports&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;80&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;server_names&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;upstreams&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;http://127.0.0.1:9443&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;comment&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;load_balance&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;balance_type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Convert payload to JSON
&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Send the POST request
&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;header&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;verify&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Check the response
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Explanation:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;header&lt;/strong&gt; contains the required API token for authentication.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;URL&lt;/strong&gt; is the endpoint for adding a site (&lt;code&gt;/api/open/site&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;payload&lt;/strong&gt; specifies details about the site such as ports, server names, upstreams, and load-balancing configuration.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;By following these steps, you can securely interact with SafeLine's Open API using token-based authentication, enabling you to automate and manage your web security setup with ease.&lt;/p&gt;

</description>
      <category>api</category>
      <category>python</category>
      <category>cybersecurity</category>
      <category>devops</category>
    </item>
    <item>
      <title>How to Secure Your Kubernetes with Ingress-Nginx and SafeLine</title>
      <dc:creator>Lulu</dc:creator>
      <pubDate>Fri, 13 Sep 2024 09:18:12 +0000</pubDate>
      <link>https://dev.to/lulu_liu_c90f973e2f954d7f/how-to-secure-your-kubernetes-with-ingress-nginx-and-safeline-8aj</link>
      <guid>https://dev.to/lulu_liu_c90f973e2f954d7f/how-to-secure-your-kubernetes-with-ingress-nginx-and-safeline-8aj</guid>
      <description>&lt;h3&gt;
  
  
  Integrating Ingress-Nginx with SafeLine Community Edition
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SafeLine version ≥ 5.6.0&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Preparing SafeLine Configuration
&lt;/h3&gt;

&lt;p&gt;First, configure SafeLine by using a &lt;code&gt;ConfigMap&lt;/code&gt; to define the detection engine's host and port. Below is an example configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# safeline.yaml&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ConfigMap&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;safeline&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ingress-nginx&lt;/span&gt;
&lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;detector_host"&lt;/span&gt;  &lt;span class="c1"&gt;# Replace with your SafeLine detection engine address&lt;/span&gt;
  &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;8000"&lt;/span&gt;           &lt;span class="c1"&gt;# Default port for SafeLine&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To create the &lt;code&gt;ConfigMap&lt;/code&gt; in Ingress-Nginx, run the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl create namespace ingress-nginx
kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; safeline.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Fresh Installation with Helm
&lt;/h3&gt;

&lt;p&gt;If you don't have Ingress-Nginx installed yet, you can install it using Helm. For detailed instructions, refer to the &lt;a href="https://kubernetes.github.io/ingress-nginx/deploy/#using-helm" rel="noopener noreferrer"&gt;Ingress-Nginx official documentation&lt;/a&gt;. &lt;br&gt;
Once ready, replace the image and configure the SafeLine plugin by using the following &lt;code&gt;values.yaml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# values.yaml&lt;/span&gt;
&lt;span class="na"&gt;controller&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DaemonSet&lt;/span&gt;
  &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;registry&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;docker.io&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;chaitin/ingress-nginx-controller&lt;/span&gt;
    &lt;span class="na"&gt;tag&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1.10.1&lt;/span&gt;
  &lt;span class="na"&gt;extraEnvs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;SAFELINE_HOST&lt;/span&gt;
      &lt;span class="na"&gt;valueFrom&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;configMapKeyRef&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;safeline&lt;/span&gt;
          &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;host&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;SAFELINE_PORT&lt;/span&gt;
      &lt;span class="na"&gt;valueFrom&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;configMapKeyRef&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;safeline&lt;/span&gt;
          &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;port&lt;/span&gt;
  &lt;span class="na"&gt;service&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;externalTrafficPolicy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Local&lt;/span&gt;  &lt;span class="c1"&gt;# To capture real client IPs&lt;/span&gt;
  &lt;span class="na"&gt;config&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;safeline&lt;/span&gt;
  &lt;span class="na"&gt;admissionWebhooks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;patch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;registry&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;docker.io&lt;/span&gt;
        &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;chaitin/ingress-nginx-kube-webhook-certgen&lt;/span&gt;
        &lt;span class="na"&gt;tag&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1.4.1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To install the controller, use this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;helm upgrade &lt;span class="nt"&gt;--install&lt;/span&gt; ingress-nginx ingress-nginx &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--repo&lt;/span&gt; https://kubernetes.github.io/ingress-nginx &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--namespace&lt;/span&gt; ingress-nginx &lt;span class="nt"&gt;--create-namespace&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-f&lt;/span&gt; values.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Build Your Own Ingress-Nginx Image
&lt;/h3&gt;

&lt;p&gt;If you'd prefer to build the image yourself, here’s a sample &lt;code&gt;Dockerfile&lt;/code&gt; that adds the SafeLine plugin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; registry.k8s.io/ingress-nginx/controller:v1.10.1&lt;/span&gt;
&lt;span class="k"&gt;USER&lt;/span&gt;&lt;span class="s"&gt; root&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;apk add &lt;span class="nt"&gt;--no-cache&lt;/span&gt; make gcc unzip wget
&lt;span class="c"&gt;# Install Luarocks&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;wget https://luarocks.org/releases/luarocks-3.11.0.tar.gz &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    &lt;span class="nb"&gt;tar &lt;/span&gt;zxpf luarocks-3.11.0.tar.gz &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    &lt;span class="nb"&gt;cd &lt;/span&gt;luarocks-3.11.0 &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    ./configure &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    make &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    make &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    &lt;span class="nb"&gt;cd&lt;/span&gt; .. &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; luarocks-3.11.0 luarocks-3.11.0.tar.gz
&lt;span class="k"&gt;RUN &lt;/span&gt;luarocks &lt;span class="nb"&gt;install &lt;/span&gt;ingress-nginx-safeline &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    &lt;span class="nb"&gt;ln&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; /usr/local/share/lua/5.1/safeline /etc/nginx/lua/plugins/safeline
&lt;span class="k"&gt;USER&lt;/span&gt;&lt;span class="s"&gt; www-data&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Adding SafeLine to Existing Ingress-Nginx Installations
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Step 1: Install the SafeLine Plugin
&lt;/h4&gt;

&lt;p&gt;Refer to the &lt;code&gt;Dockerfile&lt;/code&gt; above and use &lt;code&gt;luarocks&lt;/code&gt; to install the SafeLine plugin in your default Nginx plugin directory.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2: Configure the SafeLine Plugin
&lt;/h4&gt;

&lt;p&gt;Use the &lt;code&gt;safeline.yaml&lt;/code&gt; file to create the necessary &lt;code&gt;ConfigMap&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; safeline.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In your &lt;code&gt;Ingress-Nginx&lt;/code&gt; configuration, enable the SafeLine plugin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ingress-nginx-controller-configmap.yaml&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ConfigMap&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ingress-nginx-controller&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ingress-nginx&lt;/span&gt;
&lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;safeline"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 3: Inject SafeLine Environment Variables
&lt;/h4&gt;

&lt;p&gt;Add the environment variables to your &lt;code&gt;Ingress-Nginx&lt;/code&gt; Deployment or DaemonSet so the SafeLine plugin can read them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ingress-nginx-controller-deployment.yaml&lt;/span&gt;
&lt;span class="nn"&gt;...&lt;/span&gt;
&lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;SAFELINE_HOST&lt;/span&gt;
    &lt;span class="na"&gt;valueFrom&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;configMapKeyRef&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;safeline&lt;/span&gt;
        &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;host&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;SAFELINE_PORT&lt;/span&gt;
    &lt;span class="na"&gt;valueFrom&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;configMapKeyRef&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;safeline&lt;/span&gt;
        &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;port&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 4: (Optional) Capture Real Client IP
&lt;/h4&gt;

&lt;p&gt;To capture real client IP addresses, ensure that the &lt;code&gt;externalTrafficPolicy&lt;/code&gt; in your Nginx service is set to &lt;code&gt;Local&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing SafeLine Plugin
&lt;/h3&gt;

&lt;p&gt;You can test if the SafeLine plugin is working by simulating a malicious request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl http://localhost:80/ &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Host: example.com"&lt;/span&gt; &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"User-Agent: () { :; }; echo; echo; /bin/bash -c 'echo hello'"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything is configured correctly, you should receive a &lt;code&gt;403 Forbidden&lt;/code&gt; response, indicating that the request was blocked by SafeLine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"code"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;403&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"success"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"blocked by Chaitin SafeLine Web Application Firewall"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"event_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"18e0f220f7a94127acb21ad3c1b4ac47"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can check the SafeLine dashboard for more detailed attack logs.&lt;/p&gt;




&lt;p&gt;By following this guide, you'll have Ingress-Nginx integrated with SafeLine, helping you enhance the security of your Kubernetes clusters with minimal effort.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>devops</category>
      <category>cybersecurity</category>
      <category>docker</category>
    </item>
    <item>
      <title>Boost API Security: Kong and SafeLine WAF Integration Guide</title>
      <dc:creator>Lulu</dc:creator>
      <pubDate>Thu, 12 Sep 2024 10:48:31 +0000</pubDate>
      <link>https://dev.to/lulu_liu_c90f973e2f954d7f/boost-api-security-kong-and-safeline-waf-integration-guide-40o9</link>
      <guid>https://dev.to/lulu_liu_c90f973e2f954d7f/boost-api-security-kong-and-safeline-waf-integration-guide-40o9</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/Kong/kong" rel="noopener noreferrer"&gt;Kong&lt;/a&gt; is a cloud-native, fast, scalable, and distributed microservices abstraction layer (also known as an API gateway or middleware). It offers robust traffic control, security, monitoring, and operational features through plugins.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing the Kong Plugin
&lt;/h3&gt;

&lt;p&gt;Custom plugins can be installed via LuaRocks. Lua plugins are distributed as &lt;code&gt;.rock&lt;/code&gt; packages, which are self-contained and can be installed from local or remote servers.&lt;/p&gt;

&lt;p&gt;If you've installed Kong using the official package, the LuaRocks utility should already be included in your system.&lt;/p&gt;

&lt;p&gt;To install the SafeLine plugin, follow these steps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;luarocks &lt;span class="nb"&gt;install &lt;/span&gt;kong-safeline
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, enable the SafeLine plugin by adding the following configuration to your &lt;code&gt;kong.conf&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;plugins &lt;span class="o"&gt;=&lt;/span&gt; bundled,safeline              &lt;span class="c"&gt;# Comma-separated list of plugins this node&lt;/span&gt;
                                        &lt;span class="c"&gt;# should load. By default, only plugins&lt;/span&gt;
                                        &lt;span class="c"&gt;# bundled in official distributions are&lt;/span&gt;
                                        &lt;span class="c"&gt;# loaded via the `bundled` keyword.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This line adds SafeLine to the list of enabled plugins, alongside any bundled plugins in the official distribution.&lt;/p&gt;

&lt;p&gt;Finally, restart the Kong Gateway:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kong restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Using the SafeLine Plugin with Kong
&lt;/h3&gt;

&lt;p&gt;To enable the &lt;a href="https://github.com/chaitin/SafeLine" rel="noopener noreferrer"&gt;SafeLine&lt;/a&gt; plugin for a specific service, configure the &lt;code&gt;detector_host&lt;/code&gt; and &lt;code&gt;safeline_port&lt;/code&gt;, which refer to the SafeLine detection engine's address and port, as set during the initial setup.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST http://localhost:8001/services/&lt;span class="o"&gt;{&lt;/span&gt;service&lt;span class="o"&gt;}&lt;/span&gt;/plugins &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--data&lt;/span&gt; &lt;span class="s2"&gt;"name=safeline"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--data&lt;/span&gt; &lt;span class="s2"&gt;"config.safeline_host=&amp;lt;detector_host&amp;gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--data&lt;/span&gt; &lt;span class="s2"&gt;"config.safeline_port=&amp;lt;detector_port&amp;gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Testing the Protection
&lt;/h3&gt;

&lt;p&gt;To verify that SafeLine is working, you can simulate a simple SQL injection attack by sending a request to Kong. If SafeLine is protecting your service, you should receive a &lt;code&gt;403 Forbidden&lt;/code&gt; response.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST http://localhost:8000?1&lt;span class="o"&gt;=&lt;/span&gt;1%20and%202&lt;span class="o"&gt;=&lt;/span&gt;2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should get the following response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"code"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;403&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"success"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"blocked by Chaitin SafeLine Web Application Firewall"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"event_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"8b41a021ea9541c89bb88f3773b4da24"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Additionally, you can check &lt;a href="https://demo.waf.chaitin.com:9443/dashboard" rel="noopener noreferrer"&gt;SafeLine's dashboard&lt;/a&gt; to see a full record of the blocked attack.&lt;/p&gt;

</description>
      <category>api</category>
      <category>opensource</category>
      <category>devops</category>
      <category>cybersecurity</category>
    </item>
    <item>
      <title>Simple, Easy-to-Use, and Open-Source Web Application Firewall</title>
      <dc:creator>Lulu</dc:creator>
      <pubDate>Thu, 12 Sep 2024 10:11:25 +0000</pubDate>
      <link>https://dev.to/lulu_liu_c90f973e2f954d7f/simple-easy-to-use-and-open-source-web-application-firewall-587k</link>
      <guid>https://dev.to/lulu_liu_c90f973e2f954d7f/simple-easy-to-use-and-open-source-web-application-firewall-587k</guid>
      <description>&lt;p&gt;Today, I’m excited to introduce &lt;strong&gt;SafeLine&lt;/strong&gt;, a free and open-source Web Application Firewall (WAF)!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/chaitin/safeline" rel="noopener noreferrer"&gt;https://github.com/chaitin/safeline&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsro3kvlo22mqioesyi36.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsro3kvlo22mqioesyi36.png" alt="Image description" width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SafeLine is an open-source WAF designed for simplicity and ease of use. It’s available as a community edition and can be installed quickly with minimal effort. SafeLine helps protect your web services by filtering incoming traffic from the internet, defending against a wide range of attacks like SQL injection, code injection, command injection, backdoors, and web crawlers.&lt;/p&gt;

&lt;p&gt;Here’s an overview of how it works:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh3y80mkm0s0ep3m54pgg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh3y80mkm0s0ep3m54pgg.png" alt="Image description" width="800" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With over 200,000 installations worldwide and more than 1 million protected websites, SafeLine processes over 30 billion requests daily.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Install SafeLine
&lt;/h3&gt;

&lt;p&gt;You can install SafeLine easily using a one-liner script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash -c "$(curl -fsSLk https://waf.chaitin.com/release/latest/setup.sh)"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a detailed manual installation guide, check out the official tutorial here: &lt;a href="https://docs.waf.chaitin.com/en/tutorials/install" rel="noopener noreferrer"&gt;https://docs.waf.chaitin.com/en/tutorials/install&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once installed, you can access the SafeLine dashboard at: &lt;code&gt;https://&amp;lt;safeline-ip&amp;gt;:9443/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If it's your first time logging in, you'll need to initialize the admin account by running this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;safeline-mgt resetadmin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will generate the default username and password.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Features of SafeLine
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Protects against a wide range of web attacks (including SQL injection, XSS, code injection, OS command injection, CRLF injection, XXE, SSRF, path traversal, etc.).&lt;/li&gt;
&lt;li&gt;Blocks web crawlers and malicious scanners.&lt;/li&gt;
&lt;li&gt;Dynamically encrypts front-end code.&lt;/li&gt;
&lt;li&gt;Supports IP-based rate limiting (defends against DDoS, brute force attacks, and abnormal traffic).&lt;/li&gt;
&lt;li&gt;Allows configuring HTTP access controls.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxcoz2z03g525kf9tod2b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxcoz2z03g525kf9tod2b.png" alt="Image description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>cybersecurity</category>
      <category>docker</category>
      <category>devops</category>
    </item>
    <item>
      <title>Optimizing Docker for High Security: Combining Docker and SafeLine</title>
      <dc:creator>Lulu</dc:creator>
      <pubDate>Thu, 12 Sep 2024 09:31:35 +0000</pubDate>
      <link>https://dev.to/lulu_liu_c90f973e2f954d7f/optimizing-docker-for-high-security-combining-docker-and-safeline-56mi</link>
      <guid>https://dev.to/lulu_liu_c90f973e2f954d7f/optimizing-docker-for-high-security-combining-docker-and-safeline-56mi</guid>
      <description>&lt;p&gt;Docker is an open-source application container engine built with Go and follows the Apache 2.0 protocol. It enables developers to package their applications and dependencies into lightweight, portable containers. These containers can be deployed on any popular Linux machine, offering a form of lightweight virtualization. Each container operates in complete isolation (similar to iPhone apps), and most importantly, the performance overhead is minimal.&lt;/p&gt;

&lt;h4&gt;
  
  
  Docker Installation
&lt;/h4&gt;

&lt;p&gt;Here's how to install Docker on CentOS:&lt;/p&gt;

&lt;p&gt;1.&lt;strong&gt;Install Docker Image&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://get.docker.com | bash &lt;span class="nt"&gt;-s&lt;/span&gt; docker &lt;span class="nt"&gt;--mirror&lt;/span&gt; Aliyun
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.&lt;strong&gt;Set Up Stable Repositories&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;yum-config-manager &lt;span class="nt"&gt;--add-repo&lt;/span&gt; http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.&lt;strong&gt;Install Required Packages&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;yum &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; yum-utils device-mapper-persistent-data lvm2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4.&lt;strong&gt;Remove Old Docker Versions (if any)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yum remove docker docker-client docker-common docker-latest docker-engine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5.&lt;strong&gt;List Available Docker Versions&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yum list docker-ce &lt;span class="nt"&gt;--showduplicates&lt;/span&gt; | &lt;span class="nb"&gt;sort&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;6.&lt;strong&gt;Install Selected Version (e.g., 19.03.13)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yum &lt;span class="nb"&gt;install &lt;/span&gt;docker-ce-19.03.13 docker-ce-cli-19.03.13 containerd.io
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;7.&lt;strong&gt;Alternatively, Install the Latest Version&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yum &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nb"&gt;install &lt;/span&gt;docker-ce
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;8.&lt;strong&gt;Start and Enable Docker&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;systemctl start docker
systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;docker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Optimization
&lt;/h4&gt;

&lt;p&gt;When deploying services, it’s best to tune the system for minimal service disruption. Below are some optimizations to improve Docker's performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Directory Migration&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Stop Docker service&lt;/span&gt;
systemctl stop docker

&lt;span class="c"&gt;# Create new directory for Docker data&lt;/span&gt;
&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; /home/jamelli/docker/data/lib

&lt;span class="c"&gt;# Copy existing Docker data to the new directory&lt;/span&gt;
rsync &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="nt"&gt;-avz&lt;/span&gt; /var/lib/docker /home/jamelli/docker/data/lib
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Configure Docker to Use New Directory&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt; &amp;gt; /etc/systemd/system/docker.service.d/devicemapper.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --graph=/home/jamelli/docker/data/lib/docker
&lt;/span&gt;&lt;span class="no"&gt;EOF

&lt;/span&gt;&lt;span class="c"&gt;# Reload and restart Docker&lt;/span&gt;
systemctl daemon-reload
systemctl restart docker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Log Optimization
&lt;/h4&gt;

&lt;p&gt;To manage log file size and avoid excessive disk usage, configure log rotation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt; &amp;gt; /etc/docker/daemon.json
{
    "log-driver": "json-file",
    "log-opts": {
        "max-size": "100m",
        "max-file": "3"
    }
}
&lt;/span&gt;&lt;span class="no"&gt;EOF
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Disk Optimization
&lt;/h4&gt;

&lt;p&gt;Use these commands to clean up unused containers, volumes, and images:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker system &lt;span class="nb"&gt;df
&lt;/span&gt;docker system prune
docker system prune &lt;span class="nt"&gt;-a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To check detailed disk usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker system &lt;span class="nb"&gt;df&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Docker Commands You Should Know
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;docker system df&lt;/code&gt;: Check Docker’s memory usage&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;docker image&lt;/code&gt;: View Docker image contents&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;docker info&lt;/code&gt;: Get Docker system information&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;docker stats&lt;/code&gt;: View container resource usage (CPU, memory)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;docker logs --tail=10 -f &amp;lt;container-name&amp;gt;&lt;/code&gt;: View container logs in real-time&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  SafeLine WAF Integration
&lt;/h4&gt;

&lt;p&gt;Now that Docker is installed and optimized, you can further secure your infrastructure by deploying &lt;a href="https://waf.chaitin.com/" rel="noopener noreferrer"&gt;SafeLine WAF&lt;/a&gt;, a powerful and free web application firewall. Here's how to install SafeLine on your Dockerized system:&lt;/p&gt;

&lt;p&gt;1.&lt;strong&gt;Install SafeLine&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bash &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-fsSLk&lt;/span&gt; https://waf.chaitin.com/release/latest/setup.sh&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.&lt;strong&gt;Access SafeLine&lt;/strong&gt;&lt;br&gt;
After installation, open port 9443 on your firewall to access the SafeLine management interface:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Open port 9443&lt;/span&gt;
firewall-cmd &lt;span class="nt"&gt;--zone&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;public &lt;span class="nt"&gt;--add-port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;9443/tcp &lt;span class="nt"&gt;--permanent&lt;/span&gt;
firewall-cmd &lt;span class="nt"&gt;--reload&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, access SafeLine at:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://&amp;lt;your-server-ip&amp;gt;:9443/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.&lt;strong&gt;Protect Your Web Apps&lt;/strong&gt;&lt;br&gt;
With SafeLine, your Dockerized applications will be protected against common attacks like SQL injections, XSS, and DDoS threats. SafeLine’s traffic processing engine, built on Nginx, ensures that your applications are secure while maintaining high performance.&lt;/p&gt;
&lt;h4&gt;
  
  
  Solving Common Docker Issues
&lt;/h4&gt;

&lt;p&gt;When pulling Docker images, if you encounter the following error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error response from daemon: net/http: TLS handshake timeout
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can resolve this by adding a Docker mirror:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;vim /etc/docker/daemon.json
&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"registry-mirrors"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"https://docker.mirrors.ustc.edu.cn"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then reload and restart Docker:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;systemctl daemon-reload
systemctl restart docker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>docker</category>
      <category>cybersecurity</category>
      <category>sql</category>
      <category>waf</category>
    </item>
    <item>
      <title>How to Secure Your Web Apps: A Free and Powerful WAF</title>
      <dc:creator>Lulu</dc:creator>
      <pubDate>Thu, 12 Sep 2024 09:00:00 +0000</pubDate>
      <link>https://dev.to/lulu_liu_c90f973e2f954d7f/how-to-secure-your-web-apps-a-free-and-powerful-waf-l3n</link>
      <guid>https://dev.to/lulu_liu_c90f973e2f954d7f/how-to-secure-your-web-apps-a-free-and-powerful-waf-l3n</guid>
      <description>&lt;p&gt;A Web Application Firewall (WAF) operates at the application layer, providing protection for web requests and responses. WAFs can safeguard your web applications from common threats such as SQL injections, cross-site scripting (XSS), and other vulnerabilities. Additionally, they can monitor and filter traffic that may lead to Denial of Service (DoS) attacks, helping ensure the availability and security of your web services.&lt;/p&gt;

&lt;h4&gt;
  
  
  SafeLine: A Powerful and Free WAF Tool
&lt;/h4&gt;

&lt;p&gt;Today, we’re introducing &lt;a href="https://github.com/chaitin/SafeLine" rel="noopener noreferrer"&gt;SafeLine&lt;/a&gt;, a robust and free WAF solution. SafeLine’s traffic processing engine is built on top of Nginx, offering excellent stability and performance for handling high volumes of web traffic.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://docs.waf.chaitin.com/en/tutorials/install" rel="noopener noreferrer"&gt;Installation&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;You can install SafeLine via the command line with the following steps:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Install SafeLine&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bash &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-fsSLk&lt;/span&gt; https://waf.chaitin.com/release/latest/setup.sh&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Install Docker&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-sSL&lt;/span&gt; &lt;span class="s2"&gt;"https://get.docker.com/"&lt;/span&gt; | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When prompted, type &lt;code&gt;y&lt;/code&gt; to confirm and wait for the installation to complete.&lt;/p&gt;

&lt;h4&gt;
  
  
  Access SafeLine
&lt;/h4&gt;

&lt;p&gt;After installation, open port 9443 on your firewall to allow access:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Open port 9443&lt;/span&gt;
firewall-cmd &lt;span class="nt"&gt;--zone&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;public &lt;span class="nt"&gt;--add-port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;9443/tcp &lt;span class="nt"&gt;--permanent&lt;/span&gt;   
&lt;span class="c"&gt;# Apply the configuration&lt;/span&gt;
firewall-cmd &lt;span class="nt"&gt;--reload&lt;/span&gt;  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, you can access SafeLine by navigating to the following URL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://&amp;lt;your-server-ip&amp;gt;:9443/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you log in, you’ll be able to start using SafeLine to protect your applications.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg4pqni2juvziox90nsqp.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg4pqni2juvziox90nsqp.jpg" alt="Image description" width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Uninstallation
&lt;/h4&gt;

&lt;p&gt;If you decide you no longer need SafeLine, follow these steps to uninstall it completely:&lt;/p&gt;

&lt;p&gt;1.Navigate to the SafeLine directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &amp;lt;safeline-directory&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.Stop the SafeLine service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose down
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.Remove all SafeLine data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; &amp;lt;safeline-directory&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>cybersecurity</category>
      <category>docker</category>
      <category>sql</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
