<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Cdn on Wanzi&#39;s Blog – Notes on life, tech, and DevOps.</title>
    <link>https://wanzi.dev/tags/cdn/</link>
    <description>Recent content in Cdn on Wanzi&#39;s Blog – Notes on life, tech, and DevOps.</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>wzdushu@gmail.com (wanzi)</managingEditor>
    <webMaster>wzdushu@gmail.com (wanzi)</webMaster>
    <copyright>丸子有记</copyright>
    <lastBuildDate>Sun, 16 Jun 2024 16:22:42 +0800</lastBuildDate>
    
        <atom:link href="https://wanzi.dev/tags/cdn/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Open Source WAF Security Protection Solution</title>
      <link>https://wanzi.dev/post/tools-safeline-waf/</link>
      <pubDate>Sun, 16 Jun 2024 16:22:42 +0800</pubDate>
      <author>wzdushu@gmail.com (wanzi)</author>
      <guid>https://wanzi.dev/post/tools-safeline-waf/</guid>
      
        <description>&lt;p&gt;Recently, after adding a CDN to the website, there have been a lot of junk requests in the early morning, some are scans, some have large model UserAgents, and some are black spiders.&lt;/p&gt;
&lt;p&gt;To save on CDN costs and prevent various injection attacks, I started researching open-source WAF solutions (which is sufficient for my small site). For enterprise use, it is still recommended to use commercial versions, such as Alibaba Cloud&amp;rsquo;s DCDN, Tencent&amp;rsquo;s EdgeOne, or overseas options like Cloudflare (preferred for overseas business).&lt;/p&gt;
&lt;h2 id=&#34;1-function-introduction&#34;&gt;1. Function Introduction&lt;/h2&gt;
&lt;p&gt;Leichi (SafeLine) is an open-source WAF solution from Chaitin Technology, driven by intelligent semantic analysis algorithms.&lt;/p&gt;
&lt;p&gt;The main function is a network security gateway, focusing on WAF, which can defend against all web attacks, such as SQL injection, code injection, OS command injection, CRLF injection, LDAP injection, XPath injection, RCE, XSS, XXE, SSRF, path traversal, backdoors, brute force attacks, HTTP floods, robot abuse, etc.&lt;/p&gt;
&lt;p&gt;I briefly reviewed the project source code; the API uses Golang, and the core WAF functionality uses Tengine + Lua, similar to OpenResty.&lt;/p&gt;
&lt;p&gt;Project address: &lt;a href=&#34;https://github.com/chaitin/safeline&#34;&gt;https://github.com/chaitin/safeline&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Official website: &lt;a href=&#34;https://waf-ce.chaitin.cn/&#34;&gt;https://waf-ce.chaitin.cn/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://waf.chaitin.com/&#34;&gt;https://waf.chaitin.com/&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: Other popular gateways include Apisix, Kong, Openresty, etc.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;2-installation&#34;&gt;2. Installation&lt;/h2&gt;
&lt;h3 id=&#34;download-offline-image&#34;&gt;Download Offline Image&lt;/h3&gt;
&lt;p&gt;Since many domestic Docker Hub mirror accelerators have become unavailable recently, we can only use offline methods here.&lt;/p&gt;
&lt;div class=&#34;highlight-container&#34;&gt;

  &lt;button class=&#34;copy-code-btn outline&#34;&gt;Copy&lt;/button&gt;

  
  &lt;div class=&#34;highlight&#34;&gt;&lt;div style=&#34;background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;
&lt;table style=&#34;border-spacing:0;padding:0;margin:0;border:0;&#34;&gt;&lt;tr&gt;&lt;td style=&#34;vertical-align:top;padding:0;margin:0;border:0;&#34;&gt;
&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-1&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-1&#34;&gt; 1&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-2&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-2&#34;&gt; 2&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-3&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-3&#34;&gt; 3&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-4&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-4&#34;&gt; 4&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-5&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-5&#34;&gt; 5&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-6&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-6&#34;&gt; 6&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-7&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-7&#34;&gt; 7&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-8&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-8&#34;&gt; 8&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-9&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-9&#34;&gt; 9&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-10&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-10&#34;&gt;10&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-11&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-11&#34;&gt;11&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-12&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-12&#34;&gt;12&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-13&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-13&#34;&gt;13&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-14&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-14&#34;&gt;14&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-15&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-15&#34;&gt;15&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-16&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-16&#34;&gt;16&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-17&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-17&#34;&gt;17&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-18&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-18&#34;&gt;18&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-19&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-19&#34;&gt;19&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-20&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-20&#34;&gt;20&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-21&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-21&#34;&gt;21&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-22&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-22&#34;&gt;22&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-23&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-23&#34;&gt;23&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-24&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-24&#34;&gt;24&lt;/a&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td style=&#34;vertical-align:top;padding:0;margin:0;border:0;;width:100%&#34;&gt;
&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#60a0b0;font-style:italic&#34;&gt;# mkdir /opt/safeline&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#60a0b0;font-style:italic&#34;&gt;# cd /opt/safeline&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#60a0b0;font-style:italic&#34;&gt;# wget https://demo.waf-ce.chaitin.cn/image.tar.gz&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#60a0b0;font-style:italic&#34;&gt;# cat image.tar.gz | gzip -d | docker load&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#60a0b0;font-style:italic&#34;&gt;# docker ps &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;REPOSITORY                                                           TAG       IMAGE ID       CREATED         SIZE
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;chaitin/safeline-fvm                                                 latest    d9589d01be57   &lt;span style=&#34;color:#40a070&#34;&gt;3&lt;/span&gt; days ago      175MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;swr.cn-east-3.myhuaweicloud.com/chaitin-safeline/safeline-fvm        latest    d9589d01be57   &lt;span style=&#34;color:#40a070&#34;&gt;3&lt;/span&gt; days ago      175MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;chaitin/safeline-mgt                                                 latest    56ef6365e4c3   &lt;span style=&#34;color:#40a070&#34;&gt;3&lt;/span&gt; days ago      81.6MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;swr.cn-east-3.myhuaweicloud.com/chaitin-safeline/safeline-mgt        latest    56ef6365e4c3   &lt;span style=&#34;color:#40a070&#34;&gt;3&lt;/span&gt; days ago      81.6MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;chaitin/safeline-luigi                                               latest    1423e012eef0   &lt;span style=&#34;color:#40a070&#34;&gt;3&lt;/span&gt; days ago      31.8MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;swr.cn-east-3.myhuaweicloud.com/chaitin-safeline/safeline-luigi      latest    1423e012eef0   &lt;span style=&#34;color:#40a070&#34;&gt;3&lt;/span&gt; days ago      31.8MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;chaitin/safeline-mario                                               latest    758fd16c3d30   &lt;span style=&#34;color:#40a070&#34;&gt;3&lt;/span&gt; days ago      201MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;swr.cn-east-3.myhuaweicloud.com/chaitin-safeline/safeline-mario      latest    758fd16c3d30   &lt;span style=&#34;color:#40a070&#34;&gt;3&lt;/span&gt; days ago      201MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;chaitin/safeline-bridge                                              latest    94aaed2a1b5a   &lt;span style=&#34;color:#40a070&#34;&gt;3&lt;/span&gt; days ago      17.9MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;swr.cn-east-3.myhuaweicloud.com/chaitin-safeline/safeline-bridge     latest    94aaed2a1b5a   &lt;span style=&#34;color:#40a070&#34;&gt;3&lt;/span&gt; days ago      17.9MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;chaitin/safeline-tengine                                             latest    c67893333287   &lt;span style=&#34;color:#40a070&#34;&gt;3&lt;/span&gt; days ago      140MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;swr.cn-east-3.myhuaweicloud.com/chaitin-safeline/safeline-tengine    latest    c67893333287   &lt;span style=&#34;color:#40a070&#34;&gt;3&lt;/span&gt; days ago      140MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;chaitin/safeline-detector                                            latest    f5cff5cc7e35   &lt;span style=&#34;color:#40a070&#34;&gt;3&lt;/span&gt; days ago      179MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;swr.cn-east-3.myhuaweicloud.com/chaitin-safeline/safeline-detector   latest    f5cff5cc7e35   &lt;span style=&#34;color:#40a070&#34;&gt;3&lt;/span&gt; days ago      179MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;chaitin/safeline-chaos                                               latest    71b05b47e3fd   &lt;span style=&#34;color:#40a070&#34;&gt;3&lt;/span&gt; days ago      118MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;swr.cn-east-3.myhuaweicloud.com/chaitin-safeline/safeline-chaos      latest    71b05b47e3fd   &lt;span style=&#34;color:#40a070&#34;&gt;3&lt;/span&gt; days ago      118MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;chaitin/safeline-postgres                                            15.2      bf700010ce28   &lt;span style=&#34;color:#40a070&#34;&gt;13&lt;/span&gt; months ago   379MB
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;swr.cn-east-3.myhuaweicloud.com/chaitin-safeline/safeline-postgres   15.2      bf700010ce28   &lt;span style=&#34;color:#40a070&#34;&gt;13&lt;/span&gt; months ago   379MB&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;configure-environment&#34;&gt;Configure Environment&lt;/h3&gt;
&lt;div class=&#34;highlight-container&#34;&gt;

  &lt;button class=&#34;copy-code-btn outline&#34;&gt;Copy&lt;/button&gt;

  
  &lt;div class=&#34;highlight&#34;&gt;&lt;div style=&#34;background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;
&lt;table style=&#34;border-spacing:0;padding:0;margin:0;border:0;&#34;&gt;&lt;tr&gt;&lt;td style=&#34;vertical-align:top;padding:0;margin:0;border:0;&#34;&gt;
&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-1-1&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-1-1&#34;&gt;1&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-1-2&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-1-2&#34;&gt;2&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-1-3&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-1-3&#34;&gt;3&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-1-4&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-1-4&#34;&gt;4&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-1-5&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-1-5&#34;&gt;5&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-1-6&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-1-6&#34;&gt;6&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-1-7&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-1-7&#34;&gt;7&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-1-8&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-1-8&#34;&gt;8&lt;/a&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td style=&#34;vertical-align:top;padding:0;margin:0;border:0;;width:100%&#34;&gt;
&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#60a0b0;font-style:italic&#34;&gt;# cd  /opt/safeline&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#60a0b0;font-style:italic&#34;&gt;# vim .env&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bb60d5&#34;&gt;SAFELINE_DIR&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;/opt/safeline
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bb60d5&#34;&gt;IMAGE_TAG&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;latest
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bb60d5&#34;&gt;MGT_PORT&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#40a070&#34;&gt;9443&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bb60d5&#34;&gt;POSTGRES_PASSWORD&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;Pgssf201Waf
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bb60d5&#34;&gt;SUBNET_PREFIX&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;172.22.222
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bb60d5&#34;&gt;IMAGE_PREFIX&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;chaitin&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;SAFELINE_DIR: Leichi installation directory, configured as /opt/safeline here.&lt;/li&gt;
&lt;li&gt;IMAGE_TAG: The version of Leichi to install, keep the default latest.&lt;/li&gt;
&lt;li&gt;MGT_PORT: The port for the Leichi console, keep the default 9443.&lt;/li&gt;
&lt;li&gt;POSTGRES_PASSWORD: The initial password for the database required by Leichi, please generate one randomly.&lt;/li&gt;
&lt;li&gt;SUBNET_PREFIX: The subnet prefix for the internal network of Leichi, keep the default 172.22.222.&lt;/li&gt;
&lt;li&gt;IMAGE_PREFIX: The prefix for the Leichi image source, keep the default chaitin.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;manage-containers-with-docker-compose&#34;&gt;Manage Containers with docker-compose:&lt;/h3&gt;
&lt;div class=&#34;highlight-container&#34;&gt;

  &lt;button class=&#34;copy-code-btn outline&#34;&gt;Copy&lt;/button&gt;

  
  &lt;div class=&#34;highlight&#34;&gt;&lt;div style=&#34;background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;
&lt;table style=&#34;border-spacing:0;padding:0;margin:0;border:0;&#34;&gt;&lt;tr&gt;&lt;td style=&#34;vertical-align:top;padding:0;margin:0;border:0;&#34;&gt;
&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-2-1&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-2-1&#34;&gt; 1&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-2-2&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-2-2&#34;&gt; 2&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-2-3&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-2-3&#34;&gt; 3&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-2-4&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-2-4&#34;&gt; 4&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-2-5&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-2-5&#34;&gt; 5&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-2-6&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-2-6&#34;&gt; 6&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-2-7&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-2-7&#34;&gt; 7&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-2-8&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-2-8&#34;&gt; 8&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-2-9&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-2-9&#34;&gt; 9&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-2-10&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-2-10&#34;&gt;10&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-2-11&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-2-11&#34;&gt;11&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-2-12&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-2-12&#34;&gt;12&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-2-13&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-2-13&#34;&gt;13&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-2-14&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-2-14&#34;&gt;14&lt;/a&gt;
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-2-15&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-2-15&#34;&gt;15&lt;/a&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td style=&#34;vertical-align:top;padding:0;margin:0;border:0;;width:100%&#34;&gt;
&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#60a0b0;font-style:italic&#34;&gt;# cd &amp;#34;/opt/safeline&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#60a0b0;font-style:italic&#34;&gt;# wget &amp;#34;https://waf-ce.chaitin.cn/release/latest/compose.yaml&amp;#34;  -O docker-compose.yaml&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#60a0b0;font-style:italic&#34;&gt;# docker-compose  up -d&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#60a0b0;font-style:italic&#34;&gt;# docker-compose ps &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Name                     Command                  State                            Ports
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--------------------------------------------------------------------------------------------------------------------
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;safeline-bridge     /app/bridge serve -n unix  ...   Up
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;safeline-chaos      ./entrypoint.sh                  Up             9000/tcp
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;safeline-detector   /detector/entrypoint.sh          Up &lt;span style=&#34;color:#666&#34;&gt;(&lt;/span&gt;healthy&lt;span style=&#34;color:#666&#34;&gt;)&lt;/span&gt;   8000/tcp, 8001/tcp
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;safeline-fvm        ./fvm /app/config.yml            Up
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;safeline-luigi      /bin/sh -c /app/luigi            Up             80/tcp
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;safeline-mario      /mario/entrypoint.sh             Up &lt;span style=&#34;color:#666&#34;&gt;(&lt;/span&gt;healthy&lt;span style=&#34;color:#666&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;safeline-mgt        /docker-entrypoint.sh /bin ...   Up &lt;span style=&#34;color:#666&#34;&gt;(&lt;/span&gt;healthy&lt;span style=&#34;color:#666&#34;&gt;)&lt;/span&gt;   0.0.0.0:9443-&amp;gt;1443/tcp,:::9443-&amp;gt;1443/tcp, 80/tcp
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;safeline-pg         docker-entrypoint.sh postg ...   Up &lt;span style=&#34;color:#666&#34;&gt;(&lt;/span&gt;healthy&lt;span style=&#34;color:#666&#34;&gt;)&lt;/span&gt;   5432/tcp
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;safeline-tengine    entrypoint.sh nginx -g dae ...   Up&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The first login to Leichi requires initializing the admin account. Execute the following command:&lt;/p&gt;
&lt;div class=&#34;highlight-container&#34;&gt;

  &lt;button class=&#34;copy-code-btn outline&#34;&gt;Copy&lt;/button&gt;

  
  &lt;div class=&#34;highlight&#34;&gt;&lt;div style=&#34;background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;
&lt;table style=&#34;border-spacing:0;padding:0;margin:0;border:0;&#34;&gt;&lt;tr&gt;&lt;td style=&#34;vertical-align:top;padding:0;margin:0;border:0;&#34;&gt;
&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-3-1&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-3-1&#34;&gt;1&lt;/a&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td style=&#34;vertical-align:top;padding:0;margin:0;border:0;;width:100%&#34;&gt;
&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker &lt;span style=&#34;color:#007020&#34;&gt;exec&lt;/span&gt; safeline-mgt resetadmin&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;After executing the command, the admin account password will be randomly reset, and the output will be as follows:&lt;/p&gt;
&lt;div class=&#34;highlight-container&#34;&gt;

  &lt;button class=&#34;copy-code-btn outline&#34;&gt;Copy&lt;/button&gt;

  
  &lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[SafeLine] Initial username：admin
[SafeLine] Initial password：**********
[SafeLine] Done&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;At this point, the basic installation is complete. You just need to open port 9443 in the cloud ACL.&lt;/p&gt;
&lt;p&gt;You can access the Leichi console by opening a browser and visiting https://&lt;safeline-ip&gt;:9443/.&lt;/p&gt;
&lt;h2 id=&#34;3-website-configuration&#34;&gt;3. Website Configuration&lt;/h2&gt;
&lt;h3 id=&#34;ssl-certificate-configuration&#34;&gt;SSL Certificate Configuration:&lt;/h3&gt;
&lt;p&gt;Supports both custom uploading of certificates and applying for free certificates.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://wnote.com/images/2024/safeline1002.png&#34; alt=&#34;Add Certificate&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;add-site&#34;&gt;Add Site:&lt;/h3&gt;
&lt;p&gt;Add a site. By default, CAPTCHA, identity verification, and dynamic protection are already enabled. Note that when adding upstream servers, the origin configuration is somewhat vague, such as the origin port and protocol.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://wnote.com/images/2024/safeline1001.png&#34; alt=&#34;Add Site&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;proxy-configuration&#34;&gt;Proxy Configuration:&lt;/h3&gt;
&lt;p&gt;&lt;img src=&#34;https://wnote.com/images/2024/safeline1003.png&#34; alt=&#34;Proxy Configuration&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;security-protection-settings&#34;&gt;Security Protection Settings:&lt;/h3&gt;
&lt;p&gt;Here, you mainly configure rate limits (similar to Nginx limit), custom rules (based on HTTP header information), and semantic analysis (related to injections).&lt;/p&gt;
&lt;p&gt;Rate Limiting: The underlying logic is similar to Nginx&amp;rsquo;s &lt;code&gt;limit_req&lt;/code&gt;, &lt;code&gt;limit_conn&lt;/code&gt;, and &lt;code&gt;limit_rate&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://wnote.com/images/2024/safeline1004.png&#34; alt=&#34;Rate Limiting&#34;&gt;&lt;/p&gt;
&lt;p&gt;Custom Rules: Mainly based on HTTP header information to set policies, similar to common CDN access control, but this feature is more flexible.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://wnote.com/images/2024/safeline1005.png&#34; alt=&#34;Custom Rule 1&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://wnote.com/images/2024/safeline1007.png&#34; alt=&#34;Custom Rule 2&#34;&gt;&lt;/p&gt;
&lt;p&gt;Semantic Analysis: Mainly for identifying various injections and bot detection.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://wnote.com/images/2024/safeline1006.png&#34; alt=&#34;Semantic Analysis&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;4-summary&#34;&gt;4. Summary&lt;/h2&gt;
&lt;p&gt;After two days of testing, Leichi basically meets the needs of my small site, but it also has many areas where it falls short.&lt;/p&gt;
&lt;p&gt;For example: Free certificate application does not support wildcard domains, and the origin server protocol is vague.&lt;/p&gt;
&lt;p&gt;Finally, here is a screenshot of the Leichi backend homepage.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://wnote.com/images/2024/safeline1008.png&#34; alt=&#34;Leichi Backend Homepage&#34;&gt;&lt;/p&gt;
&lt;p&gt;References:
&lt;a href=&#34;https://docs.waf-ce.chaitin.cn/zh/home&#34;&gt;https://docs.waf-ce.chaitin.cn/zh/home&lt;/a&gt;&lt;/p&gt;
</description>
      
    </item>
    
    <item>
      <title>Some summaries and reflections on CDN construction</title>
      <link>https://wanzi.dev/post/linux-cdn-cloud-aliyun-cloudfront/</link>
      <pubDate>Wed, 07 Sep 2022 12:22:42 +0800</pubDate>
      <author>wzdushu@gmail.com (wanzi)</author>
      <guid>https://wanzi.dev/post/linux-cdn-cloud-aliyun-cloudfront/</guid>
      
        <description>&lt;p&gt;The ongoing COVID-19 pandemic has repeatedly disrupted daily life and work. Over the past half year, I&amp;rsquo;ve experienced a lot—family members fell seriously ill, my grandmother passed away, and there were numerous personal matters to handle, which led me to pause blogging for six months.&lt;/p&gt;
&lt;p&gt;Amid economic downturns, many industries have begun layoffs and business scaling back. Taking advantage of recent free time, I’m summarizing my past experience with CDN services.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;i-architectural-analysis-of-large-scale-websites&#34;&gt;I. Architectural Analysis of Large-Scale Websites&lt;/h2&gt;
&lt;p&gt;In the mobile internet era, designing architectures for high-concurrency large-scale websites is far from simple. Here’s a concise overview across several key aspects:&lt;/p&gt;
&lt;h3 id=&#34;1-client-side&#34;&gt;1. Client Side:&lt;/h3&gt;
&lt;p&gt;Devices include desktop PCs, mobile phones, smart devices, etc.&lt;/p&gt;
&lt;p&gt;Browser layers mainly consist of Chrome, Microsoft IE/Edge, Safari, Firefox, Opera, etc.—classification is primarily based on browser engines.&lt;/p&gt;
&lt;p&gt;Protocol layer:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;(1) Standard web pages: HTTP/1.1, HTTP/2, QUIC&lt;/li&gt;
&lt;li&gt;(2) Streaming media: RTMP, HTTP-FLV, HLS (m3u8)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;2-cdn-layer&#34;&gt;2. CDN Layer:&lt;/h3&gt;
&lt;p&gt;For small to medium-sized websites, commercial CDN services are usually sufficient.&lt;/p&gt;
&lt;p&gt;For large or ultra-large websites, a hybrid approach—combining self-built and commercial CDN—is recommended. This will be discussed in detail later.&lt;/p&gt;
&lt;p&gt;In the CDN domain, two core components dominate: &lt;strong&gt;caching layer&lt;/strong&gt; and &lt;strong&gt;routing layer&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Depending on business scenarios, typical use cases include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Static content acceleration&lt;/li&gt;
&lt;li&gt;Dynamic content acceleration&lt;/li&gt;
&lt;li&gt;Download acceleration&lt;/li&gt;
&lt;li&gt;Audio acceleration&lt;/li&gt;
&lt;li&gt;Video acceleration&lt;/li&gt;
&lt;li&gt;Live streaming acceleration&lt;/li&gt;
&lt;li&gt;P2P acceleration&lt;/li&gt;
&lt;li&gt;Security acceleration&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;3-static-services&#34;&gt;3. Static Services:&lt;/h3&gt;
&lt;p&gt;Frontend delivery models typically involve H5, mini-programs, Android, iOS. Core assets include HTML/CSS/JS.&lt;/p&gt;
&lt;p&gt;Popular frontend frameworks: Vue, React, Angular.&lt;/p&gt;
&lt;p&gt;Typically served via Nginx or OpenResty on the backend, with SSL certificates, expiration policies, CORS configurations, etc., properly set up.&lt;/p&gt;
&lt;h3 id=&#34;4-dynamic-services&#34;&gt;4. Dynamic Services:&lt;/h3&gt;
&lt;p&gt;Based on the company’s primary programming language—commonly PHP, Java, Go, Python, etc.&lt;/p&gt;
&lt;p&gt;Most companies now run dynamic services within Docker or Kubernetes clusters.&lt;/p&gt;
&lt;p&gt;If true static/dynamic separation isn’t feasible and traffic must go through CDN, it&amp;rsquo;s advisable to configure &lt;strong&gt;origin-pull strategies&lt;/strong&gt; to minimize routing overhead.&lt;/p&gt;
&lt;h3 id=&#34;5-data-caching-layer&#34;&gt;5. Data Caching Layer:&lt;/h3&gt;
&lt;p&gt;Common solutions: Redis, Memcached.&lt;/p&gt;
&lt;p&gt;In cloud-native ecosystems, etcd and TiKV are also used for caching purposes.&lt;/p&gt;
&lt;h3 id=&#34;6-database-servers&#34;&gt;6. Database Servers:&lt;/h3&gt;
&lt;p&gt;Traditional relational databases: MySQL, MariaDB, PostgreSQL, SQL Server, Oracle, DB2.&lt;/p&gt;
&lt;p&gt;NoSQL alternatives: MongoDB, HBase, Cassandra (Facebook), etc.&lt;/p&gt;
&lt;p&gt;With increasing demands for performance and massive data handling, modern distributed databases are gaining traction:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;TiDB (open-source by PingCAP)&lt;/li&gt;
&lt;li&gt;Greenplum&lt;/li&gt;
&lt;li&gt;DorisDB (open-source by Baidu)&lt;/li&gt;
&lt;li&gt;ClickHouse&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;7-distributed-storage&#34;&gt;7. Distributed Storage:&lt;/h3&gt;
&lt;p&gt;Common choices: Ceph, HDFS, GlusterFS, GFS—selected based on specific use cases.&lt;/p&gt;
&lt;p&gt;Currently, Ceph and HDFS dominate the market:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Ceph&lt;/strong&gt;: Supports block storage, object storage, and file systems; widely adopted by cloud providers. It integrates well with OpenStack and Kubernetes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;HDFS&lt;/strong&gt;: Ideal for massive data storage, often paired with Hadoop and Spark. However, its support for cloud-native environments is limited.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&#34;ii-self-built-cdn-vs-commercial-cdn&#34;&gt;II. Self-Built CDN vs. Commercial CDN?&lt;/h2&gt;
&lt;h3 id=&#34;1-choosing-between-cdn-options&#34;&gt;1. Choosing Between CDN Options&lt;/h3&gt;
&lt;p&gt;Deciding between self-building a CDN or using a commercial one depends on your company’s scale, cost constraints, and operational needs.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For &lt;strong&gt;general static file acceleration&lt;/strong&gt;, if traffic is under 10M PV/month, avoid self-building—commercial CDNs suffice. Prioritize vendors offering low cost and strong performance.&lt;/li&gt;
&lt;li&gt;For &lt;strong&gt;large file downloads&lt;/strong&gt;, if your bandwidth is constrained, don’t build your own CDN—stick with commercial options.&lt;/li&gt;
&lt;li&gt;For &lt;strong&gt;audio and on-demand video acceleration&lt;/strong&gt;, if your R&amp;amp;D team lacks expertise, opt for commercial CDNs with wide node coverage, low pricing, and proven results.&lt;/li&gt;
&lt;li&gt;For &lt;strong&gt;live streaming&lt;/strong&gt;, where user experience is critical, prioritize CDN providers with excellent network quality across their edge nodes—preferably major cloud-based CDN vendors.&lt;/li&gt;
&lt;li&gt;For &lt;strong&gt;dynamic acceleration&lt;/strong&gt; and &lt;strong&gt;security acceleration&lt;/strong&gt;, choose vendors with robust origin-pull paths and mature security mechanisms.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;2-how-to-build-your-own-cdn&#34;&gt;2. How to Build Your Own CDN?&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Hardware&lt;/strong&gt;: Select servers with high cost-performance ratios—focus on disk, memory, and CPU specs.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Data Center Bandwidth&lt;/strong&gt;: Partner with telecom agents. Prefer data centers with:
&lt;ul&gt;
&lt;li&gt;High outbound capacity&lt;/li&gt;
&lt;li&gt;Excellent network links&lt;/li&gt;
&lt;li&gt;Strong DDoS protection&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cache Nodes&lt;/strong&gt;: Choose from Nginx, Apache Traffic Server, Varnish, Squid.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Routing System&lt;/strong&gt;: Use third-party intelligent CDN solutions. If you have strong R&amp;amp;D capabilities, consider Bind View or Bind DLZ.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;High Availability &amp;amp; Load Balancing&lt;/strong&gt;: Options include LVS, Nginx, Keepalived, HAProxy.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;3-how-to-choose-a-commercial-cdn&#34;&gt;3. How to Choose a Commercial CDN?&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Domestic CDN Providers&lt;/strong&gt;:
Alibaba Cloud, Tencent Cloud, NetEase Cloud, Huawei Cloud, Baidu Cloud, Kingsoft Cloud, White Mountain Cloud, Qiniu Cloud, Blue Network, UpYun, Dalian, UCloud, QingCloud, etc.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;International CDN Providers&lt;/strong&gt;:
AWS CloudFront, Akamai, Google Cloud CDN, Fastly, Limelight, Cloudflare, StackPath, CDNetworks, etc.&lt;/p&gt;
&lt;p&gt;When selecting a CDN provider—domestic or international—consider these metrics:&lt;/p&gt;
&lt;table&gt;
	&lt;thead&gt;
			&lt;tr&gt;
					&lt;th&gt;Metric&lt;/th&gt;
					&lt;th&gt;Evaluation Criteria&lt;/th&gt;
			&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
			&lt;tr&gt;
					&lt;td&gt;(1) Node Distribution&lt;/td&gt;
					&lt;td&gt;More nodes closer to users → better acceleration&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;(2) First Screen Time&lt;/td&gt;
					&lt;td&gt;Shorter loading time → better UX&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;(3) Node Latency&lt;/td&gt;
					&lt;td&gt;Lower latency → better network path&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;(4) Download Speed&lt;/td&gt;
					&lt;td&gt;Faster download → strong server + network performance&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;(5) Packet Loss Rate&lt;/td&gt;
					&lt;td&gt;Low loss → stable end-user connectivity&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;(6) Origin Pull Rate&lt;/td&gt;
					&lt;td&gt;Lower ratio of origin requests/traffic → better offloading&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;(7) Hit Rate&lt;/td&gt;
					&lt;td&gt;Higher hit rate → more cached content → better performance&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;(8) Platform Features&lt;/td&gt;
					&lt;td&gt;Rich functionality, complete features, good UI/UX&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;(9) Support Responsiveness&lt;/td&gt;
					&lt;td&gt;How quickly the operations team responds and resolves issues&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;(10) Routing Strategy&lt;/td&gt;
					&lt;td&gt;Evaluate whether the vendor’s routing logic is rational and effective&lt;/td&gt;
			&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2 id=&#34;iii-summary&#34;&gt;III. Summary&lt;/h2&gt;
&lt;p&gt;In recent years, with the rise of cloud computing, China’s CDN industry has undergone significant consolidation. Former giants like NetEase Cloud and Blue Network have been largely overtaken by Alibaba Cloud and Tencent Cloud. Once-prominent Dalian’s business has declined, Kuaiwang was acquired by CenturyLink, White Mountain Cloud has pivoted toward edge computing, while mid-tier players like Kingsoft Cloud, UCloud, Qiniu Cloud, UpYun are gradually capturing market share.&lt;/p&gt;
&lt;p&gt;In conclusion, the future direction of the CDN industry remains uncertain. But current trends show all major vendors aggressively investing in edge computing. With advancements in 5G, AI, and containerization technologies, CDN is no longer just a standalone technology—it must continuously integrate with other innovations and ultimately serve real-world applications in our daily lives.&lt;/p&gt;
</description>
      
    </item>
    
  </channel>
</rss>
