<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Biliko's Lab</title>
        <link>https://biliko.net/</link>
        <description>一个网站，欢迎来玩</description>
        <lastBuildDate>Thu, 19 Feb 2026 01:57:32 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>zh-CN</language>
        <copyright>All rights reserved 2026, Biliko</copyright>
        <item>
            <title><![CDATA[Windows 11 跳过Microsoft账户登录]]></title>
            <link>https://biliko.net/article/2fdf965d-6485-80d2-9919-d8f41262bb66</link>
            <guid>https://biliko.net/article/2fdf965d-6485-80d2-9919-d8f41262bb66</guid>
            <pubDate>Wed, 04 Feb 2026 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-2fdf965d648580d29919d8f41262bb66"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-2fdf965d6485807f9c7ee77f39c49a0d" data-id="2fdf965d6485807f9c7ee77f39c49a0d"><span><div id="2fdf965d6485807f9c7ee77f39c49a0d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2fdf965d6485807f9c7ee77f39c49a0d" title="1、在界面中按下shift+F10快捷键。"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>1、在界面中按下shift+F10快捷键。</b></span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-2fdf965d648580318dd3d1aa30b2faa8" data-id="2fdf965d648580318dd3d1aa30b2faa8"><span><div id="2fdf965d648580318dd3d1aa30b2faa8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2fdf965d648580318dd3d1aa30b2faa8" title="2、输入命令："><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>2、输入命令：</b></span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-2fdf965d648580f8abcfeb549d2a7e03" data-id="2fdf965d648580f8abcfeb549d2a7e03"><span><div id="2fdf965d648580f8abcfeb549d2a7e03" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2fdf965d648580f8abcfeb549d2a7e03" title="3、然后创建本地账户即可。"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>3、然后创建本地账户即可。</b></span></span></h4></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Traefik 篇六：云“fail2ban”协作式防火墙CrowdSec]]></title>
            <link>https://biliko.net/article/traefik-part6</link>
            <guid>https://biliko.net/article/traefik-part6</guid>
            <pubDate>Tue, 19 Sep 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[CrowdSec的安装和配置]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-044d983826ea43d0a46af7987dcb22ae"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-blank notion-block-f08fc9afde284f8b8010f2c817ae93e3"> </div><div class="notion-callout notion-gray_background_co notion-block-3291ff33ecf1453d9165d511cd1e9fbe"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="😀">😀</span></div><div class="notion-callout-text">CrowdSec是一个免费的，开源的和协作的IPS。与Fail2Ban类似，CrowdSec读取日志并检测攻击，随后阻止/缓解这些攻击。除此之外CrowdSec还会与社区共享攻击者的信息，这意味着其他CrowdSec用户在类似环境中默认情况下将阻止攻击你的IP（反之亦然）。</div></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-89e2a5273d414a9eabd28aa33bb3c6f3" data-id="89e2a5273d414a9eabd28aa33bb3c6f3"><span><div id="89e2a5273d414a9eabd28aa33bb3c6f3" class="notion-header-anchor"></div><a class="notion-hash-link" href="#89e2a5273d414a9eabd28aa33bb3c6f3" title="📝 介绍"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">📝 介绍</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-c94497c87d2746ff9e7a62ff86434854" data-id="c94497c87d2746ff9e7a62ff86434854"><span><div id="c94497c87d2746ff9e7a62ff86434854" class="notion-header-anchor"></div><a class="notion-hash-link" href="#c94497c87d2746ff9e7a62ff86434854" title="数据流"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">数据流</span></span></h3><div class="notion-text notion-block-2e9995aae59a4dbb8c445be243ca2f9b">CrowdSec通过分析应用程序日志，将用户行为与场景进行匹配，如果发现攻击行为，则将该用户添加到阻止列表，阻止该用户的进一步访问。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-7487473cd87f47a98ec90a1384649d7f"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/989c953e5c8f5759f350ebf630eaa608.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=7487473c-d87f-47a9-8ec9-0a1384649d7f" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-0ac3320124904fbc82213dae7096048f" data-id="0ac3320124904fbc82213dae7096048f"><span><div id="0ac3320124904fbc82213dae7096048f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#0ac3320124904fbc82213dae7096048f" title="CrowdSec的特点"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">CrowdSec的特点</span></span></h3><div class="notion-text notion-block-da9c5a05fc9c4c34a1385765aa043575">CrowdSec与传统的IPS相比，最大的特点就是可以订阅社区封锁名单(默认也会共享本地的攻击记录到社区)，<span class="notion-red"><b>在攻击者行动前阻止攻击行为</b></span>。CrowdSec除了与Traefik配合使用，也可以直接用来保护Linux/Windows服务器、路由器等设备。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-7f091905598945cf88c63f57b0f45ff2" data-id="7f091905598945cf88c63f57b0f45ff2"><span><div id="7f091905598945cf88c63f57b0f45ff2" class="notion-header-anchor"></div><a class="notion-hash-link" href="#7f091905598945cf88c63f57b0f45ff2" title="总体架构"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">总体架构</span></span></h3><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-3a8791a7da804388986c8f065603a55b"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/a4f97f7f258e807dedd2fc3cbc819b39.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=3a8791a7-da80-4388-986c-8f065603a55b" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-8ac6d827515743f2b57fed0aa583a5ab" data-id="8ac6d827515743f2b57fed0aa583a5ab"><span><div id="8ac6d827515743f2b57fed0aa583a5ab" class="notion-header-anchor"></div><a class="notion-hash-link" href="#8ac6d827515743f2b57fed0aa583a5ab" title="安全引擎(Security Engine)"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">安全引擎(<b>Security Engine)</b></span></span></h3><div class="notion-text notion-block-948a8374c431484980a71758d36d0c39">安全引擎是CrowdSec的核心组件之一。它负责分析日志，并提供一个API端点，供修复组件获取引擎所做出的决策。</div><div class="notion-text notion-block-d2cbc3b4777648189611e207b86f6064">安全引擎运行时围绕几个简单的概念展开：</div><ol start="1" class="notion-list notion-list-numbered notion-block-e0f2cf1c866b41c1a885e520cc2fec6a" style="list-style-type:decimal"><li>它通过数据源配置读取日志。</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-7fbbf452e9cc4a40ba59defe7776db4b" style="list-style-type:decimal"><li>这些日志通过解析器进行解析，并最终进行丰富处理。</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-fbbd2a8a0715406fb19ab3ee05164aca" style="list-style-type:decimal"><li>标准化后的日志与用户部署的场景进行匹配。</li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-af5e6df3a54041e4a8fe6ce49d4123f8" style="list-style-type:decimal"><li>当一个场景被触发时，CrowdSec会生成一个警报，并可能生成一个或多个关联的决策：</li><ol class="notion-list notion-list-numbered notion-block-af5e6df3a54041e4a8fe6ce49d4123f8" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-52bc354778874a90adb9ee36a826b935"><li>警报主要用于可追溯性，即使决策过期后仍然存在。</li></ul><ul class="notion-list notion-list-disc notion-block-103a59cc6dad4f28a7449176eee79f3c"><li>决策则具有短暂的生命周期，告知针对违规的IP/范围/用户应采取的行动。</li></ul></ol></ol><ol start="5" class="notion-list notion-list-numbered notion-block-8898b7bdd00c4d9cbd10acb40233681b" style="list-style-type:decimal"><li>这些信息（信号、关联的决策）随后被发送到本地API并存储在数据库中。</li></ol><ol start="6" class="notion-list notion-list-numbered notion-block-184316a687294c27b293e73a1235b5bb" style="list-style-type:decimal"><li>正如你现在可能已经猜到的那样，安全引擎本身负责检测部分并存储这些决策。然后，修复组件可以通过相同的本地API“消费”这些决策，并应用修复措施。</li></ol><div class="notion-callout notion-gray_background_co notion-block-5fa9e7903db545fabfca469731ef0735"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">什么是<b>解析器(Parsers)</b>？<div class="notion-text notion-block-81b347f51e0d43a2b671082719c44463"><b>解析器</b>将日志格式分解为可读的信息，供CrowdSec应用程序使用。我们将使用Traefik解析器来获取Traefik访问日志，并将该信息传递给CrowdSec应用程序进行决策。</div></div></div><div class="notion-callout notion-gray_background_co notion-block-429e71a4303648219dd089ef4df7f0ae"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">什么是<b>场景(Scenarios)</b>？<div class="notion-text notion-block-c8fff96a23594c6d9fda44bdb011d720">一个<b>场景</b>是一种行为，即正在发生的暴力攻击。您可以选择要针对哪些场景检查流量。在这个Traefik集合中，我们将使用典型的HTTP行为。</div></div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-2403a143498340beae26fe31f26895ab" data-id="2403a143498340beae26fe31f26895ab"><span><div id="2403a143498340beae26fe31f26895ab" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2403a143498340beae26fe31f26895ab" title="修复组件(Remediation Components)"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">修复组件(<b>Remediation Components)</b></span></span></h3><div class="notion-text notion-block-bb62d62bb891464096aa1e9c574e278a">修复组件是负责根据安全引擎提供的决策采取行动的软件包，一般被称为<b>保镖(Bouncers)。</b></div><div class="notion-callout notion-gray_background_co notion-block-8e14c3f344964a1abf120b69e494eff5"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">什么是<b>保镖(Bouncers)</b>？<div class="notion-text notion-block-9a8640fd5a6f4da4a8b931c54a70e969"><b>保镖</b>会对CrowdSec做出的决策做出反应。在这种情况下，Traefik保镖将根据CrowdSec做出的决策，决定是允许还是拒绝通过Traefik的流量。CrowdSec本身只会做出封禁IP的决策。它会通过连接到安全引擎获取所需的信息，以便在本地做出决策。请查看<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://hub.crowdsec.net/browse/#bouncers">Hub</a>上可用的bouncers。</div></div></div><ul class="notion-list notion-list-disc notion-block-6054fdd9e94d4e87ae74c033f1c43ef0"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://hub.crowdsec.net/author/fbonalair/bouncers/traefik-crowdsec-bouncer">Traefik-crowdsec-bouncer</a>用于验证请求并根据CrowdSec做出的决策进行拒绝。</li></ul><ul class="notion-list notion-list-disc notion-block-f9a5464cbb8042a3ad12d8cad167ef15"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://doc.crowdsec.net/docs/next/bouncers/firewall">firewall bouncer</a> 会将IP添加到nftables/ipset集合中</li></ul><ul class="notion-list notion-list-disc notion-block-9178931608774476b7547122b4b7b8e3"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://doc.crowdsec.net/docs/next/bouncers/cloudflare">Cloudflare Bouncer</a>将向Cloudflare防火墙添加IP。</li></ul><ul class="notion-list notion-list-disc notion-block-c2410f846b14415f88a162623acbb6f0"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://doc.crowdsec.net/docs/next/bouncers/blocklist-mirror">blocklist mirror</a>将通过HTTP服务器将阻止列表提供给pfsense、fortinet、untangle等设备。</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-f4a0c347346a4ec1bd46265e44fa0ead" data-id="f4a0c347346a4ec1bd46265e44fa0ead"><span><div id="f4a0c347346a4ec1bd46265e44fa0ead" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f4a0c347346a4ec1bd46265e44fa0ead" title="🆗简单来说"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">🆗简单来说</span></span></h3><div class="notion-text notion-block-e805f74ed50341849fa757d9e839926f"><code class="notion-inline-code">安全引擎</code>中有一个<code class="notion-inline-code">日志解析器</code>实时监控服务日志，并根据预设的<code class="notion-inline-code">场景</code>匹配如登录失败，未授权访问等条目，并对相应的IP做出决策。所以他需要部署在能够读取服务日志的地方。</div><div class="notion-text notion-block-10bec521841b4d6eb8239e4e074931b1"><code class="notion-inline-code">修复组件</code>将<code class="notion-inline-code">安全引擎</code>决策的IP下发到防火墙或其它带有访问控制的程序，它可以在多处部署，同时对决策IP进行处理。</div><div class="notion-text notion-block-7c582d61d0224f6697ee7214370ff2f1">攻击者触发一处⚠️警报，所有<code class="notion-inline-code">保镖</code>都会将ta🚫拉黑。更严重的可能导致全网CrowdSec用户将ta封禁。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-55602dbd95ce4ae798ae9216845a8db2" data-id="55602dbd95ce4ae798ae9216845a8db2"><span><div id="55602dbd95ce4ae798ae9216845a8db2" class="notion-header-anchor"></div><a class="notion-hash-link" href="#55602dbd95ce4ae798ae9216845a8db2" title="💿 安装"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">💿 安装</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-77d5dc9d5256406fab4044925725ccad" data-id="77d5dc9d5256406fab4044925725ccad"><span><div id="77d5dc9d5256406fab4044925725ccad" class="notion-header-anchor"></div><a class="notion-hash-link" href="#77d5dc9d5256406fab4044925725ccad" title="Crowdsec安装"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Crowdsec安装</span></span></h3><div class="notion-text notion-block-17660fa27d7742c4978c096d96aa69c6">在主 appdata 文件夹中创建一个子文件夹，用于告诉服务和 Crowdsec 在其中写入日志文件。这些日志文件将被 Crowdsec 集中和分析。在本文中，这个子文件夹命名为“share/Crowdsec”(appdata/share/Crowdsec)。</div><div class="notion-blank notion-block-5d3b2b76156e4e4d8d8c2861392275f7"> </div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-89c619a313b04077963ab28d9f05e2ff"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:336px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/d4260e464fed30c91955cfea52271208.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=89c619a3-13b0-4077-963a-b28d9f05e2ff" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-d5d718da2f93468684499b0395198ff0" data-id="d5d718da2f93468684499b0395198ff0"><span><div id="d5d718da2f93468684499b0395198ff0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d5d718da2f93468684499b0395198ff0" title="Bouncers"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Bouncers</span></span></h3><div class="notion-text notion-block-2fee9ee6caa44088a8415c455998abe7">可以只安装对你有用的bouncer，它们分别在不同的地方起作用。</div><div class="notion-text notion-block-62e3d36ce7fd4d63a43bd755d787b84a">更多bouncer可在<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://app.crowdsec.net/hub/remediation-components">HUB - Remediation components</a>中找到。</div><div class="notion-text notion-block-bf05f0ac8ea94defaf916a579c270566">traefik-bouncer: 对决策IP返回403</div><div class="notion-text notion-block-c04fdec91d704b07943abeeb8120795e">OpenWRT-bouncer: 决策IP加入防火墙阻止列表，丢弃数据包</div><div class="notion-text notion-block-1211494130f342d3b65304a8c815d3f6">cloudflare-bouncer: 决策IP同步到cloudflare WAF进行托管质询(人机验证)</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-c59f93f08f374c019a8bed857b7e5109" data-id="c59f93f08f374c019a8bed857b7e5109"><span><div id="c59f93f08f374c019a8bed857b7e5109" class="notion-header-anchor"></div><a class="notion-hash-link" href="#c59f93f08f374c019a8bed857b7e5109" title="Traefik-bouncer安装"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Traefik-bouncer安装</span></span></h4><div class="notion-callout notion-gray_background_co notion-block-0f463630e76d4feb8443bfc20b4edea5"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="😀">😀</span></div><div class="notion-callout-text">traefik-bouncer的目标是为Traefik实现一个CrowdSec防火墙，以阻止恶意IP访问您的服务。为此，它利用<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://doc.traefik.io/traefik/middlewares/http/forwardauth/">Traefik v2 ForwardAuth</a>中间件，并使用CrowdSec查询客户端IP。如果客户端IP在禁止列表中，它将收到HTTP代码403的响应。否则，请求将像往常一样继续进行。</div></div><div class="notion-text notion-block-a98739f8e8134849812170e51fe285d5">在Crowdsec容器运行以下命令获取API KEY：</div><div class="notion-text notion-block-b0b5df4db6204d30a770fe3bd942a5c9"><code class="notion-inline-code">cscli bouncers add traefik-bouncer</code></div><div class="notion-text notion-block-27e5fcf7267d495085c8c81a7fa0ab6b">安装traefik-bouncer容器，CROWDSEC_BOUNCER_API_KEY填写上一步获得的API key。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-c19688c244d24a2295824b94d006bbc5"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:336px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/a618ced0a2ae48d23dac544fb3a49773.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=c19688c2-44d2-4a22-9582-4b94d006bbc5" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-939a8140d011468daab6df9629dd80bc">使用<code class="notion-inline-code">cscli bouncer list</code>查看状态bouncer状态</div><details class="notion-toggle notion-block-cdc594a2a47043e1a93d994fd554eee5"><summary><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-cdc594a2a47043e1a93d994fd554eee5" data-id="cdc594a2a47043e1a93d994fd554eee5"><span><div id="cdc594a2a47043e1a93d994fd554eee5" class="notion-header-anchor"></div><span class="notion-h-title">openwrt-bouncer(可选)</span></span></h4></summary><div><div class="notion-text notion-block-c6236c69cf3c430aaa8bc2b32a4082a9">在Crowdsec容器运行以下命令获取API key：</div><div class="notion-text notion-block-fe0bd175d6724a4694506d3f063c0a1e"><code class="notion-inline-code">cscli bouncers add openwrt-bouncer</code></div><div class="notion-text notion-block-93ec26b94d884392931fde8f6a7192b0">更新软件包列表并找到luci-app-crowdsec-firewall-bouncer安装</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-cd138f0473314c6793e7017f4406dd37"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/c3388e18ab91d8d088f532ea22d56c52.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=cd138f04-7331-4c67-93e7-017f4406dd37" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-1cb287e0dc8e404f9848ff20f768681b">或使用下面的命令安装</div><div class="notion-text notion-block-f98c41599bc949a5a783468d8d344807"><code class="notion-inline-code">opkg install crowdsec-firewall-bouncer</code></div><div class="notion-text notion-block-9fa54d27802946e59d3c939e45cfc3b4">安装完成之后进行配置</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-4e6f7980556f4c6c9b25d7c67c6f9579"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/79dffc4552ead9f95b5065ce0b4e69cd.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=4e6f7980-556f-4c6c-9b25-d7c67c6f9579" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-d308437a2cf54b3a8225145812163d01">或直接修改配置文件，位于/etc/config/crowdsec，然后重新加载bouncer
<code class="notion-inline-code">/etc/init.d/crowdsec-firewall-bouncer reload</code></div><div class="notion-text notion-block-7d1a9dbf7b99436498579e298d33a6eb">查看防火墙状态</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-6487027a4e5d4d699c24b793e3e4fb22"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/9d0f249fd1ff7ebfd5f4f46a447553e7.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=6487027a-4e5d-4d69-9c24-b793e3e4fb22" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-7cd5b4b4f3734c70bc32c6dd21cc4c1a">可以看到规则已生效</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-cd0263ee7235429e9b6adf2d59ece08c"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:384px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/1a7f4e522b38ffdf6ded216a48789fec.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=cd0263ee-7235-429e-9b6a-df2d59ece08c" alt="notion image" loading="lazy" decoding="async"/></div></figure></div></details><details class="notion-toggle notion-block-5df49f981e284280bfbd6cf2b18589f4"><summary><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-5df49f981e284280bfbd6cf2b18589f4" data-id="5df49f981e284280bfbd6cf2b18589f4"><span><div id="5df49f981e284280bfbd6cf2b18589f4" class="notion-header-anchor"></div><span class="notion-h-title">cloudflare-bouncer(可选)</span></span></h4></summary><div><div class="notion-text notion-block-4cc63f7758ab476193377bee67782ee4">创建API token并设置权限</div><div class="notion-text notion-block-58ea67306332486f9a8e9736e32af880"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://dash.cloudflare.com/profile/api-tokens">https://dash.cloudflare.com/profile/api-tokens</a></div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-cbbfb9e9c2c646838a07ff19e67e0c83"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/e28fabd443133506eb8f3bcc03ae3104.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=cbbfb9e9-c2c6-4683-8a07-ff19e67e0c83" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-523eea7a4ee24f238637ed5cde0d470f">在<code class="notion-inline-code">crowdsec</code>容器运行下面的命令得到<code class="notion-inline-code">crowdsec_lapi_key</code></div><div class="notion-text notion-block-7748adff3fcf414b99571fbd9eb47f9d"><code class="notion-inline-code">cscli bouncers add cloudflarebouncer</code></div><div class="notion-text notion-block-76ba8ab52f5641bdbf2a8648318a1695">创建CF bouncer配置</div><div class="notion-text notion-block-23c242f4b3fb4f1fbee126d9f730c90e">修改其中的<code class="notion-inline-code">crowdsec_lapi_key</code> , <code class="notion-inline-code">crowdsec_lapi_url</code></div><div class="notion-text notion-gray_background notion-block-96d6f7f9b63446619552278aa3fb527d">由于cloudflare免费计划最多只能使用一个IP列表，限制10000个IP，所以我们只同步本地决策列表。</div><div class="notion-text notion-block-d25f0fb7dc8644ea86ef01cbdd7fa8b2">安装并启动crowdsec-cloudflare-bouncer</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-1d1fccdc72054341be227de217286b92"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:336px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/1ab153c7daa871a28b87975b828f6159.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=1d1fccdc-7205-4341-be22-7de217286b92" alt="notion image" loading="lazy" decoding="async"/></div></figure></div></details><div class="notion-blank notion-block-0ff29d94371e4e73b25860ee60e54466"> </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-8dd2565f007a42eb86fc2658ca9df9aa" data-id="8dd2565f007a42eb86fc2658ca9df9aa"><span><div id="8dd2565f007a42eb86fc2658ca9df9aa" class="notion-header-anchor"></div><a class="notion-hash-link" href="#8dd2565f007a42eb86fc2658ca9df9aa" title="⚙️ 配置"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>⚙️ 配置</b></span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-a1a1617a8b404a24bf088ca3d8861fa1" data-id="a1a1617a8b404a24bf088ca3d8861fa1"><span><div id="a1a1617a8b404a24bf088ca3d8861fa1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#a1a1617a8b404a24bf088ca3d8861fa1" title="Traefik启用日志"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Traefik启用日志</span></span></h3><div class="notion-text notion-block-1d4020416a9d4526a19bc0764ada7886">在 traefik 模板中创建路径映射，以便将日志文件写入之前创建的共享文件夹中。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-065325a64894475b97d43ffde9327ee4"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/7ded348d059ba1af47ffd7f26b9397c6.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=065325a6-4894-475b-97d4-3ffde9327ee4" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-5656a06334974ac399ef0fb5daa82a7a">编辑traefik静态配置文件：<code class="notion-inline-code">/mnt/user/appdata/traefik/traefik.yml</code>。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-84065b9b46bb44989a33ded5cfe8936b" data-id="84065b9b46bb44989a33ded5cfe8936b"><span><div id="84065b9b46bb44989a33ded5cfe8936b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#84065b9b46bb44989a33ded5cfe8936b" title="添加受信任的IP"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">添加受信任的IP</span></span></h3><div class="notion-text notion-block-8b667c2e11e74613bdf41fc266e7b3c2">如果您的日志中没有显示命中Traefik代理的用户的外部IP，而只显示docker网关的IP（例如：在这种情况下为172.18.x.x），那么请编辑traefik.yml文件，并在受信任的IP下添加您的docker网关IP。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-b9d68a748e414984baacb004cc873a5c" data-id="b9d68a748e414984baacb004cc873a5c"><span><div id="b9d68a748e414984baacb004cc873a5c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b9d68a748e414984baacb004cc873a5c" title="Authelia启用日志"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>Authelia</b>启用日志</span></span></h3><div class="notion-text notion-block-c738911cf46c4a54a8f1056ccd0ca198">和上面一样，编辑Authelia docker模板，将Authelia日志输出文件夹映射到共享文件夹：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-ca22b170518346a0ae309bde9e52986a"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/0a7b8ce1394539eefa9f2e6becc9efb7.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=ca22b170-5183-46a0-ae30-9bde9e52986a" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-b186cbe413e84237aa169ec23d011850">然后编辑Authelia的配置文件（appdata/authelia）中的 <code class="notion-inline-code">configuration.yml</code> 文件，以启用日志记录（找到log部分,添加配置）。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1ab3991ee870488e8d3890d228b9598d" data-id="1ab3991ee870488e8d3890d228b9598d"><span><div id="1ab3991ee870488e8d3890d228b9598d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1ab3991ee870488e8d3890d228b9598d" title="启用集合"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">启用集合</span></span></h3><div class="notion-callout notion-gray_background_co notion-block-e5a3656420074417a7949bbc794de370"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">什么是<b>集合(Collections)</b>？<div class="notion-text notion-block-04bd68a433c64f38ba0db3dfaa6fcfe6"><b>集合</b>由一组<b>解析器</b>和<b>场景</b>组成。通常每个应用服务有一个相应的集合,用来对不同结构的日志内容进行解析，如<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://hub.crowdsec.net/author/crowdsecurity/collections/nginx">Nginx，</a><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://hub.crowdsec.net/author/crowdsecurity/collections/sshd">sshd</a>，<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://hub.crowdsec.net/author/MariuszKociubinski/collections/bitwarden">Bitwarden</a>等等。在<b><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://hub.crowdsec.net/browse/#collections">Hub</a></b>查看更多Collections。</div></div></div><div class="notion-text notion-block-c65e07ce5440423bacb57c4ea307efaa">编辑docker crowdsec模板以启用 Authelia 集合，方法是将<code class="notion-inline-code">crowdsecurity/traefik</code> <code class="notion-inline-code">LePresidente/authelia</code> 添加到 COLLECTIONS 变量：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-5a54b63bd9194c63a577269e439e4710"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:672px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/34c6a083878c7f663f12ed7029ec542d.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=5a54b63b-d919-4c63-a577-269e439e4710" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-820b45405f9843568d4dbd71731dca1e">同样，也可以使用命令：</div><div class="notion-text notion-block-19905a3728384ac4a8273afc7169c2bf"><code class="notion-inline-code">cscli collections install crowdsecurity/traefik</code></div><div class="notion-text notion-block-fb35025150484df380372edb08b9e832"><code class="notion-inline-code">cscli collections install LePresidente/authelia</code></div><div class="notion-text notion-block-6bb36c5a27cd4675a4bcb287be2e134a">最后，在crowdsec的appdata文件夹（appdata/crowdsec）中编辑<code class="notion-inline-code">acquis.yml</code>文件以添加以下行：（不要留下任何空格）</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-e8e2943e3c1f43948a1442176c5552ea" data-id="e8e2943e3c1f43948a1442176c5552ea"><span><div id="e8e2943e3c1f43948a1442176c5552ea" class="notion-header-anchor"></div><a class="notion-hash-link" href="#e8e2943e3c1f43948a1442176c5552ea" title="添加CrowdSec中间件"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">添加CrowdSec中间件</span></span></h3><div class="notion-text notion-block-161e0ecab9584d80b72c3801a9377206">再次编辑traefik静态配置文件(traefik.yml)，然后编辑动态配置文件(fileConfig.yml)在对应的节点位置添加</div><div class="notion-text notion-block-d96e7ad2b6234f3184108374d512c929">traefik.yml</div><div class="notion-text notion-block-9e972813e7a24885b578f4b2b67fd301">fileConfig.yml</div><div class="notion-text notion-block-532b7c7698f04691812f0b46789280db">重启CrowdSec和Traefik。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-a4d16d07e3154a04bfc8a10d5d107b5a" data-id="a4d16d07e3154a04bfc8a10d5d107b5a"><span><div id="a4d16d07e3154a04bfc8a10d5d107b5a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#a4d16d07e3154a04bfc8a10d5d107b5a" title="☁️ 注册CrowdSec"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">☁️ 注册CrowdSec</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-4b4cf992bb524655a29bbe1b2ad639f7" data-id="4b4cf992bb524655a29bbe1b2ad639f7"><span><div id="4b4cf992bb524655a29bbe1b2ad639f7" class="notion-header-anchor"></div><a class="notion-hash-link" href="#4b4cf992bb524655a29bbe1b2ad639f7" title="注册账号"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">注册账号</span></span></h3><div class="notion-row"><a target="_blank" rel="noopener noreferrer" class="notion-bookmark notion-block-63f85ded31474d4cae3324c93f22d067" href="https://app.crowdsec.net/"><div><div class="notion-bookmark-title">CrowdSec Console</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-icon"><img src="biliko.notion.site/image/https%3A%2F%2Fapp.crowdsec.net%2Ffavicon.ico?table=block&amp;id=63f85ded-3147-4d4c-ae33-24c93f22d067&amp;t=63f85ded-3147-4d4c-ae33-24c93f22d067" alt="CrowdSec Console" loading="lazy" decoding="async"/></div><div class="notion-bookmark-link-text">https://app.crowdsec.net/</div></div></div></a></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-09418b62dd1c4e1cae28a1b5cf283b30" data-id="09418b62dd1c4e1cae28a1b5cf283b30"><span><div id="09418b62dd1c4e1cae28a1b5cf283b30" class="notion-header-anchor"></div><a class="notion-hash-link" href="#09418b62dd1c4e1cae28a1b5cf283b30" title="添加安全引擎"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">添加安全引擎</span></span></h3><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-36ed056cae004644b9d8fb9313628be6"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/7774059ef2bb0e292dc28d2b50f5bb0c.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=36ed056c-ae00-4644-b9d8-fb9313628be6" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-e0934fcd4d634eba82efbc593d554cac" data-id="e0934fcd4d634eba82efbc593d554cac"><span><div id="e0934fcd4d634eba82efbc593d554cac" class="notion-header-anchor"></div><a class="notion-hash-link" href="#e0934fcd4d634eba82efbc593d554cac" title="订阅黑名单"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">订阅黑名单</span></span></h3><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-f2062ecb25184513a1f481348c979aa6"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/8d3028d3cf0006cc3f49fd1cddc1f169.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=f2062ecb-2518-4513-a1f4-81348c979aa6" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-f6e2d65ddfaf481abf3c996e8fe7b6ba" data-id="f6e2d65ddfaf481abf3c996e8fe7b6ba"><span><div id="f6e2d65ddfaf481abf3c996e8fe7b6ba" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f6e2d65ddfaf481abf3c996e8fe7b6ba" title="成功阻止坏蛋✨"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">成功阻止坏蛋✨</span></span></h3><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-7d317c8ca47d450c8570ef508fc8eba2"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/3f933a8a992c22bebe2b97f716a6967a.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=7d317c8c-a47d-450c-8570-ef508fc8eba2" alt="notion image" loading="lazy" decoding="async"/></div></figure><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-ce9953c29254459c899cab13b51dcf90" data-id="ce9953c29254459c899cab13b51dcf90"><span><div id="ce9953c29254459c899cab13b51dcf90" class="notion-header-anchor"></div><a class="notion-hash-link" href="#ce9953c29254459c899cab13b51dcf90" title="💻 常用命令"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">💻 常用命令</span></span></h2><div class="notion-callout notion-gray_background_co notion-block-5bf4970099594bad8a2982b5e298a8c3"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">这些命令可以使用<code class="notion-inline-code">docker exec crowdsec cscli [命令]</code>通过主机运行，也可以使用<code class="notion-inline-code">docker exec -it crowdsec /bin/bash</code>命令和普通<code class="notion-inline-code">cscli [命令]</code>从容器内运行。</div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-6a984751bb4245be8ba30be154d21b29" data-id="6a984751bb4245be8ba30be154d21b29"><span><div id="6a984751bb4245be8ba30be154d21b29" class="notion-header-anchor"></div><a class="notion-hash-link" href="#6a984751bb4245be8ba30be154d21b29" title="Metrics"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Metrics</span></span></h3><div class="notion-text notion-block-75ef5e8aa25f4bb98fccb65533da2974">这个命令将显示指标（解析的日志、存储桶、各种统计信息）。如果您想在容器内运行这个命令，可以运行：</div><div class="notion-text notion-block-524af8abbcf64f1e9b068d1a015f9cb8"><code class="notion-inline-code">docker exec -it crowdsec /bin/bash</code></div><div class="notion-text notion-block-f77621623bde4ba2a307f7392ed06488"><code class="notion-inline-code">cscli metrics</code></div><div class="notion-text notion-block-859e7d1b508c4712906e225adacef096">或者直接从主机运行：</div><div class="notion-text notion-block-cbbbca24fbe547759c0c1d4f35821dab"><code class="notion-inline-code">docker exec crowdsec cscli metrics</code></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-db127b6c96ed499d9dd8ebca6ad1ced0" data-id="db127b6c96ed499d9dd8ebca6ad1ced0"><span><div id="db127b6c96ed499d9dd8ebca6ad1ced0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#db127b6c96ed499d9dd8ebca6ad1ced0" title="Hub列表"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Hub列表</span></span></h3><div class="notion-text notion-block-445b7d0e156b48059d20b7e15403a23b">这个命令将让您看到部署了哪些解析器和场景。</div><div class="notion-text notion-block-6947583d8764437ab67703584f9107df"><code class="notion-inline-code">cscli hub list</code></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-95b2d29ddb614028a1914920f6ac78ac" data-id="95b2d29ddb614028a1914920f6ac78ac"><span><div id="95b2d29ddb614028a1914920f6ac78ac" class="notion-header-anchor"></div><a class="notion-hash-link" href="#95b2d29ddb614028a1914920f6ac78ac" title="决策列表"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">决策列表</span></span></h3><div class="notion-text notion-block-7bd6242db1bb40378352895282142405">这个命令可以查看哪些IP被禁止访问，非常有用，可以检查是否在访问服务器时突然出现了“Forbidden”页面如果您想在容器内运行这个命令，可以运行：</div><div class="notion-text notion-block-88a269b4f8c84f06a77468188d5e16b1"><code class="notion-inline-code">cscli decisions list</code></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-7dd68e4659594698bb09527cd488b601" data-id="7dd68e4659594698bb09527cd488b601"><span><div id="7dd68e4659594698bb09527cd488b601" class="notion-header-anchor"></div><a class="notion-hash-link" href="#7dd68e4659594698bb09527cd488b601" title="告警列表"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">告警列表</span></span></h3><div class="notion-text notion-block-eaa71a1a349748c88f695ef0d3ac322c">告警列表将允许您查看和检查 CrowdSec 通知，即检测到对服务器的攻击。</div><div class="notion-text notion-block-c70196af667949bebcd7ed2b512fc912"><code class="notion-inline-code">cscli alerts list</code></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-6cc1aed36cb64b49a2068fbf255433cf" data-id="6cc1aed36cb64b49a2068fbf255433cf"><span><div id="6cc1aed36cb64b49a2068fbf255433cf" class="notion-header-anchor"></div><a class="notion-hash-link" href="#6cc1aed36cb64b49a2068fbf255433cf" title="阻止IP"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">阻止IP</span></span></h3><div class="notion-text notion-block-a168eaccaf32444d98d246d743abe289">添加一个 IP 到阻止列表，你可以添加你的 IP 来测试它是否阻止请求。</div><div class="notion-text notion-block-8ccda5904a9c4558b224b1a00899d9d2"><code class="notion-inline-code">cscli decisions add --ip 1.2.3.4</code></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-7ecf671f6147412c88c5fbd86cfcb379" data-id="7ecf671f6147412c88c5fbd86cfcb379"><span><div id="7ecf671f6147412c88c5fbd86cfcb379" class="notion-header-anchor"></div><a class="notion-hash-link" href="#7ecf671f6147412c88c5fbd86cfcb379" title="允许IP"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">允许IP</span></span></h3><div class="notion-text notion-block-261111f37f184a91b699b4a430995e44">从阻止列表中删除一个 IP，在某些情况下，这将有助于解除自己的禁令。</div><div class="notion-text notion-block-8f692e6141e044a989d68fee0e734487"><code class="notion-inline-code">cscli decisions delete -i 1.2.3.4</code></div><details class="notion-toggle notion-block-0384b7846c2c426f956c740a3fa9bcbc"><summary><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-0384b7846c2c426f956c740a3fa9bcbc" data-id="0384b7846c2c426f956c740a3fa9bcbc"><span><div id="0384b7846c2c426f956c740a3fa9bcbc" class="notion-header-anchor"></div><span class="notion-h-title">🤔<s>问题</s>（已解决）：</span></span></h2></summary><div><blockquote class="notion-quote notion-block-556d66e3a37148f88d9d97ddfafc8267"><div>👉<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://biliko.net/article/traefik-part7#d87670a41b4e4f2db052f6c51248f32e">点此查看解决方法</a></div></blockquote><div class="notion-callout notion-gray_background_co notion-block-db7ef4cc75ee4e019a5e68dc997f57ae"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="⚠️">⚠️</span></div><div class="notion-callout-text">以下内容作为备忘，不再有效</div></div><div class="notion-text notion-block-2f4e25f6ad58444883dfc89c2fbefd4e"><code class="notion-inline-code">crowdsecurity/traefik-logs</code>日志解析器默认读取Traefik日志中<code class="notion-inline-code">ClientHost</code>字段作为源IP,如果客户端通过cloudflared访问，CrowdSec可能无法获取到真实客户端IP，这时可以修改日志解析器来获取真实IP。</div><div class="notion-text notion-block-669b42983ed74e18b40fd410f0125168">traefik访问日志保留<code class="notion-inline-code">Cf-Connecting-Ip</code>，详细配置可以看<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://biliko.net/article/traefik-part8#4fcd23f390434633b005917eb3d95c61">这里</a>。</div><div class="notion-text notion-block-d223674b5f694a4ab5ddc1b870526266">修改/crowdsec/hub/parsers/s01-parse/crowdsecurity/traefik-logs.yaml</div><div class="notion-text notion-block-4d6bdbc572c44ef592ed34db993ede4a">将<code class="notion-inline-code">traefik.ClientHost</code>修改为<code class="notion-inline-code">traefik[&quot;request_Cf-Connecting-Ip&quot;]</code>或<code class="notion-inline-code">traefik[&quot;request_X-Real-Ip&quot;]</code></div><div class="notion-text notion-block-5c16e4eb9b084f4d82ec120fe45d0a40">运行下面的命令检查是否解析成功，复制一行Traefik的日志替换<code class="notion-inline-code">**log**</code></div><div class="notion-text notion-block-eb6c926c3c364b41a04064b97d4aa5e9">应该能够看到remote_addr为客户端真实IP</div></div></details><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-cd9ce3fa3c8349baad0627b78e59ac0c" data-id="cd9ce3fa3c8349baad0627b78e59ac0c"><span><div id="cd9ce3fa3c8349baad0627b78e59ac0c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#cd9ce3fa3c8349baad0627b78e59ac0c" title="📎 参考文章"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">📎 参考文章</span></span></h2><ul class="notion-list notion-list-disc notion-block-2becf89620aa4afa80fc557382501450"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.ibracorp.io/crowdsec/">CrowdSec - CrowdSec (ibracorp.io)</a></li></ul><ul class="notion-list notion-list-disc notion-block-f227389cd0ff487980124400f07e9a32"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://doc.crowdsec.net/docs/next/intro">Introduction | CrowdSec</a></li></ul><ul class="notion-list notion-list-disc notion-block-e3c6a2f95f0347d5b24cf1c872cd5144"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://openwrt.org/docs/guide-user/services/crowdsec#crowdsec_firewall_bouncer">https://openwrt.org/docs/guide-user/services/crowdsec#crowdsec_firewall_bouncer</a></li></ul><div class="notion-blank notion-block-dc574834bfae426e81853438efa994e9"> </div><div class="notion-callout notion-gray_background_co notion-block-bdbf480db43c4739b85fb86229e32302"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">有关CrowdSec安装或者使用上的问题，欢迎您在底部评论区留言，一起交流~</div></div><div class="notion-blank notion-block-82af30404be1444d8615abf75146b222"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Traefik 篇七：Cloudflare内网穿透]]></title>
            <link>https://biliko.net/article/traefik-part7</link>
            <guid>https://biliko.net/article/traefik-part7</guid>
            <pubDate>Tue, 26 Sep 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Cloudflare Tunnel和Proxy的使用]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-8c4218edf60c4b968b251d1934afd69e"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-9b501014d1a74f6892743170b2234059" data-id="9b501014d1a74f6892743170b2234059"><span><div id="9b501014d1a74f6892743170b2234059" class="notion-header-anchor"></div><a class="notion-hash-link" href="#9b501014d1a74f6892743170b2234059" title="📝 前言"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">📝 前言</span></span></h2><div class="notion-callout notion-gray_background_co notion-block-64746950eab44c53919923faf876857b"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="😀">😀</span></div><div class="notion-callout-text">本文介绍外网访问的两种方式：<div class="notion-text notion-block-eb46570e262e404cae42872dd9284278">1.无公网IP，使用Cloudflare Tunnel。</div><div class="notion-text notion-block-d5a842d628a54d20b528054a0eecbd0e">2.有公网IP，使用Cloudflare代理，路由器的端口转发和DDNS。</div><div class="notion-text notion-block-7c32d397b8ca4b37b8e9d28e3f121446">以上两种方式都使用可以绕过80/443端口封禁，并且隐蔽原始的IP地址。</div><div class="notion-text notion-block-b56e356bac4344b3be2a17e57aafa561">两种方式不冲突，可以同时使用(通过域名区分)。</div><div class="notion-text notion-block-58ad88d02fd64a828b1214d0e166896a">最后通过安装Traefik插件，获取Cloudflare代理/隧道后面客户端的真实IP。</div></div></div><div class="notion-callout notion-gray_background_co notion-block-6da4d044850d4a0197792ee97d82fefe"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">媒体服务等对带宽需求较大的不适合使用Cloudflare代理。</div></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-4e56207998c8476394f8bfa2394d9dd5" data-id="4e56207998c8476394f8bfa2394d9dd5"><span><div id="4e56207998c8476394f8bfa2394d9dd5" class="notion-header-anchor"></div><a class="notion-hash-link" href="#4e56207998c8476394f8bfa2394d9dd5" title="💻 Cloudflare Tunnel"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">💻 Cloudflare Tunnel</span></span></h2><blockquote class="notion-quote notion-block-e3e5244aeaa141de9da0091437f354fa"><div>使用 <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.cloudflare.com/en-gb/products/tunnel/">Cloudflare Tunnel</a>，您可以运行 <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://github.com/cloudflare/cloudflared"><code class="notion-inline-code">cloudflared</code></a> 服务，将位于内部网络的服务器安全地暴露在互联网上。例如，在您的内部网络上安装  后，您可以将您的本地 Web 应用程序暴露在互联网上，比如 example.com，使远程办公者可以在任何地方访问。</div><div class="notion-text notion-block-fe8cce037d184a4ba04caa0a141773c7">Cloudflare Tunnel 可以将 HTTP Web 服务器、<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/use-cases/ssh/">SSH 服务器</a>、<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/use-cases/rdp/">远程桌面</a>和其他协议安全地连接到 Cloudflare。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-70a4d19e4ac645ee94f3525051d6dd0f"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/24659d1fe9e75d76efa0b7736f9035ea.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=70a4d19e-4ac6-45ee-94f3-525051d6dd0f" alt="notion image" loading="lazy" decoding="async"/></div></figure></blockquote><div class="notion-blank notion-block-83847996412c420e8931836fc3ec9291"> </div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-7cc4983bce2245838234dd6a9849372e" data-id="7cc4983bce2245838234dd6a9849372e"><span><div id="7cc4983bce2245838234dd6a9849372e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#7cc4983bce2245838234dd6a9849372e" title="一、设置本地解析(自定义挟持域名)"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">一、设置本地解析(自定义挟持域名)</span></span></h3><div class="notion-text notion-block-dd0eac914e7b4d93997f4ab39e782bb2">假设Traefik本地IP为<code class="notion-inline-code">192.168.1.80</code>，emby服务域名为<code class="notion-inline-code">https://emby.example.com</code></div><div class="notion-text notion-block-d1213c2b320841e0826bab0f71b4bb86">以下方法任选其一：</div><details class="notion-toggle notion-block-d83d6af90b8041ea811df8046a24a6e6"><summary><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-d83d6af90b8041ea811df8046a24a6e6" data-id="d83d6af90b8041ea811df8046a24a6e6"><span><div id="d83d6af90b8041ea811df8046a24a6e6" class="notion-header-anchor"></div><span class="notion-h-title">在路由器上设置(推荐)</span></span></h4></summary><div><div class="notion-text notion-block-ec8437dd8ab149639883251369eaaf18">因为各家路由器设置方法不一样，请自行搜索<code class="notion-inline-code">路由器品牌或型号+自定义Hosts</code>，大部分可以找到对应的设置方法。</div><div class="notion-text notion-block-2c725d4033804ef29357a0a015d98be4">下面列出部分路由器的设置方法</div><ul class="notion-list notion-list-disc notion-block-16a4ccbb8c224f6abb1ee70711ced656"><li>基于linux系统的路由，如OpenWrt固件、小米路由等：</li><ul class="notion-list notion-list-disc notion-block-16a4ccbb8c224f6abb1ee70711ced656"><div class="notion-text notion-block-885a287ce934472c828c842065aa62e5">大部分智能路由器是定制的linux系统，使用root账户登录SSH，修改/etc/hosts，重启生效。</div></ul></ul><ul class="notion-list notion-list-disc notion-block-68ac14b064004c9ab11312c008c7b612"><li>OpenWrt WEB：</li><ul class="notion-list notion-list-disc notion-block-68ac14b064004c9ab11312c008c7b612"><div class="notion-text notion-block-bdbaebae030e4e94bcee41b53ca58763">网络→主机名→新增 或 网络→DHCP/DNS→自定义挟持域名</div></ul></ul><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-274b5110807f4c908e2e21c7769ca0d0"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="biliko.notion.site/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fd830565e-330b-4d2f-b216-b572f545000b%2Fd1c5164f-014c-4b43-9304-ae9e23e94580%2Fhost1.1.png?table=block&amp;id=274b5110-807f-4c90-8e2e-21c7769ca0d0&amp;t=274b5110-807f-4c90-8e2e-21c7769ca0d0" alt="notion image" loading="lazy" decoding="async"/></div></figure><ul class="notion-list notion-list-disc notion-block-1ce1854951dc452387ffbeeb069bfec2"><li>小米路由：</li><ul class="notion-list notion-list-disc notion-block-1ce1854951dc452387ffbeeb069bfec2"><div class="notion-text notion-block-a504dfd07cf44582b4dedff74f73885c">米家APP→路由器卡片更多操作→路由应用→自定义Hosts。</div></ul></ul><ul class="notion-list notion-list-disc notion-block-17e3438db7b9419bad984a070a68348b"><li>爱快固件：</li><ul class="notion-list notion-list-disc notion-block-17e3438db7b9419bad984a070a68348b"><div class="notion-text notion-block-e6cc74731eab4a258ad5b91e43a3417d">网络设置→DNS设置→DNS设置→增加→填写要劫持的域名和IP→保存。</div></ul></ul><ul class="notion-list notion-list-disc notion-block-917ec41a509b45c2b32dba578eb1a445"><li>极路由:</li><ul class="notion-list notion-list-disc notion-block-917ec41a509b45c2b32dba578eb1a445"><div class="notion-text notion-block-820abe6c1f9c4845a2e93a9cd1c95b66">在应用中心，安装自定义hosts，添加劫持，重启路由器即可。</div></ul></ul><ul class="notion-list notion-list-disc notion-block-556e7b1d738e4f3db8687b61c761716d"><li>斐讯路由:</li><ul class="notion-list notion-list-disc notion-block-556e7b1d738e4f3db8687b61c761716d"><div class="notion-text notion-block-1cb111701d144b70a574c5efe4ee97db">功能设置→高级设置→HOST配置或高级设置→系统设置→系统参数→hosts配置，使用标准hosts格式。</div></ul></ul><ul class="notion-list notion-list-disc notion-block-e8c0f02bc5dd4ffc9b8eae90581bc54b"><li>潘多拉固件:</li><ul class="notion-list notion-list-disc notion-block-e8c0f02bc5dd4ffc9b8eae90581bc54b"><div class="notion-text notion-block-0ae02399388d41bab0a8855ff1233fb8">网络→DHCP/DNS→HOSTS和解析文件→自定义DNS解析，根据提示添加即可。</div></ul></ul><ul class="notion-list notion-list-disc notion-block-24a953f40d9f49229dc5cbb2fc5eadc3"><li>华硕梅林固件：</li><ul class="notion-list notion-list-disc notion-block-24a953f40d9f49229dc5cbb2fc5eadc3"><div class="notion-text notion-block-7e9fb9fdff4b49cc8a5c74a199013a50">首先登陆路由器后台，在系统管理→系统设置中开启<code class="notion-inline-code">JFFS</code>和<code class="notion-inline-code">SSH</code>，然后重启路由器。</div><div class="notion-text notion-block-bf07077369094a4aa33095f48c186d8a">使用SSH登陆路由器，在<code class="notion-inline-code">/jffs/configs</code>下建立<code class="notion-inline-code">dnsmasq.conf.add</code>文件，文件内容<code class="notion-inline-code">addn-hosts=/jffs/configs/hosts</code></div><div class="notion-text notion-block-edde55bc60994e5bbc2893b2af8a451c">在<code class="notion-inline-code">/jffs/configs</code>下创建自己的hosts文件，按照标准hosts规则填写需劫持的域名，然后执行service restart_dnsmasq重启或者重启路由器即可生效。</div></ul></ul><ul class="notion-list notion-list-disc notion-block-c45be4e6470847bc9b8b193ca227f0a7"><li>老毛子固件：</li><ul class="notion-list notion-list-disc notion-block-c45be4e6470847bc9b8b193ca227f0a7"><div class="notion-text notion-block-151af47962a7413ba2bb045ea77623c8">内部网络→DHCP服务器→自定义HOSTS文件→添加一行→保存，重启生效。</div></ul></ul></div></details><details class="notion-toggle notion-block-68c4a69bdb864b46a951f6bc3bbadf5d"><summary><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-68c4a69bdb864b46a951f6bc3bbadf5d" data-id="68c4a69bdb864b46a951f6bc3bbadf5d"><span><div id="68c4a69bdb864b46a951f6bc3bbadf5d" class="notion-header-anchor"></div><span class="notion-h-title">自建DNS服务</span></span></h4></summary><div><div class="notion-text notion-block-a0c6c5f8dd5b4648af87702b930cd46e">DNS服务器需要长期稳定运行，有条件的可以装一个AdGuard-Home。</div><ul class="notion-list notion-list-disc notion-block-a5d220a1f712444a908fa5dae38c8e29"><li>AdGuard-Home:</li><ul class="notion-list notion-list-disc notion-block-a5d220a1f712444a908fa5dae38c8e29"><div class="notion-text notion-block-1f2818de1d584178a7b14f76e92940a3"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://hub.docker.com/r/adguard/adguardhome">AdGuard-Home</a>使用Docker部署时，需分配固定IP，并将路由器的首选DNS设置为该IP。</div><div class="notion-text notion-block-da29c8cbef014af3a047207156a66f8c">主页→过滤器→DNS重写</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-85bbd01b01c44c7d9b13dd2129a92695"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:432px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="biliko.notion.site/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fd830565e-330b-4d2f-b216-b572f545000b%2F2c7bc40d-f45d-4021-af69-0795ed4eb2b2%2Fadg.png?table=block&amp;id=85bbd01b-01c4-4c7d-9b13-dd2129a92695&amp;t=85bbd01b-01c4-4c7d-9b13-dd2129a92695" alt="notion image" loading="lazy" decoding="async"/></div></figure></ul></ul><ul class="notion-list notion-list-disc notion-block-ba5e0383184044ce96e4b20051f3da61"><li>Dnsmasq:</li><ul class="notion-list notion-list-disc notion-block-ba5e0383184044ce96e4b20051f3da61"><div class="notion-text notion-block-3395fc63112940a4814dcec626e6c68a">在<code class="notion-inline-code">/etc/dnsmasq.conf</code>添加一行：</div><div class="notion-text notion-block-b0f904f25a1f4f079af3223bab98ee6d"><code class="notion-inline-code">address=/example.com/192.168.1.80</code></div></ul></ul><ul class="notion-list notion-list-disc notion-block-0597b153a7494ce684ea731da07e38b4"><li>SmartDNS:</li><ul class="notion-list notion-list-disc notion-block-0597b153a7494ce684ea731da07e38b4"><div class="notion-text notion-block-c0366ed49ee84fea91950df49d19f3a5">域名地址添加一行：</div><div class="notion-text notion-block-3cd4cf135d0c46c4986ff1ebb9037925"><code class="notion-inline-code">address /example.com/192.168.1.80</code></div><div class="notion-callout notion-gray_background_co notion-block-fb171bfcced64767935e5e55d7498ee2"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">address选项中:<ul class="notion-list notion-list-disc notion-block-d4f7fed084d149398a7608f7977f809d"><li>/domain/为后缀匹配算法，范围包含其子域名。</li></ul><ul class="notion-list notion-list-disc notion-block-c66e64c5069d4c3fbb1b2b31be1486ff"><li>ip: 可以为IPV6，或IPV4地址，可以指定多个IP地址，如果有多个IP地址，查询的时候，将会进行随机排序。</li></ul></div></div><div class="notion-callout notion-gray_background_co notion-block-8ff4d0e29406478181750e86c0d827c1"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">前缀通配与主域名匹配<div class="notion-text notion-block-4db963d4c5ac43d397db8c5d5c59bc50">// 通配
*-a.example.com
// 仅匹配子域名
*.example.com
// 仅匹配主域名
-.example.com</div><div class="notion-text notion-block-4413c57b80e64d8d92256c091e1a0854">注意：* 和 - 仅支持写在域名开头。其他位置的写法均不支持。</div></div></div></ul></ul></div></details><details class="notion-toggle notion-block-550ad3baded44a13939c9ab39be96969"><summary><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-550ad3baded44a13939c9ab39be96969" data-id="550ad3baded44a13939c9ab39be96969"><span><div id="550ad3baded44a13939c9ab39be96969" class="notion-header-anchor"></div><span class="notion-h-title"><b>添加记录到容器hosts</b></span></span></h4></summary><div><div class="notion-text notion-block-debd4a0bf38743e29b51c3f3038b5a31">仅cloudflare tunnel使用，内网访问需额外设置。</div><div class="notion-text notion-block-7c00a77b27ad4482825dbbd98eaef006">在cloudflared容器的高级视图中</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-61da1f2f9e8f4b2790ba4de06dfd7504"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:240px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/5d54232d71259e49a3869f3f60dd8271.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=61da1f2f-9e8f-4b27-90ba-4de06dfd7504" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-8c5ae40f0d3a4aedb1d0bf8b23b31459"><code class="notion-inline-code">额外参数</code>后面加上<code class="notion-inline-code">--add-host=&#x27;emby.example.com:192.168.1.80&#x27;</code></div></div></details><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-661e0b964f464f87ae1f4e3d3ff8bef1" data-id="661e0b964f464f87ae1f4e3d3ff8bef1"><span><div id="661e0b964f464f87ae1f4e3d3ff8bef1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#661e0b964f464f87ae1f4e3d3ff8bef1" title="二、创建隧道"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">二、创建隧道</span></span></h3><ol start="1" class="notion-list notion-list-numbered notion-block-cff093b8e39244cd9330ba7b19b090fc" style="list-style-type:decimal"><li>登录至<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://one.dash.cloudflare.com/">Zero Trust</a>，然后转到Access&gt;Tunnels。</li><ol class="notion-list notion-list-numbered notion-block-cff093b8e39244cd9330ba7b19b090fc" style="list-style-type:lower-alpha"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-e8b622edfdf546e9a103a63ea7ddfa94"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:336px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/12f3a90ce8662f0e58f1214d57fed357.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=e8b622ed-fdf5-46e9-a103-a63ea7ddfa94" alt="notion image" loading="lazy" decoding="async"/></div></figure></ol></ol><ol start="2" class="notion-list notion-list-numbered notion-block-f8a60545b6f544209900284a43778147" style="list-style-type:decimal"><li>选择“Create a tunnel”。</li><ol class="notion-list notion-list-numbered notion-block-f8a60545b6f544209900284a43778147" style="list-style-type:lower-alpha"><div class="notion-text notion-block-9caee95199d94551bdc9d4532b16a65f">输入隧道的名称。例如<code class="notion-inline-code">myhome-VPC-01</code>。</div></ol></ol><ol start="3" class="notion-list notion-list-numbered notion-block-f7baa2ad91b74db2a78a9998e155737a" style="list-style-type:decimal"><li>保存好红框中的token。</li><ol class="notion-list notion-list-numbered notion-block-f7baa2ad91b74db2a78a9998e155737a" style="list-style-type:lower-alpha"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-10145a4ba74c47adad74ebc5b3846c8b"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/6ce184a4284fa588125ccd15f19d008b.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=10145a4b-a74c-47ad-ad74-ebc5b3846c8b" alt="notion image" loading="lazy" decoding="async"/></div></figure></ol></ol><ol start="4" class="notion-list notion-list-numbered notion-block-7de1328bfd354f64b2318aa80b83a6a2" style="list-style-type:decimal"><li>添加“Public hostnames”</li><ol class="notion-list notion-list-numbered notion-block-7de1328bfd354f64b2318aa80b83a6a2" style="list-style-type:lower-alpha"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-172e2f19ec674b5d8ffb0beed18622f8"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/65d94f8ccce9963d1a005c9bc190fa73.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=172e2f19-ec67-4b5d-8ffb-0beed18622f8" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-callout notion-gray_background_co notion-block-c9645356978045c59ee0c0bc11a5a18e"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">这里的Service指的是内网服务地址，如果经由Traefik则必须使用域名。也可以跳过Treafik，使用<code class="notion-inline-code">http</code>://<code class="notion-inline-code">unraid_ip:port</code></div></div></ol></ol><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-d0be631f53ac4449a7b88b8ebdcb7ed9" data-id="d0be631f53ac4449a7b88b8ebdcb7ed9"><span><div id="d0be631f53ac4449a7b88b8ebdcb7ed9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d0be631f53ac4449a7b88b8ebdcb7ed9" title="三、安装cloudflared"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">三、安装cloudflared</span></span></h3><ol start="1" class="notion-list notion-list-numbered notion-block-2d3f124f60e94151994a64a3d46c8ab5" style="list-style-type:decimal"><li>找到cloudflared点击安装</li><ol class="notion-list notion-list-numbered notion-block-2d3f124f60e94151994a64a3d46c8ab5" style="list-style-type:lower-alpha"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-be5f9007b6a947a480354650a139e5a0"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:336px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/22021633a097c5d6ceb7a49b2df9fd3a.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=be5f9007-b6a9-47a4-8035-4650a139e5a0" alt="notion image" loading="lazy" decoding="async"/></div></figure></ol></ol><ol start="2" class="notion-list notion-list-numbered notion-block-c4dc5612c1a0444a8fb5944131dbb192" style="list-style-type:decimal"><li>打开高级视图修改<code class="notion-inline-code">发布参数</code>，与<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://biliko.net/article/traefik-part7#f8b4c3ba105148d98ba94998c05bde61">创建隧道</a>时生成的命令一致(<code class="notion-inline-code">tunnel --no-autoupdate run --token &lt;YourToken&gt;</code>)。并在<code class="notion-inline-code">br0</code>网络分配一个IP。</li><ol class="notion-list notion-list-numbered notion-block-c4dc5612c1a0444a8fb5944131dbb192" style="list-style-type:lower-alpha"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-6a6f9946241e493db1cd9b4355a93b96"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/bbac5ad7312899fd7396366767eccf71.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=6a6f9946-241e-493d-b1cd-9b4355a93b96" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-d0b16c05d7544809b1d4604742646a41">此IP需要添加到Traefik受信任的IP列表中traefik.yml:</div></ol></ol><ol start="3" class="notion-list notion-list-numbered notion-block-5145034ad12f4be48b9fea141fd619bc" style="list-style-type:decimal"><li>启动容器</li></ol><div class="notion-callout notion-gray_background_co notion-block-630e423845194209a9f5a8bbd00a3028"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><b>注意</b><div class="notion-text notion-block-c468067984db4f1fa01cc160193f8b8c">cloudflared使用QUIC协议，如果路由器上运行有openclash，建议关闭UDP流量转发或排除cloudflared，否则可能会连接失败。</div></div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-64c67d69c53d4e7f8e8313a524ccd8ef" data-id="64c67d69c53d4e7f8e8313a524ccd8ef"><span><div id="64c67d69c53d4e7f8e8313a524ccd8ef" class="notion-header-anchor"></div><a class="notion-hash-link" href="#64c67d69c53d4e7f8e8313a524ccd8ef" title="四、完成"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">四、完成</span></span></h3><div class="notion-text notion-block-1fb37ca588f84fdf9c9bec3011675490">Tunnel状态变为HEALTHY就完成了。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-8c0be2bf609d49c693d3403c1648d4af"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/b83b3b3c7fee95f26838c36120942c67.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=8c0be2bf-609d-49c6-93d3-403c1648d4af" alt="notion image" loading="lazy" decoding="async"/></div></figure><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-119841d490734aa285aced0f05884b51" data-id="119841d490734aa285aced0f05884b51"><span><div id="119841d490734aa285aced0f05884b51" class="notion-header-anchor"></div><a class="notion-hash-link" href="#119841d490734aa285aced0f05884b51" title="🌐 Cloudflare 代理"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">🌐 Cloudflare 代理</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-26bc02ca9ea947f4ac5ec10bf4d59464" data-id="26bc02ca9ea947f4ac5ec10bf4d59464"><span><div id="26bc02ca9ea947f4ac5ec10bf4d59464" class="notion-header-anchor"></div><a class="notion-hash-link" href="#26bc02ca9ea947f4ac5ec10bf4d59464" title="一、端口转发设置"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">一、端口转发设置</span></span></h3><div class="notion-text notion-block-2310eef0c19d4fa38b8480de28dc43f2">在路由器<code class="notion-inline-code">网络</code>-<code class="notion-inline-code">防火墙</code>-<code class="notion-inline-code">端口转发</code>中新增一条转发将路由器WAN口的<code class="notion-inline-code">8443</code>端口的流量转发到Traefik(192.168.1.80)的<code class="notion-inline-code">443</code>端口。其中<code class="notion-inline-code">8443</code>也可以是其他Cloudfare支持的流量代理端口。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-938bc056ca7e43c1b15d3b96ea2741e7"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/97072c9d1dad1df4ab19a511584619c3.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=938bc056-ca7e-43c1-b15d-3b96ea2741e7" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-callout notion-gray_background_co notion-block-18bd1cb2203440b48358f2b33cdc90c1"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><b>Cloudfare默认情况下支持流量代理端口如下：</b><div class="notion-row notion-block-4fd4201a7d4e492f8867a115314e376f"><div class="notion-column notion-block-ec3d12e4e5974e1ea007f7cda10e43f7" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.5)"><div class="notion-text notion-block-81482c640c054adeae5d0e7538410982">HTTP端口</div><ul class="notion-list notion-list-disc notion-block-8bbe0c7ce1a24f39816a07d86dd1d724"><li>80</li></ul><ul class="notion-list notion-list-disc notion-block-56084d30cee9467da3cd34a1543452a6"><li>8080</li></ul><ul class="notion-list notion-list-disc notion-block-c2d69480699a48819be19cf706e7c953"><li>8880</li></ul><ul class="notion-list notion-list-disc notion-block-8dd43240db434ddd98609300716beb13"><li>2052</li></ul><ul class="notion-list notion-list-disc notion-block-683cd60585404b589752ebcb9d7786e8"><li>2082</li></ul><ul class="notion-list notion-list-disc notion-block-96ffc646f6ac4517883488dfa104e6d5"><li>2086</li></ul><ul class="notion-list notion-list-disc notion-block-23cb70de865e48fd956c79245fd7c72e"><li>2095</li></ul></div><div class="notion-spacer"></div><div class="notion-column notion-block-84c1dc37d7da4f529a7711ccb0655100" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.5)"><div class="notion-text notion-block-c7987457dc8b4a7d9c0d7a93d617e625">HTTPS端口</div><ul class="notion-list notion-list-disc notion-block-6b78df2951134ef48e5f323543cf8083"><li>443</li></ul><ul class="notion-list notion-list-disc notion-block-c3d821bc64fc4a3fa68f5b01d64fe48d"><li>2053</li></ul><ul class="notion-list notion-list-disc notion-block-3b1d68e3daa44e7aa6e683ad51560ad3"><li>2083</li></ul><ul class="notion-list notion-list-disc notion-block-94e44ba7f42f4edfaa67a69a43afdc39"><li>2087</li></ul><ul class="notion-list notion-list-disc notion-block-42d2c562070b472189dd4df8eb1ea0c1"><li>2096</li></ul><ul class="notion-list notion-list-disc notion-block-972c6728de43459f8c2da5746cba2f32"><li>8443</li></ul></div><div class="notion-spacer"></div></div></div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-10caaf1835a64f3cb7e81cc4a25228df" data-id="10caaf1835a64f3cb7e81cc4a25228df"><span><div id="10caaf1835a64f3cb7e81cc4a25228df" class="notion-header-anchor"></div><a class="notion-hash-link" href="#10caaf1835a64f3cb7e81cc4a25228df" title="二、DDNS设置"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">二、DDNS设置</span></span></h3><ol start="1" class="notion-list notion-list-numbered notion-block-f84be7ce872e4250a4636ea591567c73" style="list-style-type:decimal"><li>添加一个用于DDNS的记录</li><ol class="notion-list notion-list-numbered notion-block-f84be7ce872e4250a4636ea591567c73" style="list-style-type:lower-alpha"><div class="notion-text notion-block-221d083c37ef4dcfa6223562ef9799df"><code class="notion-inline-code">名称</code>这里使用随机生成的字符串。<code class="notion-inline-code">IPv4地址</code>目前可以随便填，注意要取消Cloudflare代理。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-078a98a3c37547aea81a2aad43fe9b88"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/9b9303585829e6644ecee28c33b07e9d.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=078a98a3-c375-47ae-a81a-2aad43fe9b88" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-callout notion-gray_background_co notion-block-153ae144b22146b9baee772a08d88712"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">为什么要单独添加一个DDNS的记录？<div class="notion-text notion-block-a8bac14bdc19465492815344e994c090">为了避免与Cloudflare API不必要的交互，详细的解释可以看这篇文章。</div><div class="notion-row"><a target="_blank" rel="noopener noreferrer" class="notion-bookmark notion-block-47fa9132e9e141bd88864cb87169f9d6" href="https://alexskra.com/blog/dynamc-dnsddns-with-openwrt-and-cloudflare/"><div><div class="notion-bookmark-title">Dynamic DNS(DDNS) with OpenWRT and Cloudflare - ALEXSKRA</div><div class="notion-bookmark-description">Do you have a changing IP? Want to use DDNS with OpenWRT and Cloudflare? Then this guide will walk you through the steps to set it up.</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-text">https://alexskra.com/blog/dynamc-dnsddns-with-openwrt-and-cloudflare/</div></div></div><div class="notion-bookmark-image"><img style="object-fit:cover" src="biliko.notion.site/image/https%3A%2F%2Falexskra.com%2Fblog%2Fwp-content%2Fuploads%2F2021%2F02%2Ffeatured-image.png?table=block&amp;id=47fa9132-e9e1-41bd-8886-4cb87169f9d6&amp;t=47fa9132-e9e1-41bd-8886-4cb87169f9d6" alt="Dynamic DNS(DDNS) with OpenWRT and Cloudflare - ALEXSKRA" loading="lazy" decoding="async"/></div></a></div></div></div></ol></ol><ol start="2" class="notion-list notion-list-numbered notion-block-bb5dd6940a6045b691bdac2c7a8daa2e" style="list-style-type:decimal"><li>添加一个CNAME记录</li><ol class="notion-list notion-list-numbered notion-block-bb5dd6940a6045b691bdac2c7a8daa2e" style="list-style-type:lower-alpha"><div class="notion-text notion-block-f15b282eae4c45a9bf73190b3b5d37f0">为了以后不用每新增一个服务就新增一个域名，<code class="notion-inline-code">名称</code>这里使用了泛域名<code class="notion-inline-code">*</code>。<code class="notion-inline-code">目标</code>则是上一步中的完整域名，并且开启Cloudflare代理。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-eb0830ec464947b3b0c6426e18e23a31"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/3a1b89a479f1c27a58233553136b459e.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=eb0830ec-4649-47b3-b0c6-426e18e23a31" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-callout notion-gray_background_co notion-block-76cc345409234ee1aca1f84e3509736d"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">泛域名<div class="notion-text notion-block-c92096faae75471381746905c1b24a2e">泛域名指在一个根域名之下，所有未建立的子域名的合集。如果某子域名已经存在，那么不在此列之中。</div><div class="notion-text notion-block-ca0f17a4282649deac6733e0baa9ef1d">利用通配符<code class="notion-inline-code">*</code>（星号）来做次级域名以实现所有的次级域名均指向同一IP地址。</div></div></div></ol></ol><ol start="3" class="notion-list notion-list-numbered notion-block-81942bd576ba439a8c146815ec7b08d9" style="list-style-type:decimal"><li>设置DDNS</li><ol class="notion-list notion-list-numbered notion-block-81942bd576ba439a8c146815ec7b08d9" style="list-style-type:lower-alpha"><div class="notion-text notion-block-68d3bd8feb614b53a47ca84a6940fcd3">在路由器的动态DNS中新建一个条目，<code class="notion-inline-code">域名</code>中的主机名与域名使用<code class="notion-inline-code">@</code> 而不是<code class="notion-inline-code">.</code>分隔。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-4d01697cfcd440d789c3d5ba5b841486"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/5ed8842ff7d7f2fca72f7c30085a64d1.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=4d01697c-fcd4-40d7-89c3-d5ba5b841486" alt="notion image" loading="lazy" decoding="async"/></div></figure></ol></ol><ol start="4" class="notion-list notion-list-numbered notion-block-394f0252a61148b8a607f39dbd7a0d29" style="list-style-type:decimal"><li>完成</li><ol class="notion-list notion-list-numbered notion-block-394f0252a61148b8a607f39dbd7a0d29" style="list-style-type:lower-alpha"><div class="notion-text notion-block-45a6802211cb4843b4b378db16a11168">等待几分钟后，前面手动设置的192.168.1.10，已经自动更新为本地公网IP。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-fbe8c76a04a746abb4b2d256a2d7f92e"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/1aa9cb09f71dcd8423826375f20e97cf.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=fbe8c76a-04a7-46ab-b4b2-d256a2d7f92e" alt="notion image" loading="lazy" decoding="async"/></div></figure></ol></ol><div class="notion-blank notion-block-06fa78674d7b466c9c65fe5848105a96"> </div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-655ed81b41954a269562990c5b388916" data-id="655ed81b41954a269562990c5b388916"><span><div id="655ed81b41954a269562990c5b388916" class="notion-header-anchor"></div><a class="notion-hash-link" href="#655ed81b41954a269562990c5b388916" title="三、Origin Rules设置"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">三、<b><b>Origin Rules</b></b>设置</span></span></h3><div class="notion-text notion-block-e1f660de97f849478211f8464488796b">在Cloudflare中找到Origin Rules<b><b>设置</b></b></div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-b075cc8fe3a041cbaaa9f28a4a0f057d"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:380px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/6399a3d84e6e517ada24755bb39a0eec.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=b075cc8f-e3a0-41cb-aaa9-f28a4a0f057d" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-a4637b98bbae42af98b0407e6ac7a3ce">创建一条端口改写规则，将目标端口重写到<code class="notion-inline-code">8443</code>。这里的匹配规则可以根据需求自行设置。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-d614c1ce58d64995b0cd79fca0baeedd"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/007bf456c0d0f53f7b0afad3a94f3c27.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=d614c1ce-58d6-4995-b0cd-79fca0baeedd" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1951b7a7a55c4b6d9b2f4ef6cec8f297" data-id="1951b7a7a55c4b6d9b2f4ef6cec8f297"><span><div id="1951b7a7a55c4b6d9b2f4ef6cec8f297" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1951b7a7a55c4b6d9b2f4ef6cec8f297" title="四、完成"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">四、完成</span></span></h3><div class="notion-text notion-block-5dc541ef29dc4ee4b33675c58806de40">这个方法相较于Workers没有每日次数限制, 相对来说也更优雅, 还提供了DDoS防护和CDN缓存, 如果觉得慢还可以关闭缓存, 只用cast IP当跳板</div><div class="notion-text notion-block-2bb7fef038774736ba7062f53b3298e8">最后: 根据评论所说，建议开启DNSSEC和端到端（FULL）加密。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-d87670a41b4e4f2db052f6c51248f32e" data-id="d87670a41b4e4f2db052f6c51248f32e"><span><div id="d87670a41b4e4f2db052f6c51248f32e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d87670a41b4e4f2db052f6c51248f32e" title="👥 真实IP"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">👥 真实IP</span></span></h2><div class="notion-text notion-block-b198e86969b1480d9c6b7414a8e8f7da">如果Traefik位于Cloudflare代理/隧道后面，它将无法从外部客户端获取真实IP以及其他信息。基于客户端IP的部分功能无法生效，如CrowdSec等。</div><div class="notion-text notion-block-71f72744882a419aaac247c38a33fc9c">所以我们还需要安装<code class="notion-inline-code">Real IP from Cloudflare Proxy/Tunnel</code>插件来获取客户端真实IP。</div><div class="notion-text notion-block-24acf9fad72b4e5eb9562b8437919547">在下方找到此插件</div><div class="notion-row"><a target="_blank" rel="noopener noreferrer" class="notion-bookmark notion-block-bd4b1e6c1e204cb1877850ca5734fb90" href="https://plugins.traefik.io/plugins"><div><div class="notion-bookmark-title">Plugins</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-icon"><img src="biliko.notion.site/image/https%3A%2F%2Fplugins.traefik.io%2Fapple-touch-icon.png?table=block&amp;id=bd4b1e6c-1e20-4cb1-8778-50ca5734fb90&amp;t=bd4b1e6c-1e20-4cb1-8778-50ca5734fb90" alt="Plugins" loading="lazy" decoding="async"/></div><div class="notion-bookmark-link-text">https://plugins.traefik.io/plugins</div></div></div></a></div><div class="notion-text notion-block-7574188418424b3f986e1559e7a098e4">该插件通过CF-Connecting-IP覆盖X-Real-IP和X-Forwarded-For来解决此问题。</div><div class="notion-text notion-block-7c9a1ad60fa04085937b268c77927062">如果请求来自Cloudflare，则真实IP将是Cf-Connecting-IP（在配置文件中的最可信IP）。</div><div class="notion-text notion-block-cd0b85bba7a445e795d5fba7f083067b">该插件还将CF-Visitor方案写入X-Forwarded-Proto。（这解决了在使用CF[443]→PROXY/隧道→Traefik[80]→WP[80]时，WordPress出现的无限重定向问题）</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-59d31b82d44b4fab8d637220c4f16243" data-id="59d31b82d44b4fab8d637220c4f16243"><span><div id="59d31b82d44b4fab8d637220c4f16243" class="notion-header-anchor"></div><a class="notion-hash-link" href="#59d31b82d44b4fab8d637220c4f16243" title="插件安装"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">插件安装</span></span></h3><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-12f91b8c11884b5cb56d08093fd29ebd"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:384px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/1b612ba46de10588460dac76e969633f.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=12f91b8c-1188-4b5c-b56d-08093fd29ebd" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-742bb134c2514412bb45a56b207e950d">在静态配置文件中：</div><div class="notion-text notion-block-3da32f8dc00c45ce9fdccd5c8c68bf95">在动态配置文件中：</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-3668664206684d15b24a016a211bbabc" data-id="3668664206684d15b24a016a211bbabc"><span><div id="3668664206684d15b24a016a211bbabc" class="notion-header-anchor"></div><a class="notion-hash-link" href="#3668664206684d15b24a016a211bbabc" title="完成"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">完成</span></span></h3><div class="notion-text notion-block-68e57442bc2944bfa49b92ceea7ffdae">可以看到插件安装好后，X-Real-IP已经是客户端的真实IP了。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-49c76c437ddf4908a555d0fa7c772c3d"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://img.biliko.net/2025/03/d19e622fce41754dce3e7c7800d19060.webp?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=49c76c43-7ddf-4908-a555-d0fa7c772c3d" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-f5a82cfda816486997760a55b55f815e"> </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-3f55d4543fe74ee9ae2e11f1e8fb1f3a" data-id="3f55d4543fe74ee9ae2e11f1e8fb1f3a"><span><div id="3f55d4543fe74ee9ae2e11f1e8fb1f3a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#3f55d4543fe74ee9ae2e11f1e8fb1f3a" title="📎 参考文章"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">📎 参考文章</span></span></h2><ul class="notion-list notion-list-disc notion-block-6a7c44b1aa41471e9800e99f8dc5c38f"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/install-and-setup/tunnel-guide/remote/">Via the dashboard · Cloudflare Zero Trust docs</a></li></ul><ul class="notion-list notion-list-disc notion-block-c93b18abc99046b58ebce756529ebf1b"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://blog.cloudflare.com/zh-cn/post-quantum-tunnel-zh-cn/">介绍后量子 Cloudflare Tunnel</a></li></ul><ul class="notion-list notion-list-disc notion-block-a4984248122d45f4aded268f137b8637"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://alexskra.com/blog/dynamc-dnsddns-with-openwrt-and-cloudflare/">Dynamic DNS（DDNS） with OpenWRT and Cloudflare - ALEXSKRA</a></li></ul><ul class="notion-list notion-list-disc notion-block-5f2c59910d914cc0b934c64aec05543a"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://blog.xiaohack.org/4128.html">使用Cloudflare代理无443/80端口权限的服务器 - xiaohack&#x27;s Blog</a></li></ul><ul class="notion-list notion-list-disc notion-block-312f299b96e441a68308e4c292866f26"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.right.com.cn/forum/forum.php?mod=redirect&amp;goto=findpost&amp;ptid=8285663&amp;pid=18488097">https://www.right.com.cn/forum/forum.php?mod=redirect&amp;goto=findpost&amp;ptid=8285663&amp;pid=18488097</a></li></ul><ul class="notion-list notion-list-disc notion-block-3af1dfe4ebe44b01a63cd98f9bdb1d6c"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://wiki.archlinux.org/title/dnsmasq#Override_addresses">https://wiki.archlinux.org/title/dnsmasq#Override_addresses</a></li></ul><div class="notion-blank notion-block-4fe1857f98b74a56aec7e402c19a3e49"> </div><div class="notion-callout notion-gray_background_co notion-block-c3231b5797cb49b9a6035891d27a6903"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">有关Cloudflare使用上的问题，欢迎您在底部评论区留言，一起交流~</div></div><div class="notion-blank notion-block-d5589751b5084fdeb78145983aaf4634"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UnRAID 安装Windows Server 2022虚拟机]]></title>
            <link>https://biliko.net/article/winserver2022-install</link>
            <guid>https://biliko.net/article/winserver2022-install</guid>
            <pubDate>Tue, 02 Apr 2024 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-24641fa9d67244afa687bb2e7a74e3d4"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-8415652868684cfeb01a6b801908671f"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="😀">😀</span></div><div class="notion-callout-text">UnRAID安装Windows Server 2022虚拟机的记录。</div></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-904d6c9124cf4f1bb1a96a1db1502d11" data-id="904d6c9124cf4f1bb1a96a1db1502d11"><span><div id="904d6c9124cf4f1bb1a96a1db1502d11" class="notion-header-anchor"></div><a class="notion-hash-link" href="#904d6c9124cf4f1bb1a96a1db1502d11" title="📝 创建虚拟机"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">📝 创建虚拟机</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-6472b1ca1b584bc08ab31afc7e35e929" data-id="6472b1ca1b584bc08ab31afc7e35e929"><span><div id="6472b1ca1b584bc08ab31afc7e35e929" class="notion-header-anchor"></div><a class="notion-hash-link" href="#6472b1ca1b584bc08ab31afc7e35e929" title="配置模板"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">配置模板</span></span></h3><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-f02d9a5c0efa427eaf92a8280e325572"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/3b1fa22817dc2a9cbedcc8abf38b7c7b.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=f02d9a5c-0efa-427e-af92-a8280e325572" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-f27001627ac14355a9e76570351d1ef5">建议修改：</div><ul class="notion-list notion-list-disc notion-block-036dcbfde6d94cf19c449a28c03a5f66"><li>CPU模式：模拟</li></ul><ul class="notion-list notion-list-disc notion-block-e38409e4f1274a83a09627c39c31b287"><li>机器：Q35</li></ul><ul class="notion-list notion-list-disc notion-block-5e695fe5d9384772a554ba614ae38027"><li>BIOS: OVMF TPM</li></ul><div class="notion-text notion-block-733712d8f85b47909063e505e09742f7">下面是经过测试的配置，更多内容请参考<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.unraid.net/unraid-os/manual/vm/vm-support/#setup-the-vm-on-the-host">官方文档</a></div><table class="notion-simple-table notion-block-72501214f0334308b9b2db736b5c0d60"><tbody><tr class="notion-simple-table-row notion-simple-table-header-row notion-block-fda7fdbd9025471386b5522525729bf7"><td class="" style="width:250px"><div class="notion-simple-table-cell">Windows OS</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Machine type(s)</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BIOS</div></td></tr><tr class="notion-simple-table-row notion-block-8268289a9a5f4397abaedaaeefa51a55"><td class="" style="width:250px"><div class="notion-simple-table-cell"><b>Windows Desktop editions</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">ㅤ</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">ㅤ</div></td></tr><tr class="notion-simple-table-row notion-block-bb63424088194afbae4f5b2046493ed7"><td class="" style="width:250px"><div class="notion-simple-table-cell">Windows 7</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">i440fx, Q35</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">SeaBIOS</div></td></tr><tr class="notion-simple-table-row notion-block-f1a6ffe55de4467bb00df1855a6ebbea"><td class="" style="width:250px"><div class="notion-simple-table-cell">Windows 8.1</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">i440fx, Q35</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">SeaBIOS, OVMF</div></td></tr><tr class="notion-simple-table-row notion-block-dc15133b1d124880911abb08b625371f"><td class="" style="width:250px"><div class="notion-simple-table-cell">Windows 10</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">i440fx, Q35</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">SeaBIOS, OVMF</div></td></tr><tr class="notion-simple-table-row notion-block-55b69463a38740a5921c0ec3312ecf1b"><td class="" style="width:250px"><div class="notion-simple-table-cell">Windows 11</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">i440fx, Q35</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">OVMF TPM</div></td></tr><tr class="notion-simple-table-row notion-block-5bea88a0b437449aa28e5e97f37eb924"><td class="" style="width:250px"><div class="notion-simple-table-cell"><b>Windows Server editions</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">ㅤ</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">ㅤ</div></td></tr><tr class="notion-simple-table-row notion-block-0cb1f70302dd4ef18d0a779344b6ebe1"><td class="" style="width:250px"><div class="notion-simple-table-cell">Windows Server 2008 R2</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">i440fx, Q35</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">SeaBIOS</div></td></tr><tr class="notion-simple-table-row notion-block-1fdfeee365894a2ca52e5dccc75ea014"><td class="" style="width:250px"><div class="notion-simple-table-cell">Windows Server 2012 R2</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">i440fx, Q35</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">SeaBIOS</div></td></tr><tr class="notion-simple-table-row notion-block-d00956675fb9453a89ea725cc628e0f9"><td class="" style="width:250px"><div class="notion-simple-table-cell">Windows Server 2012 R2</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">i440fx</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">OVMF</div></td></tr><tr class="notion-simple-table-row notion-block-9362e3fdd4ee40fca19c77fc20793521"><td class="" style="width:250px"><div class="notion-simple-table-cell">Windows Server 2016</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">i440fx, Q35</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">OVMF</div></td></tr><tr class="notion-simple-table-row notion-block-ef3f66f9522c4dca9076875ecde0716e"><td class="" style="width:250px"><div class="notion-simple-table-cell">Windows Server 2019</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">i440fx, Q35</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">OVMF, OVMF TPM</div></td></tr><tr class="notion-simple-table-row notion-block-2f646be9285b4334b2795dfad9a540d5"><td class="" style="width:250px"><div class="notion-simple-table-cell">Windows Server 2022</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">i440fx, Q35</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">OVMF, OVMF TPM</div></td></tr></tbody></table><div class="notion-text notion-block-89d4dfbcbb13486ba029fc26c9dd16ce">启动后按任意键进入安装程序，如果超时会进入EFI Shell，可输入以下命令再来一遍：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-404759de3e254562bac07fca09bbde72"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/a70a7e48fd625203488d9bc1183f2e8f.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=404759de-3e25-4562-bac0-7fca09bbde72" alt="notion image" loading="lazy" decoding="async"/></div></figure><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-f035096422ea4e29b01c428896c32648" data-id="f035096422ea4e29b01c428896c32648"><span><div id="f035096422ea4e29b01c428896c32648" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f035096422ea4e29b01c428896c32648" title="开始安装"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">开始安装</span></span></h2><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-37aa3927dbc54061b2e5f8d4f04e30d2"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/e9663b8d82cc2f53ff3e27774b4e0356.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=37aa3927-dbc5-4061-b2e5-f8d4f04e30d2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-9b276e8deac3447eb8d17ef69ac8ac6a">选择带图形环境的Datacenter版。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-bfff27722f2c40858d06bf188b00e61d" data-id="bfff27722f2c40858d06bf188b00e61d"><span><div id="bfff27722f2c40858d06bf188b00e61d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#bfff27722f2c40858d06bf188b00e61d" title="加载驱动"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">加载驱动</span></span></h3><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-e05f4e9181604b4ca1afbf4c4f576d0e"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/f7cfc31d8d7149a3693bd7fc4b674844.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=e05f4e91-8160-4b4c-a1af-bf4c4f576d0e" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-e550a61aeb874e39bc9c5f808ac2f828">选择virtio中的2k22点确定。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-33e08e889a7941d0b31bc47a1f67b0cf"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/e03c144ca206cb7f9c267b315da34a64.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=33e08e88-9a79-41d0-b31b-c47a1f67b0cf" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-95780a07553c4a7a99b090354eb68401">之后按步骤正常安装。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-ac91e6fa17cd478a96443784b93a8e0f" data-id="ac91e6fa17cd478a96443784b93a8e0f"><span><div id="ac91e6fa17cd478a96443784b93a8e0f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#ac91e6fa17cd478a96443784b93a8e0f" title="安装驱动"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">安装驱动</span></span></h3><div class="notion-text notion-block-c98a1b830453491da4b37e4dc80c268d">进入系统之后运行virtio-win-guest-tools安装全部驱动。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-454a57f098694b74aca0bd45ca78f6b0"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://img.biliko.net/2024/04/fe4bbdea6f196331497422383e5b92d0.png?spaceId=d830565e-330b-4d2f-b216-b572f545000b&amp;t=454a57f0-9869-4b74-aca0-bd45ca78f6b0" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-d287fab85cef4476b45d1d6ad8c82bba" data-id="d287fab85cef4476b45d1d6ad8c82bba"><span><div id="d287fab85cef4476b45d1d6ad8c82bba" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d287fab85cef4476b45d1d6ad8c82bba" title="激活"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">激活</span></span></h3><details class="notion-toggle notion-block-212f965d648580a6928eda4f8e74af53"><summary>Microsoft-Activation-Scripts激活</summary><div><div class="notion-text notion-block-212f965d64858020a14ace2a3960e890"></div></div></details><div class="notion-blank notion-block-212f965d648580f3858beaac28636cad"> </div><div class="notion-text notion-block-a8aeef952efa4cd3ba3341a49d70dcee">安装微软官网提供的<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://learn.microsoft.com/zh-cn/windows-server/get-started/kms-client-activation-keys">产品密钥</a></div><div class="notion-text notion-block-44112e448ecc42d395ed27ff0998d0bc"><code class="notion-inline-code">slmgr /ipk WX4NM-KYWYW-QJJR4-XV3QB-6VM33</code></div><div class="notion-text notion-block-e99158a4e06b4021befff32c7bd7d535">设置KMS地址，需要有可用的KMS服务器</div><div class="notion-text notion-block-15feb03bc61948ce84abcf85498ac3b6"><code class="notion-inline-code">slmgr /skms [IP]</code></div><div class="notion-text notion-block-8afd15ad9edc4f3589dc60f21e812da2">激活</div><div class="notion-text notion-block-22ae1ee7d399483693636939deb746d0"><code class="notion-inline-code">slmgr /ato</code></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-b0a2c9c1017341158cae58e7c5851d20" data-id="b0a2c9c1017341158cae58e7c5851d20"><span><div id="b0a2c9c1017341158cae58e7c5851d20" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b0a2c9c1017341158cae58e7c5851d20" title="🤗 完成"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">🤗 完成</span></span></h2><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-f9e9440cc3d74985b7755396a962cb73" data-id="f9e9440cc3d74985b7755396a962cb73"><span><div id="f9e9440cc3d74985b7755396a962cb73" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f9e9440cc3d74985b7755396a962cb73" title="📎 参考文章"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">📎 参考文章</span></span></h2><ul class="notion-list notion-list-disc notion-block-cd9a2ba77dbb47f9b38b5f686dee6337"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://learn.microsoft.com/zh-cn/windows-server/get-started/kms-client-activation-keys#install-a-product-key">适用于 Windows Server 和 Windows 的密钥管理服务 (KMS) 客户端激活和产品密钥 | Microsoft Learn</a></li></ul><div class="notion-blank notion-block-3ac295ffbb044fb99b81d3cb4468bcec"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux 删除文件]]></title>
            <link>https://biliko.net/article/linux-rm</link>
            <guid>https://biliko.net/article/linux-rm</guid>
            <pubDate>Thu, 02 Nov 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Linux 一些查找和删除文件的命令]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-266c247aec5a4f2b929968e8b05792f6"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-e5383663719d41108d5e0a26bfcae921" data-id="e5383663719d41108d5e0a26bfcae921"><span><div id="e5383663719d41108d5e0a26bfcae921" class="notion-header-anchor"></div><a class="notion-hash-link" href="#e5383663719d41108d5e0a26bfcae921" title="Linux 删除文件"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Linux 删除文件</span></span></h2><div class="notion-callout notion-gray_background_co notion-block-261f64cd77814d95970ba93824a909f5"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="😀">😀</span></div><div class="notion-callout-text">Linux删除文件的笔记。</div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-006c7c4e1e564d319f67e25f613e3971" data-id="006c7c4e1e564d319f67e25f613e3971"><span><div id="006c7c4e1e564d319f67e25f613e3971" class="notion-header-anchor"></div><a class="notion-hash-link" href="#006c7c4e1e564d319f67e25f613e3971" title="批量删除指定文件"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">批量删除指定文件</span></span></h3><div class="notion-blank notion-block-094387c116d0448f85c4fccd121d5266"> </div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-f79a84446240434f9a3352045bceb3d9" data-id="f79a84446240434f9a3352045bceb3d9"><span><div id="f79a84446240434f9a3352045bceb3d9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f79a84446240434f9a3352045bceb3d9" title="将find结果ls出来"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">将find结果ls出来</span></span></h4><div class="notion-text notion-block-ca592bba08e54ae3a61396c4a7daf815">在上面的示例中，<code class="notion-inline-code">/path/to/directory</code>是要搜索的目录路径。<code class="notion-inline-code">-type f</code>选项用于指定只搜索文件而不是目录。<code class="notion-inline-code">-name</code> 指定文件名。<code class="notion-inline-code">-maxdepth</code>指定查找深度。<code class="notion-inline-code">-mtime</code>指定修改时间。<code class="notion-inline-code">-ls</code>输出满足条件的文件的详细信息。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-f1a999409bf64c6db39406fd113a6774" data-id="f1a999409bf64c6db39406fd113a6774"><span><div id="f1a999409bf64c6db39406fd113a6774" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f1a999409bf64c6db39406fd113a6774" title="删除10天前，以ZmF开头的文件"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">删除10天前，以ZmF开头的文件</span></span></h4><div class="notion-text notion-block-36ef50bce5884e12a1a47601f0a22c93">请注意，删除文件是一个具有潜在危险的操作，请在执行此命令之前确保您了解其影响，并且做好文件备份的准备。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-73cb60b8465e4472acda796f1af1d3b8" data-id="73cb60b8465e4472acda796f1af1d3b8"><span><div id="73cb60b8465e4472acda796f1af1d3b8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#73cb60b8465e4472acda796f1af1d3b8" title="将文件移动到临时目录，确认无误后再删除"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">将文件移动到临时目录，确认无误后再删除</span></span></h4></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux 硬盘空间扩容]]></title>
            <link>https://biliko.net/article/linux-disk-extend</link>
            <guid>https://biliko.net/article/linux-disk-extend</guid>
            <pubDate>Wed, 17 May 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Linux 硬盘空间扩容]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-41e32d02db4842f69924d1f2ff608f18"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-c8081131f27b46ed8d97afff656b9115"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="😀">😀</span></div><div class="notion-callout-text">下面是我与chatgpt的对话记录,包含了Linux空间扩容的两种方法。</div></div><div class="notion-blank notion-block-d1f70398eeed4e1ea14c4ee5f99548f8"> </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-b8292466bc2d408590632fcbd4b35fdf" data-id="b8292466bc2d408590632fcbd4b35fdf"><span><div id="b8292466bc2d408590632fcbd4b35fdf" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b8292466bc2d408590632fcbd4b35fdf" title="📝 记录"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">📝 记录</span></span></h2><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-6e6447d6d7184016b6c6264ab7dc7e2c" data-id="6e6447d6d7184016b6c6264ab7dc7e2c"><span><div id="6e6447d6d7184016b6c6264ab7dc7e2c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#6e6447d6d7184016b6c6264ab7dc7e2c" title="一、扩容/opt文件夹"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">一、扩容/opt文件夹</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-9c3b23887565438791b6b7d0d4c14125" data-id="9c3b23887565438791b6b7d0d4c14125"><span><div id="9c3b23887565438791b6b7d0d4c14125" class="notion-header-anchor"></div><a class="notion-hash-link" href="#9c3b23887565438791b6b7d0d4c14125" title="来自你的消息:"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">来自你的消息:</span></span></h3><div class="notion-text notion-block-79f075f7927944189aff8a959b4bbff8">linux系统/opt空间不足，新增一块硬盘，如何给opt文件夹扩容，要求保留opt文件夹中的文件</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-b23b471fa5e94f44b0b55d5dba64d32e" data-id="b23b471fa5e94f44b0b55d5dba64d32e"><span><div id="b23b471fa5e94f44b0b55d5dba64d32e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b23b471fa5e94f44b0b55d5dba64d32e" title="来自 ChatGPT 的消息:"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">来自 ChatGPT 的消息:</span></span></h3><div class="notion-text notion-block-82f735aa6ade4096b6f3231762f8338a">您可以按照以下步骤在Linux系统中将/opt文件夹扩容：</div><ol start="1" class="notion-list notion-list-numbered notion-block-67a1c378264246f09023ef1dfc2a250a" style="list-style-type:decimal"><li>插入新的硬盘并使用fdisk命令对其进行分区，例如将其分为一个名为/dev/sdb1的分区。</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-90616f4f2d4245d7ba08ff408187c284" style="list-style-type:decimal"><li>使用mkfs命令对新分区进行格式化，例如使用ext4格式：</li><ol class="notion-list notion-list-numbered notion-block-90616f4f2d4245d7ba08ff408187c284" style="list-style-type:lower-alpha"></ol></ol><ol start="3" class="notion-list notion-list-numbered notion-block-270ae321bc494e1794292a9b6ba0d4de" style="list-style-type:decimal"><li>创建一个新的挂载点，例如在/mnt目录下创建一个名为newdrive的文件夹：</li><ol class="notion-list notion-list-numbered notion-block-270ae321bc494e1794292a9b6ba0d4de" style="list-style-type:lower-alpha"></ol></ol><ol start="4" class="notion-list notion-list-numbered notion-block-b9607f96ed7444e3960ec4d91fca36b8" style="list-style-type:decimal"><li>将新分区挂载到新的挂载点：</li><ol class="notion-list notion-list-numbered notion-block-b9607f96ed7444e3960ec4d91fca36b8" style="list-style-type:lower-alpha"></ol></ol><ol start="5" class="notion-list notion-list-numbered notion-block-cf78bc91e8ab46abb65dea109089119f" style="list-style-type:decimal"><li>使用rsync命令将/opt文件夹中的所有文件复制到新的挂载点：</li><ol class="notion-list notion-list-numbered notion-block-cf78bc91e8ab46abb65dea109089119f" style="list-style-type:lower-alpha"></ol></ol><ol start="6" class="notion-list notion-list-numbered notion-block-a6af643ef6044c288a64f97c40c1ee27" style="list-style-type:decimal"><li>将/opt文件夹重命名为/opt_old：</li><ol class="notion-list notion-list-numbered notion-block-a6af643ef6044c288a64f97c40c1ee27" style="list-style-type:lower-alpha"></ol></ol><ol start="7" class="notion-list notion-list-numbered notion-block-6cd6001df49947efbaea7f2bc29accd7" style="list-style-type:decimal"><li>创建一个新的/opt文件夹并将新的挂载点挂载到该文件夹：</li><ol class="notion-list notion-list-numbered notion-block-6cd6001df49947efbaea7f2bc29accd7" style="list-style-type:lower-alpha"></ol></ol><ol start="8" class="notion-list notion-list-numbered notion-block-d1b6d2b8e0c14f099761755521660d21" style="list-style-type:decimal"><li>更新/etc/fstab文件以在系统启动时自动挂载新的硬盘：</li><ol class="notion-list notion-list-numbered notion-block-d1b6d2b8e0c14f099761755521660d21" style="list-style-type:lower-alpha"><div class="notion-text notion-block-7f9bc5ded93647f4829e5445019dbd1c">在文件末尾添加以下行：</div></ol></ol><ol start="9" class="notion-list notion-list-numbered notion-block-daba23ee7d4b4fb1a7b2116a59797817" style="list-style-type:decimal"><li>重启系统以应用更改。</li></ol><div class="notion-text notion-block-29fb1a27ea7d40efb2af190a48c0bc30">这样，您就可以将/opt文件夹扩容到新的硬盘上，并保留/opt文件夹中的所有文件。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-d5b3c36c40bb49fabec444a0c3f83dff" data-id="d5b3c36c40bb49fabec444a0c3f83dff"><span><div id="d5b3c36c40bb49fabec444a0c3f83dff" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d5b3c36c40bb49fabec444a0c3f83dff" title="二、LVM扩容"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">二、LVM扩容</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-4d33b48c9c7b45d89363a127ca562685" data-id="4d33b48c9c7b45d89363a127ca562685"><span><div id="4d33b48c9c7b45d89363a127ca562685" class="notion-header-anchor"></div><a class="notion-hash-link" href="#4d33b48c9c7b45d89363a127ca562685" title="来自你的消息:"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">来自你的消息:</span></span></h3><div class="notion-text notion-block-7fc4551d6a124d23a58faea6f052b2a8">linux系统使用lvm，/opt空间不足，新增硬盘如何操作</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-a97e183946d14e12a208d130dbadb205" data-id="a97e183946d14e12a208d130dbadb205"><span><div id="a97e183946d14e12a208d130dbadb205" class="notion-header-anchor"></div><a class="notion-hash-link" href="#a97e183946d14e12a208d130dbadb205" title="来自 ChatGPT 的消息:"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">来自 ChatGPT 的消息:</span></span></h3><div class="notion-text notion-block-84c4378cd8624343a3a2920aad9e2441">如果您的Linux系统使用了LVM（逻辑卷管理），那么您可以通过以下步骤来新增硬盘并扩展/opt空间：</div><ol start="1" class="notion-list notion-list-numbered notion-block-e6555c8ba5e74789a9b9829676ddecad" style="list-style-type:decimal"><li>插入新硬盘并使用fdisk命令对其进行分区。例如，您可以使用以下命令创建一个新的分区：</li></ol><div class="notion-text notion-block-ac5862fb2a0d4eb48378fca8ab3dd6a7">然后按照提示选择n（新建分区），p（主分区），1（分区号），选择默认的起始扇区和大小，最后选择w（保存并退出）。</div><ol start="1" class="notion-list notion-list-numbered notion-block-1ae01320826e4951988a82917affb5e4" style="list-style-type:decimal"><li>使用pvcreate命令将新分区转换为物理卷（PV）。例如，如果您的新分区为/dev/sdb1，则可以使用以下命令创建一个新的PV：</li></ol><ol start="1" class="notion-list notion-list-numbered notion-block-de93a299b4b745e89117d5482ac1387e" style="list-style-type:decimal"><li>使用vgextend命令将新的PV添加到现有的卷组（VG）中。例如，如果您的现有VG名称为vg1，则可以使用以下命令将新的PV添加到vg1中：</li></ol><ol start="1" class="notion-list notion-list-numbered notion-block-602b106b0dd340fda2b24a28a2b6080e" style="list-style-type:decimal"><li>使用lvextend命令将/opt逻辑卷（LV）的大小扩展到新的PV上。例如，如果您的/opt LV名称为optlv，则可以使用以下命令将其扩展到新的PV上：</li></ol><div class="notion-text notion-block-479c367cdfe842cf93a692806c0e1108">此命令将/opt LV扩展到新的PV上，并使用所有可用的空闲空间（+100%FREE）。</div><ol start="1" class="notion-list notion-list-numbered notion-block-2c05e6a6787647149a9eb7edb477eb29" style="list-style-type:decimal"><li>最后，使用resize2fs命令将文件系统大小调整为新的LV大小。例如，如果您的文件系统类型为ext4，则可以使用以下命令将其调整为新的LV大小：</li></ol><div class="notion-text notion-block-5a9d075d3de3475f86956abac9f81884">这将调整/opt文件系统的大小以匹配新的LV大小。</div><div class="notion-text notion-block-2fddd69d56f744de8df8b90bdb584d3c">完成上述步骤后，您应该能够成功将新硬盘添加到LVM中，并扩展/opt空间。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-10a75bbab105432caa22624e9d68b57d" data-id="10a75bbab105432caa22624e9d68b57d"><span><div id="10a75bbab105432caa22624e9d68b57d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#10a75bbab105432caa22624e9d68b57d" title="🤗 总结归纳"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">🤗 总结归纳</span></span></h2><div class="notion-text notion-block-7bdc3eeb4d6b4fda8a209d8b4053e684">以上就是两种扩容方法。</div><div class="notion-blank notion-block-092e14e361744154918ad71dabda3ab5"> </div><div class="notion-callout notion-gray_background_co notion-block-fc745ce455d242f78a066b5181f68802"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">有关Linux空间扩容的问题，欢迎您在底部评论区留言，一起交流~</div></div><div class="notion-blank notion-block-f935801103ba4f9598b35ee5064a3682"> </div><div class="notion-blank notion-block-186f965d64858042aeddcfab09b7be52"> </div></main></div>]]></content:encoded>
        </item>
    </channel>
</rss>