<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>bloodzer0</title>
    <link>https://wechat2rss.xlab.app/feed/1861774bb3091197d2b5b99ea778ced110751b8e.xml</link>
    <description>不是从0开始，而是从1开始！&#xA;(wechat feed made by @ttttmr https://wechat2rss.xlab.app)</description>
    <managingEditor> (bloodzer0)</managingEditor>
    <image>
      <url>https://wx.qlogo.cn/mmhead/Q3auHgzwzM7dhwFShKwxoGOOTSHyicviawdKjyHF1jIctuTo7YL23Pww/0</url>
      <title>bloodzer0</title>
      <link>https://wechat2rss.xlab.app/feed/1861774bb3091197d2b5b99ea778ced110751b8e.xml</link>
    </image>
    <item>
      <title>Harbor私有镜像仓库</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247484074&amp;idx=1&amp;sn=7013f6cf0d874319fd7ec524cb3df2c4</link>
      <description></description>
      <content:encoded><![CDATA[<p>
<span></span> <span>2022-10-10 17:31</span> <span style="display: inline-block;">四川</span>
</p>

<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=a3dd03e3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miang8IzDXrhE88wKYRuwRkoicbia1NIJiaqxTNqnETM86GmJT49iaMhj4G7KmaIQpIKZNicKS4zgu9hbGbg%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img js_insertlocalimg" data-ratio="1.4125" data-s="300,640" style="" data-type="png" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=4f623d7d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miang8IzDXrhE88wKYRuwRkoictCcwQq8CUeSTf9q62WkpWsQa6RVLdpRurfPECRXweSlHtbFP8ndQMQ%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img js_insertlocalimg" data-ratio="1.4171875" data-s="300,640" style="" data-type="png" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=b059484f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miang8IzDXrhE88wKYRuwRkoicyNia5QxfgxbU9qUojGZb6TG1QHMSP4VBhdxVcsMibDblCqhCQIq5xuicw%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img js_insertlocalimg" data-ratio="1.4125" data-s="300,640" style="" data-type="png" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=4a4f924a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miang8IzDXrhE88wKYRuwRkoicxr6ib2qk4XRmhKw5murotU52CMibt7JI1CWq6Bn1Vqc8icQASbxJP8O0g%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img js_insertlocalimg" data-ratio="1.41640625" data-s="300,640" style="" data-type="png" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=f2bff1e5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miang8IzDXrhE88wKYRuwRkoicnza1dd4Eucn2JYSqGufNlGHzZSHKHSv2l4EEHRRlkYVwa2wmOia91xw%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img js_insertlocalimg" data-ratio="1.41328125" data-s="300,640" style="" data-type="png" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=b99cafa1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miang8IzDXrhE88wKYRuwRkoic1xVMBibqKGA5kIH2JX55QUwQzeI6kA7bR93PibFZjkTKCxA9jgPQUQcQ%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img js_insertlocalimg" data-ratio="1.4134387351778657" data-s="300,640" style="" data-type="png" data-w="1265" src="https://wechat2rss.xlab.app/img-proxy/?k=e846b01a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miang8IzDXrhE88wKYRuwRkoicicUv4GHVZFvedVmAK6ZvCBU10qNSef6LtI4ia8U6Z0FOut9SetRFqOxw%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img js_insertlocalimg" data-ratio="1.41328125" data-s="300,640" style="" data-type="png" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=b5135042&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miang8IzDXrhE88wKYRuwRkoic3Bq8rgGYiczgtHI1rF80ABMCN3iaHdbpewhbaV2RW2zIaauRUFPQia45g%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img js_insertlocalimg" data-ratio="1.41328125" data-s="300,640" style="" data-type="png" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=12e00092&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miang8IzDXrhE88wKYRuwRkoic7x78xHDhUVrpZgAiaK5BYtHRjkeufTEiaIb00BXRJdRRESAgXZ8bLfyQ%2F640%3Fwx_fmt%3Dpng"/></p><p><br/></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="2247484074">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=e8107389&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247484074%26idx%3D1%26sn%3D7013f6cf0d874319fd7ec524cb3df2c4%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 10 Oct 2022 17:31:00 +0800</pubDate>
    </item>
    <item>
      <title>儿童节快乐</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247484019&amp;idx=1&amp;sn=aa5de1af58adbc578e00513930f4320f</link>
      <description>儿童节快乐，快乐的我遭遇了不开心，电脑硬盘损坏！部分自己写的重要文档丢失（本身由于最近家庭原因停更了，所以停</description>
      <content:encoded><![CDATA[<p>
<span>bloodzer0</span> <span>2020-06-01 17:26</span> <span style="display: inline-block;"></span>
</p>

<p>儿童节快乐，快乐的我遭遇了不开心，电脑硬盘损坏！部分自己写的重要文档丢失（本身由于最近家庭原因停更了，所以停</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=3163486a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6mialBNn1icmcwtSJX92ex3jibvbDSOXiaPS3ibiaJTmUkJln3ib4GbFQOSviahbnzKOUETOR9MhQfRTgEdAUhw%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p>儿童节快乐，快乐的我遭遇了不开心，电脑硬盘损坏！部分自己写的重要文档丢失（本身由于最近家庭原因停更了，所以停更更长时间！）</p><p><br/></p>



<p><a href="2247484019">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=aa5cd221&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247484019%26idx%3D1%26sn%3Daa5de1af58adbc578e00513930f4320f%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 01 Jun 2020 17:26:00 +0800</pubDate>
    </item>
    <item>
      <title>SonarQube实现自动化代码扫描</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483990&amp;idx=1&amp;sn=23ed7ebac98f73f98242a43c0933660b</link>
      <description>记录使用SonarQube实现DevSecOps中代码扫描的经历</description>
      <content:encoded><![CDATA[<p>
原创 <span>bloodzer0</span> <span>2020-04-27 20:35</span> <span style="display: inline-block;"></span>
</p>

<p>记录使用SonarQube实现DevSecOps中代码扫描的经历</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=d9e9c68a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miamUXnxE9ybgTKZHXupR3fnUzJ4x1n7GSfkpJyToc4FticERhbSrTibXZZGMmHDb5LK7qYtXWd14Picrg%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarQube</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">官网地址：</span><span style="font-family: OpenSans, serif;color: rgb(63, 130, 193);"><a href="https://www.sonarqube.org/ " target="_blank">https://www.sonarqube.org/ </a></span></span></section><section data-tools="新媒体排版" data-id="10042" data-style-type="标题"><section style="font-family: Arial;border-width: 0px;border-style: none;border-color: initial;padding: 0px;color: rgb(49, 147, 105);max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;text-align: center;max-width: 100%;"><section style="display: inline-block;vertical-align: top;margin-bottom: -10px;max-width: 100%;"><section style="border-bottom: 2px solid rgb(77, 60, 66);padding-right: 5px;padding-left: 5px;background-color: rgb(254, 254, 254);max-width: 100%;"><span style="font-size: 22px;">SonarQube安装</span></section><section style="display: inline-block;vertical-align: top;margin-top: -2px;max-width: 100%;"><section style="width: 0px;border-top: 8px solid rgb(77, 60, 66);border-left: 8px solid rgb(77, 60, 66);max-width: 100%;border-right: 8px solid transparent !important;border-bottom: 8px solid transparent !important;"><br style="display:none;"/></section><section style="width: 0px;border-top: 6px solid rgb(255, 255, 255);border-left: 5px solid rgb(255, 255, 255);margin-top: -16px;margin-left: 2px;max-width: 100%;border-right: 5px solid transparent !important;border-bottom: 6px solid transparent !important;"><br style="display:none;"/></section><br style="display: none;"/></section></section></section></section></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: OpenSans, serif;color: rgb(63, 130, 193);"></span></span></section><section data-id="10144" data-style-type="标题"><section><section data-tools="新媒体排版" data-id="8858" data-style-type="标题"><section style="box-sizing: border-box;max-width: 100%;" powered-by="xiumi.us"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;max-width: 100%;"><section style="display: inline-block;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;border-left: 5px solid rgb(106, 168, 79);color: rgb(0, 0, 0);"><span style="width: 0px;display: inline-block;box-sizing: border-box;border-left: 5px solid rgb(106, 168, 79);color: rgb(0, 0, 0);border-top: 3px solid transparent !important;border-bottom: 3px solid transparent !important;"> </span> <section style="display: inline-block;vertical-align: middle;font-size: 19px;padding-left: 2px;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;"><span style="font-size: 20px;">Centos7安装SonarQube</span></section></section></section></section></section></section></section></section></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="sql"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 解决依赖，SonarQube7.9必须是java11才可以运行</span></span></code><code><span class="code-snippet_outer">yum <span class="code-snippet__keyword">install</span> <span class="code-snippet__keyword">java</span><span class="code-snippet__number">-11</span>-openjdk.x86_64 <span class="code-snippet__keyword">java</span><span class="code-snippet__number">-11</span>-openjdk-devel.x86_64 -y</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 安装PG数据库，新版本已经不支持MySQL了</span></span></code><code><span class="code-snippet_outer">wget <a href="https://download.postgresql.org/pub/repos/yum/reporpms/EL" target="_blank">https://download.postgresql.org/pub/repos/yum/reporpms/EL</a><span class="code-snippet__number">-7</span>-x86_64/pgdg-redhat-repo-latest.noarch.rpm</span></code><code><span class="code-snippet_outer">rpm -ivh pgdg-redhat-repo-latest.noarch.rpm</span></code><code><span class="code-snippet_outer">yum <span class="code-snippet__keyword">install</span> postgresql10.x86_64 postgresql10-server.x86_64 postgresql10-libs.x86_64 postgresql10-libs.x86_64 postgresql-jdbc.noarch -y</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 初始化PG</span></span></code><code><span class="code-snippet_outer">/usr/pgsql<span class="code-snippet__number">-10</span>/<span class="code-snippet__keyword">bin</span>/postgresql<span class="code-snippet__number">-10</span>-setup initdb</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 允许本机连接</span></span></code><code><span class="code-snippet_outer">vim /<span class="code-snippet__keyword">var</span>/lib/pgsql/<span class="code-snippet__number">10</span>/<span class="code-snippet__keyword">data</span>/pg_hba.conf</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 启动PG</span></span></code><code><span class="code-snippet_outer">systemctl <span class="code-snippet__keyword">enable</span> postgresql<span class="code-snippet__number">-10.</span>service</span></code><code><span class="code-snippet_outer">systemctl <span class="code-snippet__keyword">start</span> postgresql<span class="code-snippet__number">-10.</span>service</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 配置PG</span></span></code><code><span class="code-snippet_outer">su - postgres</span></code><code><span class="code-snippet_outer">psql</span></code></pre></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><strong><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);"></span></strong></span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="sql"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 将template1取消设置为模板</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">UPDATE</span> pg_database <span class="code-snippet__keyword">SET</span> datistemplate = <span class="code-snippet__literal">FALSE</span> <span class="code-snippet__keyword">WHERE</span> datname = <span class="code-snippet__string">&#39;template1&#39;</span>;</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 删除template1</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">DROP</span> <span class="code-snippet__keyword">DATABASE</span> template1;</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 重新创建template1，并设置默认编码</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">CREATE</span> <span class="code-snippet__keyword">DATABASE</span> template1 <span class="code-snippet__keyword">WITH</span> <span class="code-snippet__keyword">TEMPLATE</span> = template0 <span class="code-snippet__keyword">ENCODING</span> = <span class="code-snippet__string">&#39;UTF8&#39;</span>;</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 将template1重新设置为模板</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">UPDATE</span> pg_database <span class="code-snippet__keyword">SET</span> datistemplate = <span class="code-snippet__literal">TRUE</span> <span class="code-snippet__keyword">WHERE</span> datname = <span class="code-snippet__string">&#39;template1&#39;</span>;</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 创建用户</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">create</span> <span class="code-snippet__keyword">user</span> sonarqube <span class="code-snippet__keyword">with</span> <span class="code-snippet__keyword">password</span> <span class="code-snippet__string">&#39;sonarqube&#39;</span>;</span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">alter</span> <span class="code-snippet__keyword">role</span> sonarqube login;</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 创建数据库</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">create</span> <span class="code-snippet__keyword">database</span> sonarqube <span class="code-snippet__keyword">encoding</span>=<span class="code-snippet__string">&#39;UTF8&#39;</span> owner sonarqube;</span></code></pre></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="properties"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 创建用户</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__attr">useradd</span> <span class="code-snippet__string">sonarqube</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__attr">passwd</span> <span class="code-snippet__string">sonarqube</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__attr">su</span> <span class="code-snippet__string">- sonarqube</span></span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 安装SonarQube</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__attr">wget</span> <span class="code-snippet__string"><a href="https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-8.0.zip" target="_blank">https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-8.0.zip</a></span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__attr">unzip</span> <span class="code-snippet__string">sonarqube-8.0.zip &amp;&amp; cd sonarqube-8.0</span></span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 修改配置文件</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__attr">vim</span> <span class="code-snippet__string">/home/sonarqube/sonarqube-8.0/conf/sonar.properties</span></span></code></pre></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="javascript"><code><span class="code-snippet_outer">sonar.jdbc.username=sonarqube</span></code><code><span class="code-snippet_outer">sonar.jdbc.password=sonarqube</span></code><code><span class="code-snippet_outer">sonar.jdbc.url=jdbc:postgresql:<span class="code-snippet__comment">//127.0.0.1/sonarqube</span></span></code></pre></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="nginx"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 配置Java版本</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 由于8.0需要Java11，但是安装PG10的时候系统会默认安装Java1.8，所以需要配置Java地址</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__attribute">vim</span> /home/sonarqube/sonarqube-<span class="code-snippet__number">8</span>.<span class="code-snippet__number">0</span>/conf/wrapper.conf</span></code></pre></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="ruby"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 我是yum安装的java11，如果大家是配置或者编译的需要使用对应的java地址</span></span></code><code><span class="code-snippet_outer">wrapper.java.command=<span class="code-snippet__regexp">/usr/lib</span><span class="code-snippet__regexp">/jvm/java</span>-<span class="code-snippet__number">11</span>-openjdk-<span class="code-snippet__number">11.0</span>.<span class="code-snippet__number">6.10</span>-<span class="code-snippet__number">1</span>.el7_7.x86_64/bin/java</span></code></pre></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="sql"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 启动服务</span></span></code><code><span class="code-snippet_outer">./bin/linux-x86-64/sonar.sh <span class="code-snippet__keyword">start</span></span></code><code><span class="code-snippet_outer">访问：<a href="http://10.10.10.12:9000，账号密码：admin/admin。" target="_blank">http://10.10.10.12:9000，账号密码：admin/admin。</a></span></code></pre></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;"><strong><span style="font-size: 18px;font-family: OpenSans, serif;color: rgb(51, 51, 51);">ES</span></strong><strong><span style="font-size: 18px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">启动报错</span></strong></span><br/></section><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">报错信息如下：</span></p></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="css"><code><span class="code-snippet_outer"><span class="code-snippet__selector-attr">[1]</span>: <span class="code-snippet__selector-tag">max</span> <span class="code-snippet__selector-tag">file</span> <span class="code-snippet__selector-tag">descriptors</span> <span class="code-snippet__selector-attr">[4096]</span> <span class="code-snippet__selector-tag">for</span> <span class="code-snippet__selector-tag">elasticsearch</span> <span class="code-snippet__selector-tag">process</span> <span class="code-snippet__selector-tag">is</span> <span class="code-snippet__selector-tag">too</span> <span class="code-snippet__selector-tag">low</span>, <span class="code-snippet__selector-tag">increase</span> <span class="code-snippet__selector-tag">to</span> <span class="code-snippet__selector-tag">at</span> <span class="code-snippet__selector-tag">least</span> <span class="code-snippet__selector-attr">[65535]</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__selector-attr">[2]</span>: <span class="code-snippet__selector-tag">max</span> <span class="code-snippet__selector-tag">virtual</span> <span class="code-snippet__selector-tag">memory</span> <span class="code-snippet__selector-tag">areas</span> <span class="code-snippet__selector-tag">vm</span><span class="code-snippet__selector-class">.max_map_count</span> <span class="code-snippet__selector-attr">[65530]</span> <span class="code-snippet__selector-tag">is</span> <span class="code-snippet__selector-tag">too</span> <span class="code-snippet__selector-tag">low</span>, <span class="code-snippet__selector-tag">increase</span> <span class="code-snippet__selector-tag">to</span> <span class="code-snippet__selector-tag">at</span> <span class="code-snippet__selector-tag">least</span> <span class="code-snippet__selector-attr">[262144]</span></span></code></pre></section><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">解决方案如下：</span></span></p></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="nginx"><code><span class="code-snippet_outer"><span class="code-snippet__attribute">vim</span> /etc/sysctl.conf</span></code></pre></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="apache"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 添加如下内容</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__attribute">vm</span>.max_map_count=655360</span></code></pre></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="properties"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 立即生效</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__attr">sysctl</span> <span class="code-snippet__string">-p</span></span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__attr">vim</span> <span class="code-snippet__string">/etc/security/limits.conf</span></span></code></pre></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="markdown"><code><span class="code-snippet_outer"><span class="code-snippet__section"># 添加如下内容</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__bullet">*       </span>soft    nofile  65536</span></code><code><span class="code-snippet_outer"><span class="code-snippet__bullet">*       </span>hard    nofile  65536</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__section"># limits不需要重启，但是需要重新登录</span></span></code></pre></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">注意：内存至少应该大于</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">3G</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">，否则容易出现</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">ES</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">不报错，但是自己停止运行。</span></span><br/></section><section data-tools="新媒体排版" data-id="8858" data-style-type="标题"><section powered-by="xiumi.us" style="box-sizing: border-box;max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;max-width: 100%;"><section style="display: inline-block;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;border-left: 5px solid rgb(106, 168, 79);color: rgb(0, 0, 0);"><span style="width: 0px;display: inline-block;box-sizing: border-box;border-left: 5px solid rgb(106, 168, 79);border-top: 3px solid transparent !important;border-bottom: 3px solid transparent !important;"></span> <section style="padding-left: 2px;display: inline-block;vertical-align: middle;font-size: 19px;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;"><span style="font-size: 20px;">Centos7安装SonarScanner</span><span style="color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 17px;"></span></section></section></section></section></section></section></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="nginx"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 下载SonarScanner</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__attribute">wget</span> <a href="https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.2.0.1873-linux.zip" target="_blank">https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.2.0.1873-linux.zip</a></span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">unzip sonar-scanner-cli-<span class="code-snippet__number">4</span>.<span class="code-snippet__number">2</span>.<span class="code-snippet__number">0</span>.<span class="code-snippet__number">1873</span>-linux.zip -d /home/sonarqube/</span></code></pre></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;"><strong><span style="font-size: 18px;font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarScanner</span></strong><strong><span style="font-size: 18px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">执行扫描</span></strong></span></section><ol class="list-paddingleft-2" style="list-style-type: decimal;"><li><p><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">在</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarQube</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">管理⻚面创建一个</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">Token</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">：</span></span><span style="font-family: Courier;font-size: 15px;color: rgb(255, 169, 0);background-color: rgb(214, 214, 214);">68bec86cee8ec9a9ad8621592670c9939e6ba71e</span></p></li><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">执行扫描</span></p></li></ol><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="ruby"><code><span class="code-snippet_outer">/home/sonarqube/sonar-scanner-<span class="code-snippet__number">4.2</span>.<span class="code-snippet__number">0</span>.<span class="code-snippet__number">1873</span>-linux/bin/sonar-scanner -Dsonar.host.url=<span class="code-snippet__symbol">http:</span>/<span class="code-snippet__regexp">/127.0.0.1:9000 -Dsonar.login=68bec86cee8ec9a9ad8621592670c9939e6ba71e -Dsonar.projectKey=java-sec-code_scanner -Dsonar.java.binaries=/home</span><span class="code-snippet__regexp">/sonarqube/projects</span><span class="code-snippet__regexp">/java-sec-code</span></span></code></pre></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">此时的扫描结果如下：</span></section><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-s="300,640" data-w="1016" data-type="png" style="" data-ratio="0.2312992125984252" src="https://wechat2rss.xlab.app/img-proxy/?k=dd3c259a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamUXnxE9ybgTKZHXupR3fnUOaStvFb0rWJWwzSHUKkxcadt4accCA1KOVvzQg6X6RCn2ZLeF44CAA%2F640%3Fwx_fmt%3Dpng"/></p><section data-tools="新媒体排版" data-id="8858" data-style-type="标题"><section powered-by="xiumi.us" style="box-sizing: border-box;max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;max-width: 100%;"><section style="display: inline-block;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;border-left: 5px solid rgb(106, 168, 79);color: rgb(0, 0, 0);"><span style="width: 0px;display: inline-block;box-sizing: border-box;border-left: 5px solid rgb(106, 168, 79);border-top: 3px solid transparent !important;border-bottom: 3px solid transparent !important;"></span> <section style="padding-left: 2px;display: inline-block;vertical-align: middle;font-size: 19px;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;"><span style="font-size: 20px;">SonarQube集成FindBugs</span></section></section></section></section></section></section></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">Sonar-FindBugs GitHub</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">地址：</span><span style="font-family: OpenSans, serif;color: rgb(63, 130, 193);"><a href="https://github.com/spotbugs/sonar-findbugs/releases/" target="_blank">https://github.com/spotbugs/sonar-findbugs/releases/</a></span></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">集成方式有两种：</span></span></section><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">在</span><span style="font-family: PingFangSC, sans-serif;font-size: 15px;background-color: rgb(214, 214, 214);color: rgb(255, 169, 0);">应用市场</span><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">中下载安装</span></span></p></li><li><p><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">在</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">GitHub</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">下载</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">jar</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">文件放置到</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarQube</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">的插件目录中</span></span></p></li></ul><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">如果</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarQube</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">集成了</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">FindBugs</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">，调用</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarScanner</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">进行扫描时，必须对</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">Java</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">项目进行打包后再执行扫描。</span></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;"><strong><span style="font-size: 18px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">使用</span></strong><strong><span style="font-size: 18px;font-family: OpenSans, serif;color: rgb(51, 51, 51);">FindBugs</span></strong><strong><span style="font-size: 18px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">配置扫描</span></strong></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">下图是</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarQube</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">质量配置⻚面：</span></span></section><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-s="300,640" data-w="891" data-type="png" style="" data-ratio="0.6734006734006734" src="https://wechat2rss.xlab.app/img-proxy/?k=0402f6b8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamUXnxE9ybgTKZHXupR3fnUXp7vAv8ZZUuibe9ianbOMD24SZ3eTC0xcoLxIT08Z59bwnmSfkngmZ4w%2F640%3Fwx_fmt%3Dpng"/></p><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="java"><code><span class="code-snippet_outer">mvn clean <span class="code-snippet__keyword">package</span> -DskipTests</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">/home/sonarqube/sonar-scanner-<span class="code-snippet__number">4.2</span>.0.1873-linux/bin/sonar-scanner -Dsonar.host.url=http:<span class="code-snippet__comment">//127.0.0.1:9000 -Dsonar.login=68bec86cee8ec9a9ad8621592670c9939e6ba71e -Dsonar.projectKey=java-sec-code_findbugs -Dsonar.java.binaries=/home/sonarqube/projects/java-sec-code</span></span></code></pre></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">此时的扫描结果如下：</span></section><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.3166496424923391" data-s="300,640" style="" data-type="png" data-w="979" src="https://wechat2rss.xlab.app/img-proxy/?k=ed654780&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamUXnxE9ybgTKZHXupR3fnUs1Qib8H8IY1YesN0aLNjs0CM6PTCw1C0aRMf9EREL9c1uBTj8pmoc2Q%2F640%3Fwx_fmt%3Dpng"/></p><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;"><strong><span style="font-size: 18px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">使用</span></strong><strong><span style="font-size: 18px;font-family: OpenSans, serif;color: rgb(51, 51, 51);">FindBugs Security Audit</span></strong><strong><span style="font-size: 18px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">配置扫描</span></strong></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">通过在进行安全代码审计时，推荐使用的规则下图：</span></span></section><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.6767676767676768" data-s="300,640" style="" data-type="png" data-w="891" src="https://wechat2rss.xlab.app/img-proxy/?k=f9fa88ee&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamUXnxE9ybgTKZHXupR3fnU6lJAvvmnrurvsUofLpxyJicn3yHxKlgHOiaDxIKKbKLXvyQJDxxfBqpg%2F640%3Fwx_fmt%3Dpng"/></p><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">此时的扫描结果如下：</span></section><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.4851889683350358" data-s="300,640" style="" data-type="png" data-w="979" src="https://wechat2rss.xlab.app/img-proxy/?k=ad487beb&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamUXnxE9ybgTKZHXupR3fnUO6AauJ9bI178dFDWL2FCNcj6oicADXb0HbBzYStNjkqm3kRvnJMPUTg%2F640%3Fwx_fmt%3Dpng"/></p><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;"><strong><span style="font-size: 18px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">不加载</span></strong><strong><span style="font-size: 18px;font-family: OpenSans, serif;color: rgb(51, 51, 51);">FindBugs</span></strong><strong><span style="font-size: 18px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">插件</span></strong></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">如果你安装了</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">FindBugs</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">插件，又不想执行编译，那么在</span></span><span style="font-family: PingFangSC, sans-serif;font-size: 15px;color: rgb(255, 169, 0);background-color: rgb(214, 214, 214);">质量配置</span><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">中将</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">FindBugs</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">设为默认的规则</span><strong><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">全部取</span></strong><strong><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">消</span></strong><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">即可。</span></span></section><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.6707589285714286" data-s="300,640" style="" data-type="png" data-w="896" src="https://wechat2rss.xlab.app/img-proxy/?k=26b3c3e0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamUXnxE9ybgTKZHXupR3fnUeTW7mXKwxRfiadYbp4picUD9LALDhyMCYXh4F22kKK7x1frmCPhUhia2g%2F640%3Fwx_fmt%3Dpng"/></p><section data-tools="新媒体排版" data-id="8858" data-style-type="标题"><section powered-by="xiumi.us" style="box-sizing: border-box;max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;max-width: 100%;"><section style="display: inline-block;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;border-left: 5px solid rgb(106, 168, 79);color: rgb(0, 0, 0);"><span style="width: 0px;display: inline-block;box-sizing: border-box;border-left: 5px solid rgb(106, 168, 79);border-top: 3px solid transparent !important;border-bottom: 3px solid transparent !important;"></span> <section style="padding-left: 2px;display: inline-block;vertical-align: middle;font-size: 19px;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;"><span style="font-size: 20px;">SonarQube集成DependencyCheck</span></section></section></section></section></section></section></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">DependencyCheck-SonarQube GitHub</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">地址：</span><span style="font-family: OpenSans, serif;color: rgb(63, 130, 193);"><a href="https://github.com/dependency-check/dependency-" target="_blank">https://github.com/dependency-check/dependency-</a></span></span><span style="color: rgb(63, 130, 193);font-family: OpenSans, serif;font-size: 15px;"></span><span style="color: rgb(63, 130, 193);font-family: OpenSans, serif;font-size: 15px;">check-sonar-plugin</span><br/></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: OpenSans, serif;color: rgb(63, 130, 193);"></span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">DependencyCheck GitHub</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">地址：</span><span style="font-family: OpenSans, serif;color: rgb(63, 130, 193);"><a href="https://github.com/jeremylong/DependencyCheck/" target="_blank">https://github.com/jeremylong/DependencyCheck/</a></span></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarQube</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">安装</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">DependencyCheck</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">插件与</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">FindBugs</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">一致。在使用</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarScanner</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">执行扫描的时候，可以不编译项目，但是需要希望对</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">jar</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">包进行扫描则必须进行编译。</span></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;"><strong><span style="font-size: 18px;font-family: OpenSans, serif;color: rgb(51, 51, 51);">DependencyCheck</span></strong><strong><span style="font-size: 18px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">使用命令</span></strong></span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="sql"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 不更新漏洞库执行扫描</span></span></code><code><span class="code-snippet_outer">/home/sonarqube/dependency-<span class="code-snippet__keyword">check</span>/<span class="code-snippet__keyword">bin</span>/dependency-check.sh -n</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 只更新漏洞库库，不执行扫描</span></span></code><code><span class="code-snippet_outer">/home/sonarqube/dependency-<span class="code-snippet__keyword">check</span>/<span class="code-snippet__keyword">bin</span>/dependency-check.sh <span class="code-snippet__comment">--updateonly</span></span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 使用代理更新漏洞库</span></span></code><code><span class="code-snippet_outer">/home/sonarqube/dependency-<span class="code-snippet__keyword">check</span>/<span class="code-snippet__keyword">bin</span>/dependency-check.sh <span class="code-snippet__comment">--updateonly --proxyserver host --proxyport port</span></span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 编译项目</span></span></code><code><span class="code-snippet_outer">mvn clean <span class="code-snippet__keyword">package</span> -DskipTests</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 生成xml报告</span></span></code><code><span class="code-snippet_outer">/home/sonarqube/dependency-<span class="code-snippet__keyword">check</span>/<span class="code-snippet__keyword">bin</span>/dependency-check.sh -s /home/sonarqube/projects/<span class="code-snippet__keyword">java</span>-sec-code/target/<span class="code-snippet__keyword">java</span>-sec-code<span class="code-snippet__number">-1.0</span><span class="code-snippet__number">.0</span>.jar -f <span class="code-snippet__keyword">XML</span> -o /home/sonarqube/reports/<span class="code-snippet__keyword">java</span>-sec-code-report.xml</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 在5.3.2 版本中，小B遇到了一个坑就是第一项执行DependencyCheck时，当执行到 Central Analyzer 分析时非常缓慢（由于网络原因导致的），可以使用--disableCentral禁用，但是官方文档中不推荐禁用，所以只能在执行是使用代理或调整网络来解决</span></span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 生成html报告</span></span></code><code><span class="code-snippet_outer">/home/sonarqube/dependency-<span class="code-snippet__keyword">check</span>/<span class="code-snippet__keyword">bin</span>/dependency-check.sh -s /home/sonarqube/projects/<span class="code-snippet__keyword">java</span>-sec-code/target/<span class="code-snippet__keyword">java</span>-sec-code<span class="code-snippet__number">-1.0</span><span class="code-snippet__number">.0</span>.jar -f HTML -o /home/sonarqube/reports/<span class="code-snippet__keyword">java</span>-sec-code-report.html</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 将报告导入SonarQube并执行SonarScanner扫描，这里我们使用的是FindBugs Security Audit审计规则</span></span></code><code><span class="code-snippet_outer">/home/sonarqube/sonar-scanner<span class="code-snippet__number">-4.2</span><span class="code-snippet__number">.0</span><span class="code-snippet__number">.1873</span>-linux/<span class="code-snippet__keyword">bin</span>/sonar-scanner -Dsonar.host.url=<span class="code-snippet__keyword">http</span>://<span class="code-snippet__number">127.0</span><span class="code-snippet__number">.0</span><span class="code-snippet__number">.1</span>:<span class="code-snippet__number">9000</span> -Dsonar.login=<span class="code-snippet__number">68</span>bec86cee8ec9a9ad8621592670c9939e6ba71e -Dsonar.projectKey=<span class="code-snippet__keyword">java</span>-sec-code_dependency -Dsonar.java.binaries=/home/sonarqube/projects/<span class="code-snippet__keyword">java</span>-sec-code -Dsonar.dependencyCheck.reportPath=/home/sonarqube/reports/<span class="code-snippet__keyword">java</span>-sec-code-report.xml -Dsonar.dependencyCheck.htmlReportPath=/home/sonarqube/reports/<span class="code-snippet__keyword">java</span>-sec-code-report.html</span></code></pre></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">此时的扫描结果如下：</span></span></section><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.6564102564102564" data-s="300,640" style="" data-type="png" data-w="975" src="https://wechat2rss.xlab.app/img-proxy/?k=e1266a45&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamUXnxE9ybgTKZHXupR3fnUZvUy0RrKxZwlIicFOASyuCZubYpvMvX4sOsY1kR0yT9Tgu2dW6HjOicg%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.37890625" data-s="300,640" style="" data-type="png" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=c254a0e3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamUXnxE9ybgTKZHXupR3fnUq5l3aghyC9AccLGWkth2URGSH9icoLXkIDqgCVwXA2Tfw1wYNl07UXQ%2F640%3Fwx_fmt%3Dpng"/></p><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">对比上面的四种扫描结果可以发现，</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarQube</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">自带的规则对代码</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">Bug</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">的检查效果最好，</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">DependencyCheck+FindBugs Security Audit</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">对代码安全性检查效果最好。</span></span></section><section data-tools="新媒体排版" data-id="10052" data-style-type="标题"><section style="font-family: Arial;border-width: 0px;border-style: none;border-color: initial;padding: 0px;color: rgb(49, 147, 105);max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;text-align: center;max-width: 100%;"><section style="display: inline-block;vertical-align: top;margin-bottom: -10px;max-width: 100%;"><section style="border-bottom: 2px solid rgb(77, 60, 66);padding-right: 5px;padding-left: 5px;background-color: rgb(254, 254, 254);max-width: 100%;"><span style="font-size: 22px;">SonarQube集成到CI&amp;CD中</span></section><section style="display: inline-block;vertical-align: top;margin-top: -2px;max-width: 100%;"><section style="width: 0px;border-top: 8px solid rgb(77, 60, 66);border-right: 8px solid rgb(77, 60, 66);max-width: 100%;border-left: 8px solid transparent !important;border-bottom: 8px solid transparent !important;"><br style="display:none;"/></section><section style="width: 0px;border-top: 6px solid rgb(255, 255, 255);margin-top: -16px;margin-left: 4px;border-right: 5px solid rgb(255, 255, 255);max-width: 100%;border-left: 5px solid transparent !important;border-bottom: 6px solid transparent !important;"><br style="display:none;"/></section><br style="display: none;"/></section></section></section></section></section><section data-tools="新媒体排版" data-id="8858" data-style-type="标题"><section powered-by="xiumi.us" style="box-sizing: border-box;max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;max-width: 100%;"><section style="display: inline-block;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;border-left: 5px solid rgb(106, 168, 79);color: rgb(0, 0, 0);"><span style="width: 0px;display: inline-block;box-sizing: border-box;border-left: 5px solid rgb(106, 168, 79);border-top: 3px solid transparent !important;border-bottom: 3px solid transparent !important;"></span> <section style="padding-left: 2px;display: inline-block;vertical-align: middle;font-size: 19px;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;"><span style="font-size: 20px;">使用Giltab-CI集成SonarScanner</span><span style="color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 17px;"></span></section></section></section></section></section></section></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">PS.</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">注意</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarScanner</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">与</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">dependency-check</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">的权限(在执行</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">pipeline</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">时可以查看详情来观察是否出现异常)</span></span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="perl"><code><span class="code-snippet_outer">stages:</span></code><code><span class="code-snippet_outer">  - sast</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">sast:</span></code><code><span class="code-snippet_outer">  stage:sast</span></code><code><span class="code-snippet_outer">  script:</span></code><code><span class="code-snippet_outer">    - mvn clean <span class="code-snippet__keyword">package</span> -DskipTests <span class="code-snippet__comment"># 编译项目</span></span></code><code><span class="code-snippet_outer">    - <span class="code-snippet__keyword">mkdir</span> $PWD/reports <span class="code-snippet__comment"># 创建报告目录</span></span></code><code><span class="code-snippet_outer">    - <span class="code-snippet__regexp">/home/gitlab</span>-runner/dependency-check/bin/dependency-check.sh -<span class="code-snippet__keyword">s</span> $PWD/ -f XML -o $PWD/reports/dependency-check-report.xml <span class="code-snippet__comment"># 执行扫描，并生成xml报告</span></span></code><code><span class="code-snippet_outer">    - <span class="code-snippet__regexp">/home/gitlab</span>-runner/dependency-check/bin/dependency-check.sh -<span class="code-snippet__keyword">s</span> $PWD/ -f HTML -o $PWD/reports/dependency-check-report.html <span class="code-snippet__comment"># 执行扫描，并生成html报告</span></span></code><code><span class="code-snippet_outer">    - sonar-scanner -Dsonar.host.url=http:<span class="code-snippet__regexp">//</span><span class="code-snippet__number">10.10</span>.<span class="code-snippet__number">10.12</span>:<span class="code-snippet__number">9000</span> -Dsonar.login=token -Dsonar.projectKey=$CI_PROJECT_NAME:$CI_COMMIT_REF_NAME -Dsonar.java.binaries=$PWD -Dsonar.dependencyCheck.reportPath=$PWD/reports/dependency-check-report.xml -Dsonar.dependencyCheck.htmlReportPath=$PWD/reports/dependency-check-report.html <span class="code-snippet__comment"># 执行扫描，并将报告传输给SonarQube</span></span></code><code><span class="code-snippet_outer">  tags:</span></code><code><span class="code-snippet_outer">    - security</span></code></pre></section><section data-tools="新媒体排版" data-id="8858" data-style-type="标题"><section powered-by="xiumi.us" style="box-sizing: border-box;max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;max-width: 100%;"><section style="display: inline-block;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;border-left: 5px solid rgb(106, 168, 79);color: rgb(0, 0, 0);"><span style="width: 0px;display: inline-block;box-sizing: border-box;border-left: 5px solid rgb(106, 168, 79);border-top: 3px solid transparent !important;border-bottom: 3px solid transparent !important;"></span> <section style="padding-left: 2px;display: inline-block;vertical-align: middle;font-size: 19px;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;"><span style="font-size: 20px;">关于CI&amp;CD集成代码扫描的思考</span></section></section></section></section></section></section></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">如果每次提交代码都需要进行依赖包扫描则会出现非常浪费时间的情况(因为打包是一个非常耗时的过程)。所以推荐是在发布到测试环境或预生产环境时的</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">Jenkins pipeline</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">中使用依赖包扫描。</span></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">并且推荐定期更新</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">DependencyCheck</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">的漏洞库，最好选择在周末的夜间执行定时任务，定期更新的周期不应该超过</span></span><span style="font-size: 15px;color: rgb(255, 169, 0);background-color: rgb(214, 214, 214);"><span style="color: rgb(255, 169, 0);font-size: 15px;font-family: Courier;">7</span><span style="color: rgb(255, 169, 0);font-size: 15px;font-family: PingFangSC, sans-serif;">天</span></span><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);"> ，因为间隔不超过</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">7</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">天只需要维护一个很小的</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">XML</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">列表，时间消耗大概只会在一分钟之内。</span></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">至于普通的代码扫描，可以在</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">Gitlab</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">合并代码分支时进行。</span></span></section><section data-tools="新媒体排版" data-id="8858" data-style-type="标题"><section powered-by="xiumi.us" style="box-sizing: border-box;max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;max-width: 100%;"><section style="display: inline-block;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;border-left: 5px solid rgb(106, 168, 79);color: rgb(0, 0, 0);"><span style="width: 0px;display: inline-block;box-sizing: border-box;border-left: 5px solid rgb(106, 168, 79);border-top: 3px solid transparent !important;border-bottom: 3px solid transparent !important;"></span> <section style="padding-left: 2px;display: inline-block;vertical-align: middle;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;"><span style="font-size: 20px;">对于扫描出来的代码如何进行闭环</span></section></section></section></section></section></section></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">在这里主要需要思考这么几个问题：</span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;"><strong><span style="font-size: 18px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">扫描完成后如何通知安全人员或者研发人员</span></strong><strong><span style="font-size: 18px;font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">?</span></strong></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">关于通知相关人员，重要的是知道什么项目通知哪些人。可以使用构建对应关系(</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">project -- username</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">)来映射，可以在</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">pipeline</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">的代码扫描流程之后添加一个钉钉或邮件通知的过程即可。在这里小</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">通过一段代码将</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarQube</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">扫描结果中严重、高危、中危级别的漏洞提取出来发送给安全人员(</span><span style="font-family: OpenSans, serif;color: rgb(63, 130, 193);"><a href="http://172.16.26.13:9000/web_api/" target="_blank">http://172.16.26.13:9000/web_api/</a></span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">)</span></span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="python"><code><span class="code-snippet_outer"><span class="code-snippet__keyword">import</span> requests</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__function"><span class="code-snippet__keyword">def</span> <span class="code-snippet__title">get_vul</span><span class="code-snippet__params">(project_name)</span>:</span></span></code><code><span class="code-snippet_outer">    url = <span class="code-snippet__string">&#34;<a href="http://172.16.26.13:9000/api/issues/search?project=%s&amp;types=VULNERABILITY" target="_blank">http://172.16.26.13:9000/api/issues/search?project=%s&amp;types=VULNERABILITY</a>&#34;</span> % project_name</span></code><code><span class="code-snippet_outer">    vulnerability_number = requests.get(url,auth=(<span class="code-snippet__string">&#39;admin&#39;</span>,<span class="code-snippet__string">&#39;admin&#39;</span>)).json()[<span class="code-snippet__string">&#39;paging&#39;</span>][<span class="code-snippet__string">&#39;total&#39;</span>]</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    <span class="code-snippet__keyword">for</span> row <span class="code-snippet__keyword">in</span> requests.get(url,auth=(<span class="code-snippet__string">&#39;admin&#39;</span>,<span class="code-snippet__string">&#39;admin&#39;</span>)).json()[<span class="code-snippet__string">&#39;issues&#39;</span>]:</span></code><code><span class="code-snippet_outer">        <span class="code-snippet__keyword">if</span> row[<span class="code-snippet__string">&#39;status&#39;</span>] == <span class="code-snippet__string">&#34;OPEN&#34;</span>:</span></code><code><span class="code-snippet_outer">            <span class="code-snippet__keyword">if</span> row[<span class="code-snippet__string">&#39;severity&#39;</span>] == <span class="code-snippet__string">&#34;MAJOR&#34;</span> <span class="code-snippet__keyword">or</span> row[<span class="code-snippet__string">&#39;severity&#39;</span>] == <span class="code-snippet__string">&#34;CRITICAL&#34;</span> <span class="code-snippet__keyword">or</span> row[<span class="code-snippet__string">&#39;severity&#39;</span>] == <span class="code-snippet__string">&#34;BLOCKER&#34;</span>:</span></code><code><span class="code-snippet_outer">                alarm_data = <span class="code-snippet__string">&#34;&#34;</span></span></code><code><span class="code-snippet_outer">            <span class="code-snippet__keyword">else</span>:</span></code><code><span class="code-snippet_outer">                <span class="code-snippet__keyword">pass</span></span></code><code><span class="code-snippet_outer">        <span class="code-snippet__keyword">else</span>:</span></code><code><span class="code-snippet_outer">            <span class="code-snippet__keyword">pass</span></span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    print(<span class="code-snippet__string">&#34;漏洞数量: &#34;</span>, vulnerability_number)</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">if</span> __name__ == <span class="code-snippet__string">&#39;__main__&#39;</span>:</span></code><code><span class="code-snippet_outer">    project_name = <span class="code-snippet__string">&#34;java-sec-code_dependency&#34;</span></span></code><code><span class="code-snippet_outer">    get_vul(project_name)</span></code></pre></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);"></span></span><br/></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;"><strong><span style="font-size: 18px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">扫描出来的问题的准确性</span></strong></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">是工具就会有误报与漏报，所以很多时候直接将结果推送给研发人员是不靠谱的选择，需要安全人员初步过一遍以后再发送到业务方进行处理。所以小</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">对上一步脚本的提取结果进行复查，如果确认漏洞存在相应的危害性再将漏洞提交到企业自身的</span></span><span style="font-family: PingFangSC, sans-serif;font-size: 15px;color: rgb(255, 169, 0);background-color: rgb(214, 214, 214);">漏洞管理平台</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">。</span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;"><strong><span style="font-size: 18px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">扫描出来的问题应该如何进行修复</span></strong><strong><span style="font-size: 18px;font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">?</span></strong></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">处于</span><span style="font-family: PingFangSC, sans-serif;font-size: 15px;color: rgb(255, 169, 0);background-color: rgb(214, 214, 214);">漏洞管理平台</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">中的漏洞根据</span><span style="font-family: PingFangSC, sans-serif;font-size: 15px;color: rgb(255, 169, 0);background-color: rgb(214, 214, 214);">漏洞生命周期</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">要求推动修复。</span></section><section data-tools="新媒体排版" data-id="10052" data-style-type="标题"><section style="font-family: Arial;border-width: 0px;border-style: none;border-color: initial;padding: 0px;color: rgb(49, 147, 105);max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;text-align: center;max-width: 100%;"><section style="display: inline-block;vertical-align: top;margin-bottom: -10px;max-width: 100%;"><section style="border-bottom: 2px solid rgb(77, 60, 66);padding-right: 5px;padding-left: 5px;background-color: rgb(254, 254, 254);max-width: 100%;"><span style="font-size: 22px;">SonarQube在安装使用中的一些问题</span></section><section style="display: inline-block;vertical-align: top;margin-top: -2px;max-width: 100%;"><section style="width: 0px;border-top: 8px solid rgb(77, 60, 66);border-right: 8px solid rgb(77, 60, 66);max-width: 100%;border-left: 8px solid transparent !important;border-bottom: 8px solid transparent !important;"><br style="display:none;"/></section><section style="width: 0px;border-top: 6px solid rgb(255, 255, 255);margin-top: -16px;margin-left: 4px;border-right: 5px solid rgb(255, 255, 255);max-width: 100%;border-left: 5px solid transparent !important;border-bottom: 6px solid transparent !important;"><br style="display:none;"/></section><br style="display: none;"/></section></section></section></section></section><section data-tools="新媒体排版" data-id="8858" data-style-type="标题"><section powered-by="xiumi.us" style="box-sizing: border-box;max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;max-width: 100%;"><section style="display: inline-block;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;border-left: 5px solid rgb(106, 168, 79);color: rgb(0, 0, 0);"><span style="width: 0px;display: inline-block;box-sizing: border-box;border-left: 5px solid rgb(106, 168, 79);border-top: 3px solid transparent !important;border-bottom: 3px solid transparent !important;"></span> <section style="padding-left: 2px;display: inline-block;vertical-align: middle;font-size: 19px;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;"><span style="font-size: 20px;">项目私有化处理</span></section></section></section></section></section></section></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarQube</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">默认项目为</span></span><span style="font-family: PingFangSC, sans-serif;font-size: 15px;color: rgb(255, 169, 0);background-color: rgb(214, 214, 214);">公有</span><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">，此时不需要登录就可以查看</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarQube</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">中的项目，为了避免信息泄露问题，推荐将项目属性修改为默认</span></span><span style="color: rgb(255, 169, 0);font-family: PingFangSC, sans-serif;font-size: 15px;background-color: rgb(214, 214, 214);">私有</span><span style="color: rgb(51, 51, 51);font-family: PingFangSC, sans-serif;font-size: 15px;">。</span></section><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.27421875" data-s="300,640" style="" data-type="png" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=cfe0a8c5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamUXnxE9ybgTKZHXupR3fnUxo5iaTw4Kj1R5xxKBoSpibGX7WlyW9WFPibHafm7XjU8wKGliaWz8vtZkw%2F640%3Fwx_fmt%3Dpng"/></p><section data-tools="新媒体排版" data-id="8858" data-style-type="标题"><section powered-by="xiumi.us" style="box-sizing: border-box;max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;max-width: 100%;"><section style="display: inline-block;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;border-left: 5px solid rgb(106, 168, 79);color: rgb(0, 0, 0);"><span style="width: 0px;display: inline-block;box-sizing: border-box;border-left: 5px solid rgb(106, 168, 79);border-top: 3px solid transparent !important;border-bottom: 3px solid transparent !important;"></span> <section style="padding-left: 2px;display: inline-block;vertical-align: middle;font-size: 19px;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;"><span style="font-size: 20px;">SonarQube如何使用其他类型数据库</span></section></section></section></section></section></section></section><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">使用阿里云</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">RDS</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">，新版本不支持</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">MySQL</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">了可以使用阿里云的</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">PostgreSQL</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">。</span></span></p></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="ruby"><code><span class="code-snippet_outer">sonar.jdbc.url=<span class="code-snippet__symbol">jdbc:</span><span class="code-snippet__symbol">mysql:</span>/<span class="code-snippet__regexp">/address:3306/sonar</span>?useUnicode=<span class="code-snippet__literal">true</span>&amp;characterEncoding=utf8</span></code></pre></section><section data-tools="新媒体排版" data-id="8858" data-style-type="标题"><section powered-by="xiumi.us" style="box-sizing: border-box;max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;max-width: 100%;"><section style="display: inline-block;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;border-left: 5px solid rgb(106, 168, 79);color: rgb(0, 0, 0);"><span style="width: 0px;display: inline-block;box-sizing: border-box;border-left: 5px solid rgb(106, 168, 79);border-top: 3px solid transparent !important;border-bottom: 3px solid transparent !important;"></span> <section style="padding-left: 2px;display: inline-block;vertical-align: middle;font-size: 19px;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;"><span style="font-size: 20px;">不允许从数据库中直接删除规则</span></section></section></section></section></section></section></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">不要从数据库中直接删除规则，否则会报错如下：</span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="css"><code><span class="code-snippet_outer"><span class="code-snippet__selector-tag">ERROR</span>: <span class="code-snippet__selector-tag">Unable</span> <span class="code-snippet__selector-tag">to</span> <span class="code-snippet__selector-tag">load</span> <span class="code-snippet__selector-tag">component</span> <span class="code-snippet__selector-tag">class</span> <span class="code-snippet__selector-tag">org</span><span class="code-snippet__selector-class">.sonar</span><span class="code-snippet__selector-class">.scanner</span><span class="code-snippet__selector-class">.report</span><span class="code-snippet__selector-class">.MetadataPublisher</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__selector-tag">ERROR</span>: <span class="code-snippet__selector-tag">Caused</span> <span class="code-snippet__selector-tag">by</span>: <span class="code-snippet__selector-tag">Unable</span> <span class="code-snippet__selector-tag">to</span> <span class="code-snippet__selector-tag">load</span> <span class="code-snippet__selector-tag">component</span> <span class="code-snippet__selector-tag">class</span> <span class="code-snippet__selector-tag">org</span><span class="code-snippet__selector-class">.sonar</span><span class="code-snippet__selector-class">.scanner</span><span class="code-snippet__selector-class">.rule</span><span class="code-snippet__selector-class">.QualityProfiles</span></span></code></pre></section><section data-tools="新媒体排版" data-id="8858" data-style-type="标题"><section powered-by="xiumi.us" style="box-sizing: border-box;max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;max-width: 100%;"><section style="display: inline-block;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;border-left: 5px solid rgb(106, 168, 79);color: rgb(0, 0, 0);"><span style="width: 0px;display: inline-block;box-sizing: border-box;border-left: 5px solid rgb(106, 168, 79);border-top: 3px solid transparent !important;border-bottom: 3px solid transparent !important;"></span> <section style="padding-left: 2px;display: inline-block;vertical-align: middle;font-size: 19px;box-sizing: border-box;max-width: 100%;"><section style="box-sizing: border-box;max-width: 100%;"><span style="font-size: 20px;">sonar.projectKey命名</span><span style="color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 17px;"></span></section></section></section></section></section></section></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">在普通使用</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarScanner</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">过程中，我们可以自定义</span></span><span style="font-family: Courier;font-size: 15px;color: rgb(255, 169, 0);background-color: rgb(214, 214, 214);">sonar.projectKey</span><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">的值，但是如果把</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarScanner</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">集成到</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">CI&amp;CD</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">流程中时，我们会使用预定义变量来命名，通常我们会使<br/>用</span></span><span style="font-family: Courier;font-size: 15px;color: rgb(255, 169, 0);background-color: rgb(214, 214, 214);">CI_COMMIT_REF_NAME</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">，但是如果使用这个变量在项目名称中包含</span><span style="font-family: Courier;font-size: 15px;color: rgb(255, 169, 0);background-color: rgb(214, 214, 214);">/</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">、</span><span style="font-family: Courier;font-size: 15px;color: rgb(255, 169, 0);background-color: rgb(214, 214, 214);">#</span><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">等特殊字符时，</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">Gitlab-CI</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">的</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">pipeline</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">会执行失败。这个时候我们选择</span></span><span style="font-family: Courier;font-size: 15px;color: rgb(255, 169, 0);background-color: rgb(214, 214, 214);">CI_COMMIT_REF_SLUG</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">(先将</span><span style="font-family: Courier;font-size: 15px;color: rgb(255, 169, 0);background-color: rgb(214, 214, 214);">$CI_COMMIT_REF_NAME</span><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">的值转换成小写，最大不能超过</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">63</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">个字节，然后把除了</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">0-9</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">和</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">a-z</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">的其他字符转换成</span></span><span style="font-family: Courier;font-size: 15px;color: rgb(255, 169, 0);background-color: rgb(214, 214, 214);">-</span><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">。在</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">URLs</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">和域名名称中使用。)</span></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">GitLab CI/CD Variables</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">中文文档：</span><span style="font-family: OpenSans, serif;color: rgb(63, 130, 193);"><a href="http://www.ttlsa.com/auto/gitlab-cicd-variables-zh-document/" target="_blank">http://www.ttlsa.com/auto/gitlab-cicd-variables-zh-document/</a></span></span></section><section data-tools="新媒体排版" data-id="10052" data-style-type="标题"><section style="font-family: Arial;border-width: 0px;border-style: none;border-color: initial;padding: 0px;color: rgb(49, 147, 105);max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;text-align: center;max-width: 100%;"><section style="display: inline-block;vertical-align: top;margin-bottom: -10px;max-width: 100%;"><section style="border-bottom: 2px solid rgb(77, 60, 66);padding-right: 5px;padding-left: 5px;background-color: rgb(254, 254, 254);max-width: 100%;"><span style="font-size: 22px;">refer</span></section><section style="display: inline-block;vertical-align: top;margin-top: -2px;max-width: 100%;"><section style="width: 0px;border-top: 8px solid rgb(77, 60, 66);border-right: 8px solid rgb(77, 60, 66);max-width: 100%;border-left: 8px solid transparent !important;border-bottom: 8px solid transparent !important;"><br style="display:none;"/></section><section style="width: 0px;border-top: 6px solid rgb(255, 255, 255);margin-top: -16px;margin-left: 4px;border-right: 5px solid rgb(255, 255, 255);max-width: 100%;border-left: 5px solid transparent !important;border-bottom: 6px solid transparent !important;"><br style="display:none;"/></section><br style="display: none;"/></section></section></section></section></section><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p><span style="font-size: 15px;"><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">SonarQube</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">之</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">gitlab-plugin</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">配合</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">gitlab-ci</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">完成每次</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">commit</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">代码检测：</span><span style="font-family: OpenSans, serif;color: rgb(63, 130, 193);"><a href="https://blog.csdn.net/aixiao" target="_blank">https://blog.csdn.net/aixiao</a> yang168/article/details/78115646</span></span></p></li><li><p><span style="font-size: 15px;"><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">gitlab-ci/cd Dependency</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">依赖扫描两种方式</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">(</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">五</span><span style="font-family: OpenSans, serif;color: rgb(51, 51, 51);">)</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 51, 51);">：</span><span style="font-family: OpenSans, serif;color: rgb(63, 130, 193);"><a href="https://www.linuxea.com/1837.html" target="_blank">https://www.linuxea.com/1837.html</a></span></span></p></li></ul>



<p><a href="https://zhuanlan.zhihu.com/p/136723994">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=dc9f5c90&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483990%26idx%3D1%26sn%3D23ed7ebac98f73f98242a43c0933660b%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 27 Apr 2020 20:35:00 +0800</pubDate>
    </item>
    <item>
      <title>一次有趣的钓鱼测试</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483972&amp;idx=1&amp;sn=b550837ee842c41eec445450877f07d9</link>
      <description>这一天小B正在晒太阳，突然接到了老板的电话，要求对M公司进行一次内部全员邮件钓⻥测试，试图找出那些安全意识薄弱的员工。根据老板的要求，小B开始了这次的有趣的钓⻥之旅。</description>
      <content:encoded><![CDATA[<p>
原创 <span>bloodzer0</span> <span>2020-04-22 19:39</span> <span style="display: inline-block;"></span>
</p>

<p>这一天小B正在晒太阳，突然接到了老板的电话，要求对M公司进行一次内部全员邮件钓⻥测试，试图找出那些安全意识薄弱的员工。根据老板的要求，小B开始了这次的有趣的钓⻥之旅。</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=79ebbb3b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miamjMu9UCWguIxgHcic70OOl3y88POsx0iazD02Ricpf7XnJmQibGicRiaSWE8ibpzHqN8YF1XEB5M7anVtDQ%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><br/></section><section style="color: rgb(0, 0, 0);font-size: 16px;text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;text-size-adjust: auto;"><p style="text-align: center;line-height: normal;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="caret-color: rgb(240, 84, 84);color: rgb(240, 84, 84);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 15px;">本系列故事纯属虚构，如有雷同纯属巧合</span><br/></p></section><p style="color: rgb(0, 0, 0);font-size: 16px;white-space: normal;caret-color: rgb(51, 51, 51);text-align: center;line-height: normal;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><img data-ratio="0.05555555555555555" data-w="180" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=58a39579&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMdiaNr0OwpmzM4NhqDiaQCfAXn29rSVjqibNP5g9NFiabNR83tdz2F8qEyLQ%2F640%3Fwx_fmt%3Dpng"/></p><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">这一天小</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">正在晒太阳，突然接到了老板的电话，要求对</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">M</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">公司进行一次内部全员邮件钓⻥测试，试图找出那些安全意识薄弱的员工。根据老板的要求，小</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">开始了这次的有趣的钓⻥之旅。</span></span></section><section data-tools="新媒体排版" data-id="9872" data-style-type="标题"><section style="font-family: Arial;border-width: 0px;border-style: none;border-color: initial;padding: 0px;color: rgb(49, 147, 105);max-width: 100%;"><section style="border-width: initial;border-style: none;border-color: initial;margin-top: 0.5em;margin-bottom: 0.5em;text-align: center;box-sizing: border-box;padding: 0px;color: inherit;max-width: 100%;"><section style="width: 1em;height: 1em;display: inline-block;vertical-align: top;border-radius: 100%;margin-top: 0.7em;box-sizing: border-box;padding: 0px;color: rgb(255, 255, 255);background-color: rgb(157, 180, 194);max-width: 100%;"><br style="display:none;"/></section><section data-bclessp="-45" style="display: inline-block;vertical-align: middle;padding: 0px 5px;margin-right: 5px;margin-left: 5px;border-radius: 0.5em;font-size: 1.2em;font-family: inherit;text-align: left;text-decoration: inherit;box-sizing: border-box;color: inherit;height: 2em;line-height: 2em;border-color: rgb(157, 194, 180);max-width: 80% !important;"><section style="box-sizing: border-box;padding: 0px;margin: 0px;color: inherit;max-width: 100%;"><span style="font-size: 22px;">钓鱼前的准备</span><br/></section></section><section data-bglessp="-90" style="width: 1em;height: 1em;margin-bottom: 0.7em;border-radius: 100%;display: inline-block;vertical-align: bottom;box-sizing: border-box;padding: 0px;color: rgb(255, 255, 255);background-color: rgb(161, 194, 157);max-width: 100%;"><br style="display:none;"/></section><section style="width: 0px;height: 0px;clear: both;box-sizing: border-box;padding: 0px;margin: 0px;color: inherit;max-width: 100%;"><br style="display:none;"/></section></section></section></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">在执行这次钓⻥之前小</span><span style="font-size: 15px;font-family: ArialMT, serif;color: rgb(51, 71, 91);">B</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">需要先完成一系列的准备工作，包括：</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(232, 104, 0);background-color: rgb(214, 214, 214);">邮件主题选择</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">、</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(232, 104, 0);background-color: rgb(214, 214, 214);">搭建一个用于收集员工信息的站点</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">、</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(232, 104, 0);background-color: rgb(214, 214, 214);">批量发送邮件的工具</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">、</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(232, 104, 0);background-color: rgb(214, 214, 214);">构造钓⻥邮件</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">等。</span><br/></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);"></span></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 17px;text-align: justify;"></span></section><section data-tools="新媒体排版" data-id="9966" data-style-type="标题"><section style="font-family: Arial;border-width: 0px;border-style: none;border-color: initial;padding: 0px;color: rgb(49, 147, 105);max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;max-width: 100%;"><section style="width: 0.6em;display: inline-block;vertical-align: middle;max-width: 100%;"><span style="width: 0.6em;height: 0.6em;display: block;opacity: 0.2;color: #FFFFFF;background-color: rgba(89, 155, 171, 0.6);" data-bgopacity="40%"></span> <span style="width: 0.6em;height: 0.6em;display: block;opacity: 0.6;margin-top: 2px;margin-bottom: 2px;color: #FFFFFF;background-color: rgba(89, 155, 171, 0.74902);" data-bgopacity="25%"></span> <span style="width: 0.6em;height: 0.6em;display: block;opacity: 1;color: #FFFFFF;background-color: #599BAB;"></span></section><section style="display: inline-block;vertical-align: middle;padding-left: 10px;max-width: 100%;"><section style="max-width: 100%;font-size: 20px;">钓鱼邮件主题选择</section></section></section></section></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">网上关于这方面的资料很多大家有兴趣也可以多查查，小</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">在这里也简单列一些：(</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">PS.</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">我们在伪造邮件主题时也需要注意邮件不能过于逼真，否则会出现命中率极高的情况)</span></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;line-height: 2em;"><span style="font-size: 18px;"><strong><span style="font-size: 18px;font-family: 微软雅黑, sans-serif;color: rgb(51, 71, 91);">以攻击目的进行分类</span></strong></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);font-size: 15px;">针对攻击目标的不同，我们在选择主题时也需要更有针对性一些，这样能提高命中率。</span></section><ul class="list-paddingleft-2" style="list-style-type: disc;"><li style="font-size: 15px;"><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">需要控制目标</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">PC</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">或在目标</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">PC</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">植入后⻔或木⻢等信息；</span></span></section></li><li style="font-size: 15px;"><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);font-size: 15px;">只需要收集目标的个人信息；</span></section></li></ul><p style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;line-height: 2em;"><span style="font-size: 18px;"><strong><span style="font-size: 18px;font-family: 微软雅黑, sans-serif;color: rgb(51, 71, 91);">以邮件主题进行分类</span></strong></span></p><ul class="list-paddingleft-2" style="list-style-type: disc;"><li style="font-size: 15px;"><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);font-size: 15px;">企业内部通知</span></section></li><ul class="list-paddingleft-2" style="list-style-type: circle;"><li style="font-size: 15px;"><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);font-size: 15px;">人事变动通知：冒充行政部⻔发送人事变动的相关邮件，利用邮件中的附件进行钓⻥；</span></section></li><li style="font-size: 15px;"><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">薪资</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">/</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">奖金通知：同上</span></span></section></li><li style="font-size: 15px;"><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">安全警告：冒充</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">IT</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">类部⻔发送内部安全警告的相关邮件，利用邮件中的附件或链接进行钓⻥；</span></span></section></li></ul><li style="font-size: 15px;"><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;">企业内部活动</span></section></li><ul class="list-paddingleft-2" style="list-style-type: circle;"><li style="font-size: 15px;"><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;">优惠活动：</span><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;">以企业名义给员工发送一些优惠活动，让用户报名参与进行</span>钓<span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;">⻥；</span></section></li><li style="font-size: 15px;"><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;">聚餐活动：</span><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;">以聚餐报名为主题进行</span>钓<span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;">⻥；</span></section></li></ul><li style="font-size: 15px;"><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">员工信息变更：冒充</span><span style="font-size: 15px;font-family: ArialMT, serif;color: rgb(51, 71, 91);">IT</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">部⻔发送员工个人信息(密码、手机号)已过期或失效需要更新进行钓⻥；</span></section></li><li style="font-size: 15px;"><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;">社会实事关注：</span><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;">比如最近的新型冠状病毒</span></section></li><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;"></span></section></ul><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;background-color: rgb(255, 255, 255);">当然</span>了<span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;background-color: rgb(255, 255, 255);">钓⻥的方案还是很多的，还是需要结合实际的情况来定邮件主题</span><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;background-color: rgb(255, 255, 255);">。</span></section><section data-tools="新媒体排版" data-id="9966" data-style-type="标题"><section style="font-family: Arial;border-width: 0px;border-style: none;border-color: initial;color: rgb(49, 147, 105);max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;max-width: 100%;"><section style="width: 0.6em;display: inline-block;vertical-align: middle;max-width: 100%;"><span data-bgopacity="40%" style="width: 0.6em;height: 0.6em;display: block;opacity: 0.2;color: rgb(255, 255, 255);background-color: rgba(89, 155, 171, 0.6);"></span><span data-bgopacity="25%" style="margin-top: 2px;margin-bottom: 2px;width: 0.6em;height: 0.6em;display: block;opacity: 0.6;color: rgb(255, 255, 255);background-color: rgba(89, 155, 171, 0.75);"></span><span style="width: 0.6em;height: 0.6em;display: block;opacity: 1;color: rgb(255, 255, 255);background-color: rgb(89, 155, 171);"></span></section><section style="padding-left: 10px;display: inline-block;vertical-align: middle;max-width: 100%;"><section style="max-width: 100%;font-size: 20px;">钓鱼站点准备</section></section></section></section></section><p><span style="color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;text-align: left;font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">由于没有开发资源，并且小</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">的目的是获取内部员工的信息，所以选择了实事相关的调查问卷来作为本地邮件主题。由于没有开发，小</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">找了一个开源的调查问卷系统：</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">LimeSurvey</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">(</span><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"><a href="https://www.limesurvey.org/" target="_blank">https://www.limesurvey.org/</a></span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">)部署方案使用</span></span><span style="text-align: left;font-family: RobotoMono, serif;color: rgb(232, 104, 0);font-size: 15px;background-color: rgb(214, 214, 214);">Apache+MariaDB+PHP</span><span style="text-align: left;font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">即可，我这里简单记录了一下：</span><br/></p><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);"></span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="sql"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 部署环境是:Centos7.4 最小化安装</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># LimeSurvey需要PHP5.5 以上的版本，但是Centos7默认的是5.4版本，所以需要更改PHP的源 </span></span></code><code><span class="code-snippet_outer">yum <span class="code-snippet__keyword">install</span> <a href="https://dl.fedoraproject.org/pub/epel/epel-" target="_blank">https://dl.fedoraproject.org/pub/epel/epel-</a><span class="code-snippet__keyword">release</span>-latest<span class="code-snippet__number">-7.</span>noarch.rpm yum <span class="code-snippet__keyword">install</span> <span class="code-snippet__keyword">http</span>://rpms.remirepo.net/<span class="code-snippet__keyword">enterprise</span>/remi-<span class="code-snippet__keyword">release</span><span class="code-snippet__number">-7.</span>rpm</span></code><code><span class="code-snippet_outer">yum <span class="code-snippet__keyword">install</span> yum-utils -y</span></code><code><span class="code-snippet_outer">yum-config-manager <span class="code-snippet__comment">--enable remi-php56</span></span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 安装依赖环境</span></span></code><code><span class="code-snippet_outer">yum <span class="code-snippet__keyword">install</span> httpd.x86_64 mariadb-server.x86_64 mariadb.x86_64 mariadb-libs.x86_64 php.x86_64 php-fpm.x86_64 php-mysql.x86_64 php-mbstring.x86_64 php-ldap.x86_64 php- xmlrpc.x86_64 php-xml.x86_64 php-gd.x86_64 php-imap.x86_64 -y</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 最后将下载的压缩包放置到网站目录，并开启防火墙与关闭SELinux即可。 </span></span></code></pre></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><img class="rich_pages js_insertlocalimg" data-ratio="0.52578125" data-s="300,640" style="text-align: center;color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 17px;" data-type="png" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=2edbf082&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamjMu9UCWguIxgHcic70OOl3ksuGnxXkgJlDf9nmNCXdYIFrnWibLTILERlX7op0Og3v2IPd3Lrmmmg%2F640%3Fwx_fmt%3Dpng"/><br/></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">关于</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">LimeSurvey</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">的使用这里不过多描述，简单一句话就是：创建调查文件</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">--</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">创建新题组</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">--</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">创建问题。</span></span></section><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.5561312607944733" data-s="300,640" style="" data-type="png" data-w="1158" src="https://wechat2rss.xlab.app/img-proxy/?k=fe0d8648&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamjMu9UCWguIxgHcic70OOl3ticyHnVkVLIryDcrUY3h15BSVbTfvyXKWLWgap3dw54bXpzuUtfLVKA%2F640%3Fwx_fmt%3Dpng"/></p><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);font-size: 15px;">此时我们就准备好了我们的钓⻥邮件，接下来就是选择一个好用的工具了。</span></section><section data-tools="新媒体排版" data-id="9966" data-style-type="标题"><section style="font-family: Arial;border-width: 0px;border-style: none;border-color: initial;color: rgb(49, 147, 105);max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;max-width: 100%;"><section style="width: 0.6em;display: inline-block;vertical-align: middle;max-width: 100%;"><span data-bgopacity="40%" style="width: 0.6em;height: 0.6em;display: block;opacity: 0.2;color: rgb(255, 255, 255);background-color: rgba(89, 155, 171, 0.6);"></span><span data-bgopacity="25%" style="margin-top: 2px;margin-bottom: 2px;width: 0.6em;height: 0.6em;display: block;opacity: 0.6;color: rgb(255, 255, 255);background-color: rgba(89, 155, 171, 0.75);"></span><span style="width: 0.6em;height: 0.6em;display: block;opacity: 1;color: rgb(255, 255, 255);background-color: rgb(89, 155, 171);"></span></section><section style="padding-left: 10px;display: inline-block;vertical-align: middle;max-width: 100%;"><section style="max-width: 100%;font-size: 20px;">钓鱼工具的选择</section></section></section></section></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);font-size: 15px;">相对来说钓⻥工具很多比较经典的有：</span></section><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p><span style="font-size: 15px;"><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">Gophish</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">：</span><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"><a href="https://getgophish.com/" target="_blank">https://getgophish.com/</a></span></span></p><p><span style="font-size: 15px;"><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"></span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">(</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">PS.</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">小</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">也写过相关的文章：</span><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"><a href="https://bloodzer0.github.io/ossa/infrastructure-security/network-security/office-network-security/gophish/" target="_blank">https://bloodzer0.github.io/ossa/infrastructure-security/network-security/office-network-security/gophish/</a></span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">)</span></span></p></li><li><p><span style="font-size: 15px;"><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">Swaks</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">：</span><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"><a href="https://www.jetmore.org/john/code/swaks/" target="_blank">https://www.jetmore.org/john/code/swaks/</a></span></span></p><p><span style="font-size: 15px;"><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"></span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">(</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">PS.</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">小</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">也写过：</span><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"><a href="https://mp.weixin.qq.com/s/2xhTg6HhgnFMA7jexgg3AA" target="_blank">https://mp.weixin.qq.com/s/2xhTg6HhgnFMA7jexgg3AA</a></span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">本文中关于</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">SPF</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">绕过的部分写的有误，后期小</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">会更新一下)</span></span></p></li><li><p><span style="font-size: 15px;background-color: white;text-align: left;font-family: ArialMT, serif;color: rgb(51, 71, 91);">mail_fishing</span><span style="font-size: 15px;background-color: white;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">：</span><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"><a href="https://github.com/SecurityPaper/mail_fishing" target="_blank">https://github.com/SecurityPaper/mail_fishing</a></span><strong style="font-size: 15px;background-color: white;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;text-align: left;"><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"></span></strong></p></li></ul><p><strong style="font-size: 15px;background-color: white;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;text-align: left;"><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"></span></strong><span style="font-size: 15px;background-color: white;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">这里不作过多的描述了，为了方便后期使用脚本自定义发送，所以小</span><span style="font-size: 15px;background-color: white;text-align: left;font-family: ArialMT, serif;color: rgb(51, 71, 91);">B</span><span style="font-size: 15px;background-color: white;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">选择的是</span><span style="font-size: 15px;background-color: white;text-align: left;font-family: ArialMT, serif;color: rgb(51, 71, 91);">Swaks</span><span style="font-size: 15px;background-color: white;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">。选择好工具以</span><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;background-color: white;text-align: left;">后我们就需要来构造我们的邮件了。</span></p><section data-tools="新媒体排版" data-id="9966" data-style-type="标题"><section style="font-family: Arial;border-width: 0px;border-style: none;border-color: initial;color: rgb(49, 147, 105);max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;max-width: 100%;"><section style="width: 0.6em;display: inline-block;vertical-align: middle;max-width: 100%;"><span data-bgopacity="40%" style="width: 0.6em;height: 0.6em;display: block;opacity: 0.2;color: rgb(255, 255, 255);background-color: rgba(89, 155, 171, 0.6);"></span><span data-bgopacity="25%" style="margin-top: 2px;margin-bottom: 2px;width: 0.6em;height: 0.6em;display: block;opacity: 0.6;color: rgb(255, 255, 255);background-color: rgba(89, 155, 171, 0.75);"></span><span style="width: 0.6em;height: 0.6em;display: block;opacity: 1;color: rgb(255, 255, 255);background-color: rgb(89, 155, 171);"></span></section><section style="padding-left: 10px;display: inline-block;vertical-align: middle;max-width: 100%;"><section style="max-width: 100%;font-size: 20px;">构造钓鱼邮件</section></section></section></section></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">构造邮件，其实主要是看你参考的邮件主题是如何发送的，根据其模拟一个即可，比如小</span><span style="font-size: 15px;font-family: ArialMT, serif;color: rgb(51, 71, 91);">B</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">模拟的钓⻥邮件如下(当然了因为脱敏小</span><span style="font-size: 15px;font-family: ArialMT, serif;color: rgb(51, 71, 91);">B</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">并没有截完整)：</span><br/></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);"></span></span></section><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.3321100917431193" data-s="300,640" style="" data-type="png" data-w="545" src="https://wechat2rss.xlab.app/img-proxy/?k=e2541483&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamjMu9UCWguIxgHcic70OOl3F95UCKmIQFFVz9XiclZ8niaNU9m0VndQ03qVFicJcgfbVlCKoU2j2kaOg%2F640%3Fwx_fmt%3Dpng"/></p><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);font-size: 15px;">做好这一切的准备后，我们就可以开始发送邮件了。</span></section><section data-tools="新媒体排版" data-id="9872" data-style-type="标题"><section style="font-family: Arial;border-width: 0px;border-style: none;border-color: initial;color: rgb(49, 147, 105);max-width: 100%;"><section style="margin-top: 0.5em;margin-bottom: 0.5em;border-width: initial;border-style: none;border-color: initial;text-align: center;box-sizing: border-box;color: inherit;max-width: 100%;"><section style="margin-top: 0.7em;width: 1em;height: 1em;display: inline-block;vertical-align: top;border-radius: 100%;box-sizing: border-box;color: rgb(255, 255, 255);background-color: rgb(157, 180, 194);max-width: 100%;"><br/></section><section data-bclessp="-45" style="margin-right: 5px;margin-left: 5px;padding-right: 5px;padding-left: 5px;display: inline-block;vertical-align: middle;border-radius: 0.5em;font-size: 1.2em;font-family: inherit;text-align: left;text-decoration: inherit;box-sizing: border-box;color: inherit;height: 2em;line-height: 2em;border-color: rgb(157, 194, 180);max-width: 80%;"><section style="box-sizing: border-box;color: inherit;max-width: 100%;"><span style="font-size: 22px;">使用Swaks发送钓鱼邮件</span><br/></section></section><section data-bglessp="-90" style="margin-bottom: 0.7em;width: 1em;height: 1em;border-radius: 100%;display: inline-block;vertical-align: bottom;box-sizing: border-box;color: rgb(255, 255, 255);background-color: rgb(161, 194, 157);max-width: 100%;"><br/></section><section style="width: 0px;height: 0px;clear: both;box-sizing: border-box;color: inherit;max-width: 100%;"><br/></section></section></section></section><section data-tools="新媒体排版" data-id="9966" data-style-type="标题"><section style="font-family: Arial;border-width: 0px;border-style: none;border-color: initial;color: rgb(49, 147, 105);max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;max-width: 100%;"><section style="width: 0.6em;display: inline-block;vertical-align: middle;max-width: 100%;"><span data-bgopacity="40%" style="width: 0.6em;height: 0.6em;display: block;opacity: 0.2;color: rgb(255, 255, 255);background-color: rgba(89, 155, 171, 0.6);"></span><span data-bgopacity="25%" style="margin-top: 2px;margin-bottom: 2px;width: 0.6em;height: 0.6em;display: block;opacity: 0.6;color: rgb(255, 255, 255);background-color: rgba(89, 155, 171, 0.75);"></span><span style="width: 0.6em;height: 0.6em;display: block;opacity: 1;color: rgb(255, 255, 255);background-color: rgb(89, 155, 171);"></span></section><section style="padding-left: 10px;display: inline-block;vertical-align: middle;max-width: 100%;"><section style="max-width: 100%;font-size: 20px;">导出邮件为eml或其他格式的内容</section></section></section></section></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">小</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">使用的网易邮箱大师与</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">Outlook</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">的</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">macOS</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">客户端。如果使用网易邮箱大师那么在导出邮件的格式为</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">eml</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">；如果是</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">Outlook</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">那么导出的就是源文件，保存为</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">TXT</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">即可。</span></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">但是需要对文件进行修改，我们先来看一下网易邮箱大师导出的</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">eml</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">文件修改内容：</span></span></section><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.4927536231884058" data-s="300,640" style="" data-type="png" data-w="966" src="https://wechat2rss.xlab.app/img-proxy/?k=af54c516&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamjMu9UCWguIxgHcic70OOl3e177micZs6FpR4mydn3b2iaWPSa0kDH9KWkCpjtjg0e9bOcicGFyweS7Q%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.40518134715025905" data-s="300,640" style="" data-type="png" data-w="965" src="https://wechat2rss.xlab.app/img-proxy/?k=358ef9c2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamjMu9UCWguIxgHcic70OOl3ibAemFtRGy87a1ibHuOXYbcjic5uDdTN3kdpMpRice3dicEAo8SY0fDSZFg%2F640%3Fwx_fmt%3Dpng"/></p><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">对于</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">Outlook</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">的邮件修改内容也大致相同，建议在修改以后先使用</span></span><span style="font-size: 15px;font-family: RobotoMono, serif;color: rgb(232, 104, 0);background-color: rgb(214, 214, 214);">--data</span><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">加载测试是否能发送成功。</span></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);"></span></span></section><section data-tools="新媒体排版" data-id="9966" data-style-type="标题"><section style="font-family: Arial;border-width: 0px;border-style: none;border-color: initial;color: rgb(49, 147, 105);max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;max-width: 100%;"><section style="width: 0.6em;display: inline-block;vertical-align: middle;max-width: 100%;"><span data-bgopacity="40%" style="width: 0.6em;height: 0.6em;display: block;opacity: 0.2;color: rgb(255, 255, 255);background-color: rgba(89, 155, 171, 0.6);"></span><span data-bgopacity="25%" style="margin-top: 2px;margin-bottom: 2px;width: 0.6em;height: 0.6em;display: block;opacity: 0.6;color: rgb(255, 255, 255);background-color: rgba(89, 155, 171, 0.75);"></span><span style="width: 0.6em;height: 0.6em;display: block;opacity: 1;color: rgb(255, 255, 255);background-color: rgb(89, 155, 171);"></span></section><section style="padding-left: 10px;display: inline-block;vertical-align: middle;max-width: 100%;"><section style="max-width: 100%;font-size: 20px;">发送钓鱼邮件</section></section></section></section></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">如果使用</span><span style="font-size: 15px;font-family: ArialMT, serif;color: rgb(51, 71, 91);">126</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">作为发件服务器，要求</span><span style="font-size: 15px;font-family: RobotoMono, serif;color: rgb(232, 104, 0);background-color: rgb(214, 214, 214);">--from</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">后的参数与</span><span style="font-size: 15px;font-family: RobotoMono, serif;color: rgb(232, 104, 0);background-color: rgb(214, 214, 214);">--au</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">的参数一致，如果使用</span><span style="font-size: 15px;font-family: ArialMT, serif;color: rgb(51, 71, 91);">smtp2go</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">平台则没有这个要求，并且显示代发信息的时候会有一些不同。同时需要注意的是修改的</span><span style="font-size: 15px;font-family: ArialMT, serif;color: rgb(51, 71, 91);">eml</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">被我保存在</span><span style="font-size: 15px;font-family: ArialMT, serif;color: rgb(51, 71, 91);">test.txt</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">文件中，并且需要保证文件中</span><span style="font-size: 15px;font-family: ArialMT, serif;color: rgb(51, 71, 91);">To</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">参数的值与</span><span style="font-size: 15px;font-family: RobotoMono, serif;color: rgb(232, 104, 0);background-color: rgb(214, 214, 214);">--to</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">的值一致，否则会出现收到的邮件没有收件人：</span><br/></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);"></span></span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="perl"><code><span class="code-snippet_outer"> ./swaks --to yyfortest@126.com --from sender_user@126.com --ehlo <span class="code-snippet__number">126</span>.com --h-From <span class="code-snippet__string">&#34;OA &lt;oa@126.com&gt;&#34;</span> --data test.txt --server smtp.<span class="code-snippet__number">126</span>.com --au sendder_user@126.com --ap sender_user_pass</span></code></pre></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><img class="rich_pages js_insertlocalimg" data-ratio="0.28125" data-s="300,640" style="text-align: center;color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 17px;" data-type="png" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=6ce9be9b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamjMu9UCWguIxgHcic70OOl3B8835ibV6XnnetXVLfpdYkOPQTexvx0QuamuH761M3tM6HrvlOOuUNg%2F640%3Fwx_fmt%3Dpng"/><br/></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="perl"><code><span class="code-snippet_outer"> ./swaks --to yyfortest@126.com --from oa@126.com --ehlo <span class="code-snippet__number">126</span>.com --h-From <span class="code-snippet__string">&#34;OA &lt;oa@126.com&gt;&#34;</span> --data test.txt --server mail.smtp2go.com --au smtp2go_user --ap smtp2go_user_pass</span></code></pre></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: RobotoMono, serif;color: rgb(51, 71, 91);"></span></span><img class="rich_pages js_insertlocalimg" data-ratio="0.3305227655986509" data-s="300,640" style="text-align: center;color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 17px;" data-type="png" data-w="1186" src="https://wechat2rss.xlab.app/img-proxy/?k=31b7ac8f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamjMu9UCWguIxgHcic70OOl3y8exdh9qibXibMhhLIxKXCv0icYNGA3h4B5kFs3pibMLGJzOBqY8XO1bfQ%2F640%3Fwx_fmt%3Dpng"/></section><section data-tools="新媒体排版" data-id="9966" data-style-type="标题"><section style="font-family: Arial;border-width: 0px;border-style: none;border-color: initial;color: rgb(49, 147, 105);max-width: 100%;"><section style="margin-top: 10px;margin-bottom: 10px;max-width: 100%;"><section style="width: 0.6em;display: inline-block;vertical-align: middle;max-width: 100%;"><span data-bgopacity="40%" style="width: 0.6em;height: 0.6em;display: block;opacity: 0.2;color: rgb(255, 255, 255);background-color: rgba(89, 155, 171, 0.6);"></span><span data-bgopacity="25%" style="margin-top: 2px;margin-bottom: 2px;width: 0.6em;height: 0.6em;display: block;opacity: 0.6;color: rgb(255, 255, 255);background-color: rgba(89, 155, 171, 0.75);"></span><span style="width: 0.6em;height: 0.6em;display: block;opacity: 1;color: rgb(255, 255, 255);background-color: rgb(89, 155, 171);"></span></section><section style="padding-left: 10px;display: inline-block;vertical-align: middle;max-width: 100%;"><section style="max-width: 100%;font-size: 20px;">批量发送邮件</section></section></section></section></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">其实我们使用</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">bash</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">脚本就可以批量发送了，但是由于我们这里是加载的邮件内容，并且每次只需的时候需要更改内容中</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">To</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">这一行的收件人，所以小</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">使用最笨的方法如下：</span></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: RobotoMono, serif;color: rgb(168, 84, 0);font-size: 15px;"></span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment">#!/usr/bin/env python3 </span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># -*- coding: utf-8 -*-</span></span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># @Time: 2020/4/20 10:25 上午 </span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># @Author: bloodzer0</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># @File : send_email.py</span></span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">import os</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">email_tmp = []</span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 发件人文件</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">for</span> email <span class="code-snippet__keyword">in</span> open(<span class="code-snippet__string">&#39;user_email.txt&#39;</span>,<span class="code-snippet__string">&#39;r&#39;</span>).readlines():</span></code><code><span class="code-snippet_outer">    email_tmp.append(email.strip())</span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 发送邮件的内容</span></span></code><code><span class="code-snippet_outer">email_old = open(<span class="code-snippet__string">&#39;test.txt&#39;</span>,<span class="code-snippet__string">&#39;r+&#39;</span>) </span></code><code><span class="code-snippet_outer">content = email_old.readlines() </span></code><code><span class="code-snippet_outer">email_old.close()</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__keyword">for</span> send_email <span class="code-snippet__keyword">in</span> email_tmp:</span></code><code><span class="code-snippet_outer">    write_file = open(<span class="code-snippet__string">&#39;test.txt&#39;</span>, <span class="code-snippet__string">&#39;w&#39;</span>)</span></code><code><span class="code-snippet_outer">    write_file.writelines(<span class="code-snippet__string">&#34;To: &lt;%s&gt;&#34;</span> % send_email + <span class="code-snippet__string">&#39;\n&#39;</span> + <span class="code-snippet__string">&#34;&#34;</span>.join(content[1:])) </span></code><code><span class="code-snippet_outer">    write_file.close()</span></code><code><span class="code-snippet_outer">    <span class="code-snippet__built_in">command</span> = <span class="code-snippet__string">&#39;./swaks --to %s --from oa@126.com --ehlo 126.com --h-From &#34;OA</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet_outer">&lt;oa@126.com&gt;&#34; --data test.txt --server mail.smtp2go.com -p 2525 --au smtp2go_user --ap smtp2go_user_pass&#39;</span> % send_email</span></code><code><span class="code-snippet_outer">    <span class="code-snippet__built_in">print</span>(<span class="code-snippet__built_in">command</span>)</span></code><code><span class="code-snippet_outer">    <span class="code-snippet__comment"># os.popen(command)</span></span></code></pre></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: RobotoMono, serif;color: rgb(168, 84, 0);"></span></span></section><section data-tools="新媒体排版" data-id="9872" data-style-type="标题"><section style="font-family: Arial;border-width: 0px;border-style: none;border-color: initial;color: rgb(49, 147, 105);max-width: 100%;"><section style="margin-top: 0.5em;margin-bottom: 0.5em;border-width: initial;border-style: none;border-color: initial;text-align: center;box-sizing: border-box;color: inherit;max-width: 100%;"><section style="margin-top: 0.7em;width: 1em;height: 1em;display: inline-block;vertical-align: top;border-radius: 100%;box-sizing: border-box;color: rgb(255, 255, 255);background-color: rgb(157, 180, 194);max-width: 100%;"><br/></section><section data-bclessp="-45" style="margin-right: 5px;margin-left: 5px;padding-right: 5px;padding-left: 5px;display: inline-block;vertical-align: middle;border-radius: 0.5em;font-family: inherit;text-align: left;text-decoration: inherit;box-sizing: border-box;color: inherit;height: 2em;line-height: 2em;border-color: rgb(157, 194, 180);max-width: 80%;"><section style="box-sizing: border-box;color: inherit;max-width: 100%;"><span style="font-size: 22px;">统计命中率</span></section></section><section data-bglessp="-90" style="margin-bottom: 0.7em;width: 1em;height: 1em;border-radius: 100%;display: inline-block;vertical-align: bottom;box-sizing: border-box;color: rgb(255, 255, 255);background-color: rgb(161, 194, 157);max-width: 100%;"><br/></section><section style="width: 0px;height: 0px;clear: both;box-sizing: border-box;color: inherit;max-width: 100%;"><br/></section></section></section></section><p><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;background-color: white;text-align: left;">在本次测试中，我们的调查问卷系统可以辅助，或者自己编写⻚面将录入的数据写入数据库。</span><br/></p><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.2640625" data-s="300,640" style="" data-type="png" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=4c9011ca&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamjMu9UCWguIxgHcic70OOl3KVfI05N0ibeqlGMFkHqyrpNdWs3iawk9QwUkFkuGvRpM6oic1wGyN2p5g%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.1515625" data-s="300,640" style="" data-type="png" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=b0d55ade&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamjMu9UCWguIxgHcic70OOl3RibibJ3oicfmCjbTbPqbzNdicwTviatGRKAAP9byiclyRATGtecB0xr80FEg%2F640%3Fwx_fmt%3Dpng"/></p><section data-tools="新媒体排版" data-id="9872" data-style-type="标题"><section style="font-family: Arial;border-width: 0px;border-style: none;border-color: initial;color: rgb(49, 147, 105);max-width: 100%;"><section style="margin-top: 0.5em;margin-bottom: 0.5em;border-width: initial;border-style: none;border-color: initial;text-align: center;box-sizing: border-box;color: inherit;max-width: 100%;"><section style="margin-top: 0.7em;width: 1em;height: 1em;display: inline-block;vertical-align: top;border-radius: 100%;box-sizing: border-box;color: rgb(255, 255, 255);background-color: rgb(157, 180, 194);max-width: 100%;"><br/></section><section data-bclessp="-45" style="margin-right: 5px;margin-left: 5px;padding-right: 5px;padding-left: 5px;display: inline-block;vertical-align: middle;border-radius: 0.5em;font-size: 1.2em;font-family: inherit;text-align: left;text-decoration: inherit;box-sizing: border-box;color: inherit;height: 2em;line-height: 2em;border-color: rgb(157, 194, 180);max-width: 80%;"><section style="box-sizing: border-box;color: inherit;max-width: 100%;"><span style="font-size: 22px;">钓鱼邮件防护</span><br/></section></section><section data-bglessp="-90" style="margin-bottom: 0.7em;width: 1em;height: 1em;border-radius: 100%;display: inline-block;vertical-align: bottom;box-sizing: border-box;color: rgb(255, 255, 255);background-color: rgb(161, 194, 157);max-width: 100%;"><br/></section><section style="width: 0px;height: 0px;clear: both;box-sizing: border-box;color: inherit;max-width: 100%;"><br/></section></section></section></section><p><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;background-color: white;text-align: left;">识别钓⻥邮件：</span><br/></p><ol class="list-paddingleft-2" style="list-style-type: decimal;"><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">看发件人地址(有的时候看到的是表象，发件人是公司内部地址也不一定真实)；</span></p></li><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">看邮件标题；</span></p></li><li><p><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;background-color: white;text-align: left;">看正文措辞；</span></p></li><li><p><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;background-color: white;text-align: left;">看正文目的；</span></p></li></ol><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);font-size: 15px;">防范钓⻥邮件：</span></section><ol class="list-paddingleft-2" style="list-style-type: decimal;"><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">安装杀毒软件；</span></p></li><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">个人信息要保密，填写前请人为核对是否属于内部要求；</span></p></li><li><p><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;background-color: white;text-align: left;">邮</span><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;background-color: white;text-align: left;">箱账号需要启</span><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;background-color: white;text-align: left;">用双因素校验，即使密码丢了也不怕；</span></p></li><li><p><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;background-color: white;text-align: left;">重要的邮件请即时从邮件服务器删除，保存到本地；</span></p></li><li><p><span style="font-size: 15px;background-color: white;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">不要轻信发件人地址中的</span><span style="font-size: 15px;background-color: white;text-align: left;font-family: ArialMT, serif;color: rgb(51, 71, 91);">&#34;</span><span style="font-size: 15px;background-color: white;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">显示名</span><span style="font-size: 15px;background-color: white;text-align: left;font-family: ArialMT, serif;color: rgb(51, 71, 91);">&#34;</span><span style="font-size: 15px;background-color: white;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">、不要轻易点开陌生邮件中的链接与附件、不要放松对</span><span style="font-size: 15px;background-color: white;text-align: left;font-family: ArialMT, serif;color: rgb(51, 71, 91);">&#34;</span><span style="font-size: 15px;background-color: white;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">熟人</span><span style="font-size: 15px;background-color: white;text-align: left;font-family: ArialMT, serif;color: rgb(51, 71, 91);">&#34;</span><span style="font-size: 15px;background-color: white;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">邮</span><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;background-color: white;text-align: left;">件的警惕、不要使用公共场所的网络执行敏感操作、不要将敏感信息发布到互联网；</span></p></li></ol><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);font-size: 15px;">中招后的操作：</span></section><ol class="list-paddingleft-2" style="list-style-type: decimal;"><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">及时报告给</span><span style="font-size: 15px;font-family: ArialMT, serif;color: rgb(51, 71, 91);">IT</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">团队；</span></p></li><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">及时修改密码；</span></p></li><li><p><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;background-color: white;text-align: left;">隔离网络；</span></p></li><li><p><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;background-color: white;text-align: left;"></span><span style="color: rgb(51, 71, 91);font-family: PingFangSC, sans-serif;font-size: 15px;background-color: white;text-align: left;">进行一次全盘杀毒；</span></p></li></ol><section data-tools="新媒体排版" data-id="9872" data-style-type="标题"><section style="font-family: Arial;border-width: 0px;border-style: none;border-color: initial;color: rgb(49, 147, 105);max-width: 100%;"><section style="margin-top: 0.5em;margin-bottom: 0.5em;border-width: initial;border-style: none;border-color: initial;text-align: center;box-sizing: border-box;color: inherit;max-width: 100%;"><section style="margin-top: 0.7em;width: 1em;height: 1em;display: inline-block;vertical-align: top;border-radius: 100%;box-sizing: border-box;color: rgb(255, 255, 255);background-color: rgb(157, 180, 194);max-width: 100%;"><br/></section><section data-bclessp="-45" style="margin-right: 5px;margin-left: 5px;padding-right: 5px;padding-left: 5px;display: inline-block;vertical-align: middle;border-radius: 0.5em;font-size: 1.2em;font-family: inherit;text-align: left;text-decoration: inherit;box-sizing: border-box;color: inherit;height: 2em;line-height: 2em;border-color: rgb(157, 194, 180);max-width: 80%;"><section style="box-sizing: border-box;color: inherit;max-width: 100%;"><span style="font-size: 22px;">refer<br/></span><br/></section></section><section data-bglessp="-90" style="margin-bottom: 0.7em;width: 1em;height: 1em;border-radius: 100%;display: inline-block;vertical-align: bottom;box-sizing: border-box;color: rgb(255, 255, 255);background-color: rgb(161, 194, 157);max-width: 100%;"><br/></section><section style="width: 0px;height: 0px;clear: both;box-sizing: border-box;color: inherit;max-width: 100%;"><br/></section></section></section></section><p><span style="text-align: left;font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">钓⻥邮件模板：</span><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);font-size: 15px;"><a href="https://github.com/SimplySecurity/SimplyTemplate" target="_blank">https://github.com/SimplySecurity/SimplyTemplate</a></span><strong style="color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;text-align: left;font-size: 15px;"></strong><br/></p><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><strong><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"></span></strong></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">钓⻥邮件模板：</span><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"><a href="https://github.com/criggs626/PhishingTemplates" target="_blank">https://github.com/criggs626/PhishingTemplates</a></span><strong><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"></span></strong></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">钓⻥邮件工具：</span><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"><a href="https://github.com/xHak9x/SocialPhish" target="_blank">https://github.com/xHak9x/SocialPhish</a></span><strong><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"></span></strong></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">如何伪造一封合格的钓⻥邮件：</span><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"><a href="https://blog.csdn.net/yiifaa/article/details/78471241" target="_blank">https://blog.csdn.net/yiifaa/article/details/78471241</a></span><strong><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"></span></strong></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">记一次真实的邮件钓⻥演练：</span><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"><a href="https://xz.aliyun.com/t/5412" target="_blank">https://xz.aliyun.com/t/5412</a></span><strong><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"></span></strong></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">记一次企业安全意识宣传活动</span><span style="font-family: ArialMT, serif;color: rgb(51, 71, 91);">-</span><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">钓⻥邮件：</span><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"><a href="https://www.freebuf.com/column/154460.html" target="_blank">https://www.freebuf.com/column/154460.html</a></span><strong><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"></span></strong></span></section><section style="text-align: left;font-size: 14px;color: rgb(0, 0, 0);white-space: normal;background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);">钓⻥邮件攻击防范指南：</span><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"><a href="https://cloud.tencent.com/developer/news/234444" target="_blank">https://cloud.tencent.com/developer/news/234444</a></span><strong><span style="font-family: Arial, sans-serif;color: rgb(63, 183, 130);"></span></strong></span></section><section data-tools="新媒体排版" data-id="2950898" data-style-type="undefined"><p style="min-height: 1em;color: rgb(62, 62, 62);font-size: 16px;text-align: center;white-space: normal;max-width: 100% !important;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="font-size: 14px;"></span><br style="display:none;"/></p><p style="text-align: center;max-width: 100%;"><img class="__bg_gif" data-copyright="0" data-ratio="0.6666666666666666" style="max-width: 100%;width: auto !important;height: auto !important;visibility: visible !important;" data-type="gif" data-w="30" src="https://wechat2rss.xlab.app/img-proxy/?k=e560fa19&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_gif%2FrbP97vC6miamjMu9UCWguIxgHcic70OOl3wykEqcib5M9Ce7zicCWMD8Hia7A9ib6Bic1f0IiaGNic4gjX0nb9vYuKKt4lg%2F640%3Fwx_fmt%3Dgif"/><br style="display:none;"/></p><section style="white-space: normal;text-align: center;font-size: 14px;color: rgb(0, 0, 0);background: white;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(51, 71, 91);font-size: 15px;">谷歌是个好东⻄</span></section></section>



<p><a href="https://zhuanlan.zhihu.com/p/134653316">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=2b7e85fd&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483972%26idx%3D1%26sn%3Db550837ee842c41eec445450877f07d9%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Wed, 22 Apr 2020 19:39:00 +0800</pubDate>
    </item>
    <item>
      <title>浅谈基于IaaS公有云的中小型企业基础安全建设</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483954&amp;idx=1&amp;sn=604d60116c632278aa939e901d40b71b</link>
      <description>云IDC是时下的热点，关于企业在使用云IDC时遇到的安全痛点与解决方案，让我们一起来探讨。</description>
      <content:encoded><![CDATA[<p>
原创 <span>bloodzer0</span> <span>2020-04-16 13:29</span> <span style="display: inline-block;"></span>
</p>

<p>云IDC是时下的热点，关于企业在使用云IDC时遇到的安全痛点与解决方案，让我们一起来探讨。</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=a5a81e84&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6mianibqYr4GQloHM0ibzgxzkvrefsqprvCibobN2jeX6CdlLyrKHrtyxd2VbxhqS0fVCUnV6k8bttln8Uw%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section style="display: none;" data-tools="新媒体管家" data-label="powered by xmt.cn"><br/></section><section data-style-type="1" data-tools="新媒体排版" data-id="11868"><section style="border-width: 0px;border-style: none;border-color: initial;"><section powered-by="KolEditor.us" style="box-sizing: border-box;"><section style="text-align: center;box-sizing: border-box;"><section style="padding-top: 0.6em;padding-bottom: 0.6em;display: inline-block;vertical-align: top;box-sizing: border-box;"><section style="margin-bottom: -0.6em;display: inline-block;vertical-align: bottom;width: 1.8em;height: 1.8em;border-left-width: 2px;border-left-style: dotted;border-left-color: rgb(193, 193, 193);border-top-width: 2px;border-top-style: dotted;border-top-color: rgb(193, 193, 193);box-sizing: border-box;"><br/></section><section style="padding-right: 5px;padding-left: 5px;display: inline-block;vertical-align: top;border-width: 2px;border-style: solid;border-radius: 5px;font-size: 19.2px;box-sizing: border-box;border-color: rgb(61, 133, 198);max-width: 86%;"><section style="box-sizing: border-box;color: rgb(102, 102, 102);"><span style="font-size: 22px;">背景</span><br/></section></section><section style="margin-top: -0.6em;display: inline-block;vertical-align: top;width: 1.8em;height: 1.8em;border-right-width: 2px;border-right-style: dotted;border-right-color: rgb(193, 193, 193);border-bottom-width: 2px;border-bottom-style: dotted;border-bottom-color: rgb(193, 193, 193);box-sizing: border-box;"><br/></section></section></section></section></section></section><p><span style="text-align: left;font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">互联网数据中心（</span><span style="text-align: left;font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span><span style="text-align: left;font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">）属于互联网基础设施范畴的一个细分领域。为企业、金融机构等提供一个存放服务器的空间场所，随着科技技术的发展，</span><span style="text-align: left;font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span><span style="text-align: left;font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">也经历了一个又一个的里程碑，如下图是：摘自《美国数据中心建设发展历程分析情况》</span><br/></p><p style="white-space: normal;text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.4096" data-s="300,640" data-w="1250" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=d441ff37&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianibqYr4GQloHM0ibzgxzkvreokJUHFM8OiaCcQFVcnQT4doWjiaDcibVBlVZ0xiazibp8ELZqTuXoWUvVUg%2F640%3Fwx_fmt%3Dpng"/></p><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">从图中我们可以看到</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">发展由传统的自建</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">机房、租用或托管服务器的方式向虚拟化云</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">转型。过去的几年里，选择云</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">的中小型企业数不胜数，小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">也曾经在几家企业中参与相关的安全建设。提到云</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">那么不得不提的就是现在云计算模式的不同带来的云</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">类型不同：</span></span></section><p style="white-space: normal;text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.592948717948718" data-s="300,640" data-w="1248" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=3c11e7ab&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianibqYr4GQloHM0ibzgxzkvreCmBPygcsZRygMNqDPCE7LZ39rW1XloaCHwPicbyZqeYe3o6SyaKicplw%2F640%3Fwx_fmt%3Dpng"/></p><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">云计算平台本身提供三种类型的云服务：</span></span></section><ul class="list-paddingleft-2" style="width: 577.422px;white-space: normal;"><li><p><span style="font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IaaS</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">（基础设施即服务）：消费者通过</span><span style="font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">Internet</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">可以从完善的计算机基础设施获得服务，这类服务称为基础设施即服务，基于</span><span style="font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">Internet</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">的服务（如存储和数据库）是</span><span style="font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IaaS</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">的一部分。</span></p></li><li><p><span style="font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">PaaS（平台即服务）</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">：</span><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">PaaS</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">提供了用户可以访问的完整或部分的应用程序开发。</span></p></li><li><p><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">SaaS</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">（软件即服务）：</span><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">SaaS</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">则提供了完整的可直接使用的应用程序，比如通过</span><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">Internet</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">管理企业资源。</span></p></li></ul><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">同样的，在云服务的衍生下，我们还出现了：</span><span style="font-family: PingFangSC, sans-serif;color: rgb(233, 105, 0);font-size: 15px;background-color: rgb(214, 214, 214);">公有云</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">、</span><span style="font-family: PingFangSC, sans-serif;color: rgb(233, 105, 0);font-size: 15px;background-color: rgb(214, 214, 214);">私有云</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">、</span><span style="font-family: PingFangSC, sans-serif;color: rgb(233, 105, 0);font-size: 15px;background-color: rgb(214, 214, 214);">混合云</span><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">等概念。在本篇文章中，我们主要探讨的是基于</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IaaS</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">公有云的安全，因为</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IaaS</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">是最贴近传统</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">这样的理念，它具有用户可访问的资源（主机、数据库等等）。</span></span></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);"><br/></span></span></section><section data-style-type="1" data-tools="新媒体排版" data-id="11867"><section style="border-width: 0px;border-style: none;border-color: initial;padding: 0px;color:rgb(102, 102, 102);">
	
			
				<section style="text-align: center;box-sizing: border-box;">
					<section style="display: inline-block;vertical-align: top;padding: 0.6em 0px;box-sizing: border-box;">
						<section style="display: inline-block;vertical-align: top;width: 1.8em;height: 1.8em;margin-top: -0.6em;border-left-width: 2px;border-left-style: dotted;border-left-color: rgb(193, 193, 193);border-bottom-width: 2px;border-bottom-style: dotted;border-bottom-color: rgb(193, 193, 193);box-sizing: border-box;">
						</section>
						<section style="display: inline-block;vertical-align: top;border-width: 2px;border-style: solid;border-radius: 5px;font-size: 19.2px;padding: 0px 5px;box-sizing: border-box;max-width: 86% !important;border-color:rgb(61, 133, 198);">
							<section style="box-sizing: border-box;"><span style="font-size: 22px;">IaaS云的安全痛点</span></section>
						</section>
						<section style="display: inline-block;vertical-align: bottom;width: 1.8em;height: 1.8em;margin-bottom: -0.6em;border-right-width: 2px;border-right-style: dotted;border-right-color: rgb(193, 193, 193);border-top-width: 2px;border-top-style: dotted;border-top-color: rgb(193, 193, 193);box-sizing: border-box;">
						</section>
					</section>
				</section></section></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">在参考了一些行业内的资料以及根据自身的实践，将云安全痛点分为了</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">3</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">类：</span></span><br/></section><p style="white-space: normal;text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.5472" data-s="300,640" data-w="1250" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=311da8e1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianibqYr4GQloHM0ibzgxzkvreqibMrlrQqFatzPrAM6ick3bNEMDrs9w3pkPjVfcWqQzFgg5LvAJbIskA%2F640%3Fwx_fmt%3Dpng"/></p><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">第一类是</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">CSA</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">云计算联盟定义的威胁分级种类;第二类就是根据云平台自身的属性所导致的安全⻛险;第三类是小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">在从企业安全建设时遇到的痛点与难题。我们从这三类中不难看出主要的⻛险集中在：资产管理问题、网络攻击⻛险、数据安全管理、身份管理与访问控制、业务连续性管理、监管合规。</span></span></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">因为精力与时间，当然了主要问题是很多层面的安全⻛险小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">没有接触过，所以下文就主要从企业安全建设的⻆度来谈：</span></span></section><section data-style-type="1" data-tools="新媒体排版" data-id="11792" style="white-space: normal;"><section style="border-width: 0px;border-style: none;border-color: initial;"><section powered-by="KolEditor.us" style="box-sizing: border-box;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><section style="width: 578px;border-bottom: 5px solid rgb(1, 135, 207);box-sizing: border-box;"><section style="margin-bottom: -5px;padding-right: 5px;padding-left: 5px;display: inline-block;vertical-align: bottom;border-bottom: 5px solid rgb(169, 211, 214);min-width: 1em;text-align: center;font-size: 19.2px;box-sizing: border-box;"><section style="box-sizing: border-box;color: rgb(102, 102, 102);"><span style="font-size: 20px;">凭证管理的痛点</span></section></section></section></section></section></section></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">对于凭证管理，小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">主要列举了</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">2</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">类的痛点：第一类是比传统</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">更多的凭证类型，在传统</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">中我们更多的是使用服务器管理凭证，但是在云</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">中我们会新增两类凭证：</span></span></section><ul class="list-paddingleft-2" style="width: 577.422px;white-space: normal;"><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">云控制台访问凭证，此类凭证用于我们通过</span><span style="font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">Internet</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">访问云控制台，在这其中又存在两个小类：</span></p></li><ul class="list-paddingleft-2" style="list-style-type: circle;"><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">主账号：拥有其</span><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;">下所有资源和企业级分布式应用服务的所有操作权限。</span></p></li><li><p><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;">子账号：</span><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;">主账号通过创建子账号，避免用户间共享密钥，按需给子账号分配权限。</span></p></li></ul><li><p><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">AccessKey</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">：访问密钥</span><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">AccessKey</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">（</span><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">AK</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">）用于程序方式调用云服务</span><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">API</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">（主账号与子账号都有</span><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">AccessKey</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">）。</span></p></li></ul><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">第二类痛点就是由于云</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">的非集中化导致的分散式凭证生命周期管理。多样化的凭证与凭证的分散性导致了我们难以集中化管理，也经常会导致凭证管理不当而出现的安全问题。</span></span></section><p style="white-space: normal;text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="1.0657342657342657" data-s="300,640" data-w="715" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=2c230254&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianibqYr4GQloHM0ibzgxzkvre4skzh3dcCfPDdtuD30GkHVvpFWoPewOLKTqv9MuvX06V5CKUVp8HFA%2F640%3Fwx_fmt%3Dpng"/></p><section data-style-type="1" data-tools="新媒体排版" data-id="11792" style="white-space: normal;"><section style="border-width: 0px;border-style: none;border-color: initial;"><section powered-by="KolEditor.us" style="box-sizing: border-box;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><section style="width: 578px;border-bottom: 5px solid rgb(1, 135, 207);box-sizing: border-box;"><section style="margin-bottom: -5px;padding-right: 5px;padding-left: 5px;display: inline-block;vertical-align: bottom;border-bottom: 5px solid rgb(169, 211, 214);min-width: 1em;text-align: center;font-size: 19.2px;box-sizing: border-box;"><section style="box-sizing: border-box;color: rgb(102, 102, 102);"><span style="font-size: 20px;">资产管理的痛点</span></section></section></section></section></section></section></section><p style="white-space: normal;text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.5456" data-s="300,640" data-w="1250" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=fd29557b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianibqYr4GQloHM0ibzgxzkvre0aI85hHJ3TBYIUvVkb8rrat0oaBkIuOkE8TWu0iav1svdUszlsnntjQ%2F640%3Fwx_fmt%3Dpng"/></p><ul class="list-paddingleft-2" style="width: 577.422px;white-space: normal;"><li><p><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">分散的地区：在使用传统</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">机房的时候，中小型企业可能只有</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">1~3</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">机房，但是我们在使用云</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">时面临的地域就会变得更多，上述提到的</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">4</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">种架构都会形成不同的地域</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">分布，给我们管理云资产带来不便。</span></span></p></li><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">多样的类型：云</span><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;">上的产品的细分类给我们提供了使用便捷的同时也带来了资产管理的难题，多样的类型导致我们在进行管理的时候需要处理的数据源更多，不同数据源的字段、属性也不一致也会造成统一采集的困难。</span></p></li><li><p><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">不同的维度：在这里需要提到的一个系统就是</span><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">CMDB</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">，可能对于很多企业来讲</span><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">CMDB</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">的维护都是做的很一般或者做不到资产的实时管理。这个问题在中小型企业就更为常⻅，他们可能都没有</span><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">CMDB</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">或者是非常简易的</span><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">CMDB</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">。并且运维与安全对于</span><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">CMDB</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">数据的细粒度要求是不一致的，很难将两者合二为一，更多的做法是各行其事，数据互补。最后在安全做黑盒的云资产管理时云平台自身会对黑盒的方式进行一些拦截从而造成一些资产收集的误报以及漏报，这些问题我们都会在下面的解决方案中提到。</span></p></li></ul><section data-style-type="1" data-tools="新媒体排版" data-id="11792" style="white-space: normal;"><section style="border-width: 0px;border-style: none;border-color: initial;"><section powered-by="KolEditor.us" style="box-sizing: border-box;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><section style="width: 578px;border-bottom: 5px solid rgb(1, 135, 207);box-sizing: border-box;"><section style="margin-bottom: -5px;padding-right: 5px;padding-left: 5px;display: inline-block;vertical-align: bottom;border-bottom: 5px solid rgb(169, 211, 214);min-width: 1em;text-align: center;font-size: 19.2px;box-sizing: border-box;"><section style="box-sizing: border-box;color: rgb(102, 102, 102);"><span style="font-size: 20px;">访问控制的痛点</span></section></section></section></section></section></section></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">对于访问控制来说，它是基于前面两者痛点的延伸：其中主要是</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">2</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">类问题，第一类问题是从凭证层面的访问控制：</span></span></section><ul class="list-paddingleft-2" style="width: 577.422px;white-space: normal;"><li><p><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;">云控制台有哪些用户可以访问?</span></p></li><ul class="list-paddingleft-2" style="list-style-type: circle;"><li><p><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;">主账号是否存在共享使用?（有多少企业是所有运维直接共用主账号进行管理）</span></p></li><li><p><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;">子账号是否存在共享使用?（云控制台用户是否将自己的账号共享给其他用户）</span></p></li><li><p><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;">子账号是否有⻆色权限以外的权限?</span></p></li><li><p><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;">灰度账号是否处于活跃状态?（离职员工的账号是否及时清理）</span></p></li><li><p><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">AccessKey</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">是否拥有过高的权限?</span></p></li><li><p><span style="color: rgb(52, 73, 94);font-family: SourceSansPro, serif;font-size: 15px;text-align: left;">............</span></p></li></ul><li><p><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;">服务器资源哪些用户可以访问?</span></p></li><ul class="list-paddingleft-2" style="list-style-type: circle;"><li><p><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;">谁拥有服务器上的特权账户?</span></p></li><li><p><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;"></span><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;">统一单点登录以外的账号?</span></p></li></ul></ul><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);font-size: 15px;">第二类的痛点是网络层面的访问控制：在这一类问题中云控制台本身就是针对互联网开放的，我们需要做好的就是凭证管理，其次就是云资产的访问控制</span></section><ul class="list-paddingleft-2" style="width: 577.422px;white-space: normal;"><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">云资产对互联网或办公网络的访问控制策略（</span><span style="font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">RDS</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">是否允许互联网直接访问?核心服务器是否允许互联网直接访问?）</span></p></li><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">不同类型云资产之间的访问控制策略（RDS对ECS的访</span><span style="text-align: left;font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">问控制策略）</span></p></li><li><p><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;">相同类型不同属性云资产的访问控制策略（生产环境与测试环境的访问控制）</span></p></li></ul><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">当然了访问控制的痛点远远不止我这里列举的这些，还有很多企业在安全建设时都会遇到不同的安全痛点。</span></span></section><section data-style-type="1" data-tools="新媒体排版" data-id="11792" style="white-space: normal;"><section style="border-width: 0px;border-style: none;border-color: initial;"><section powered-by="KolEditor.us" style="box-sizing: border-box;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><section style="width: 578px;border-bottom: 5px solid rgb(1, 135, 207);box-sizing: border-box;"><section style="margin-bottom: -5px;padding-right: 5px;padding-left: 5px;display: inline-block;vertical-align: bottom;border-bottom: 5px solid rgb(169, 211, 214);min-width: 1em;text-align: center;font-size: 19.2px;box-sizing: border-box;"><section style="box-sizing: border-box;color: rgb(102, 102, 102);"><span style="font-size: 20px;">流量采集的痛点</span></section></section></section></section></section></section></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">因为云</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IDC</span></span><span style="font-family: PingFangSC, sans-serif;color: rgb(233, 105, 0);font-size: 15px;background-color: rgb(214, 214, 214);">边界淡化</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">失去了传统意义上的统一入口或出口，我们无法在对出入口的流量进行镜像或汇聚处理，导致安全建设中失去了一张王牌。</span></section><section data-style-type="1" data-tools="新媒体排版" data-id="11792" style="white-space: normal;"><section style="border-width: 0px;border-style: none;border-color: initial;"><section powered-by="KolEditor.us" style="box-sizing: border-box;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><section style="width: 578px;border-bottom: 5px solid rgb(1, 135, 207);box-sizing: border-box;"><section style="margin-bottom: -5px;padding-right: 5px;padding-left: 5px;display: inline-block;vertical-align: bottom;border-bottom: 5px solid rgb(169, 211, 214);min-width: 1em;text-align: center;font-size: 19.2px;box-sizing: border-box;"><section style="box-sizing: border-box;color: rgb(102, 102, 102);"><span style="font-size: 20px;">其他安全痛点</span></section></section></section></section></section></section></section><ul class="list-paddingleft-2" style="width: 577.422px;white-space: normal;"><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">胡乱的资产分组：生产与测试处于同一</span><span style="font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">VPC</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">;</span></p></li><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">成吨的网络攻击：由于云IDC的开放</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">性，所以每天会面临成吨的访问控制扫描、漏洞扫描、</span><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">Web</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">扫描等;</span></p></li><li><p><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);"></span><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;">分散的补丁管理：</span><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;">如果企业没有统一资产管理系统或者服务器未使用域环境，那么我们在安装补丁时也会遇到麻烦;</span></p></li></ul><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><br/></section><section data-style-type="1" data-tools="新媒体排版" data-id="11868"><section style="border-width: 0px;border-style: none;border-color: initial;padding: 0px;"><section style="box-sizing: border-box;" powered-by="KolEditor.us"><section style="text-align: center;box-sizing: border-box;"><section style="display: inline-block;vertical-align: top;padding: 0.6em 0px;box-sizing: border-box;"><section style="display: inline-block;vertical-align: bottom;width: 1.8em;height: 1.8em;margin-bottom: -0.6em;border-left-width: 2px;border-left-style: dotted;border-left-color: rgb(193, 193, 193);border-top-width: 2px;border-top-style: dotted;border-top-color: rgb(193, 193, 193);box-sizing: border-box;"><br/></section><section style="display: inline-block;vertical-align: top;border-width: 2px;border-style: solid;border-radius: 5px;font-size: 19.2px;padding: 0px 5px;box-sizing: border-box;max-width: 86% !important;border-color:rgb(61, 133, 198);"><section style="box-sizing: border-box;color: rgb(102, 102, 102);"><span style="font-size: 22px;">IaaS云的基础安全建设</span><br/></section></section><section style="display: inline-block;vertical-align: top;width: 1.8em;height: 1.8em;margin-top: -0.6em;border-right-width: 2px;border-right-style: dotted;border-right-color: rgb(193, 193, 193);border-bottom-width: 2px;border-bottom-style: dotted;border-bottom-color: rgb(193, 193, 193);box-sizing: border-box;"><br/></section></section></section></section></section></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;">在知道了⻛险之后，我们就需要进行安全防护了，本文没有涉及数据、应用与业务层面的安全防护方案。</span><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;">云安全自身是一个大的安全话题，也不是一篇文章就能够写完的。</span><br/></section><section data-style-type="1" data-tools="新媒体排版" data-id="11792" style="white-space: normal;"><section style="border-width: 0px;border-style: none;border-color: initial;"><section powered-by="KolEditor.us" style="box-sizing: border-box;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><section style="width: 578px;border-bottom: 5px solid rgb(1, 135, 207);box-sizing: border-box;"><section style="margin-bottom: -5px;padding-right: 5px;padding-left: 5px;display: inline-block;vertical-align: bottom;border-bottom: 5px solid rgb(169, 211, 214);min-width: 1em;text-align: center;font-size: 19.2px;box-sizing: border-box;"><section style="box-sizing: border-box;color: rgb(102, 102, 102);"><span style="font-size: 20px;">购买云产品</span></section></section></section></section></section></section></section><p style="white-space: normal;text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.6233974358974359" data-s="300,640" data-w="1248" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=d29de50b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianibqYr4GQloHM0ibzgxzkvre09DVxFY6HXa4oCRJhQvBJkQ8JPARoQkpdpZlE3F0A24XibicYgo16Dxg%2F640%3Fwx_fmt%3Dpng"/></p><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">在这里只是列举了应对上述提出的安全问题的云产品，当然我这里也只选择了一家云服务商的产品，并且可能还忽略了一些产品，所以大家只参考一下即可。</span></span></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">对于购买产品，小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">这里有一点想分享的经验：云产品更多是普遍适用性的，可能在不同企业中使用相同产品达到的效果也是不一致的。</span></span></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">其次就是购买产品是需要</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">money</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">的，加之本文的前提是中小型企业，这样的企业很可能就是无安全人员或者</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">1~3</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">个人的安全部。如果企业无安全人员，小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">的建议是别折腾，能买一些重要的产品再好好运营一些也是</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">OK</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">，包括小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">在图中提到的也不是每一项都要钱。如果是</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">1~3</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">个人安全部，企业愿意花钱与无安全团队的做法建议是一致的，不愿意花钱可以选择折腾一些开源产品，小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">在博客上也提到过很多相关的安全产品（</span><strong><span style="font-family: SourceSansPro, serif;color: rgb(66, 185, 131);">https:</span></strong><strong><span style="font-family: SourceSansPro, serif;color: rgb(66, 185, 131);">//bloodzer0.github.io/ossa/</span></strong><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">）</span></span></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">最后就是产品也好，开源工具也罢都是需要我们去不断运营和优化的。工具是死的人是活的，我们需要做的就是将工具发挥出它最大的价值。</span></span></section><section data-style-type="1" data-tools="新媒体排版" data-id="11792" style="white-space: normal;"><section style="border-width: 0px;border-style: none;border-color: initial;"><section powered-by="KolEditor.us" style="box-sizing: border-box;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><section style="width: 578px;border-bottom: 5px solid rgb(1, 135, 207);box-sizing: border-box;"><section style="margin-bottom: -5px;padding-right: 5px;padding-left: 5px;display: inline-block;vertical-align: bottom;border-bottom: 5px solid rgb(169, 211, 214);min-width: 1em;text-align: center;font-size: 19.2px;box-sizing: border-box;"><section style="box-sizing: border-box;color: rgb(102, 102, 102);"><span style="font-size: 20px;">解决凭证管理难题</span></section></section></section></section></section></section></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">在解决凭证管理这个问题上，小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">经历了</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">3</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">个阶段：第一个阶段是没有任何辅助，只能通过主账号来梳理凭证并且通过一些</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IT</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">流程来进行管理;第二个阶段是利用云</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">API</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">进行自动化的凭证管理;第三个阶段就是实现集中化的凭证管理。在这里小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">主要提一下后两个阶段：</span></span></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 17px;"><strong><span style="font-size: 17px;font-family: 微软雅黑, sans-serif;color: rgb(52, 73, 94);">利用云</span></strong><strong><span style="font-size: 17px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">API</span></strong><strong><span style="font-size: 17px;font-family: 微软雅黑, sans-serif;color: rgb(52, 73, 94);">实现凭证管理</span></strong></span></section><p style="white-space: normal;text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="1.034438775510204" data-s="300,640" data-w="784" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=3b2d2ad5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianibqYr4GQloHM0ibzgxzkvreUsHcAB5XfsHesNVAfxia9VFK2nVialqpVz2tHsK9SA3k5CtxoBic58MBw%2F640%3Fwx_fmt%3Dpng"/></p><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">在这一个部分小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">主要是通过代码来实现</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">3</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">个方向上的凭证管理：</span></span></section><ol class="list-paddingleft-2" style="width: 577.422px;white-space: normal;"><li><p><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;">通过内部通讯工具的接口获取用户原始数据，并且采集通讯工具中的用户属性;</span></p></li><li><p><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;">利用云API管理</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">云控制台账户，根据用户属性决定是否需要创建或删除云控制台账户;</span></p></li><li><p><span style="color: rgb(52, 73, 94);font-family: PingFangSC, sans-serif;font-size: 15px;text-align: left;">与内部的跳板机打通，根据用户属性决定是否需要创建登录或删除资产访问账户;</span></p></li></ol><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">在这里小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">还额外做了一件事情，就是监控互联网的部分平台，查看是否有公司的凭证信息泄露，主要是</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">GitHub</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">、码云与网盘。</span></span></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 17px;"><strong><span style="font-size: 17px;font-family: 微软雅黑, sans-serif;color: rgb(52, 73, 94);">集中化的凭证管理</span></strong></span></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">在前一阶段的基础之上，小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">完善了凭证管理体系，还是以内部通讯工具中用户属性作为源数据，并且实现统一账户管理（基于</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">FreeIPA</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">）与统一单点登录，最后将统一账户管理接入跳板机（</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">JumpServer</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">）与单点登录接入云控制台：</span></span></section><p style="white-space: normal;text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.271875" data-s="300,640" data-w="1280" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=8b9b2e10&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianibqYr4GQloHM0ibzgxzkvreicQPYdxO4jQXQV0q8giciaINDRia7tEWapOVvVaFeduvIqia9MJRYsSr6Vg%2F640%3Fwx_fmt%3Dpng"/></p><section data-style-type="1" data-tools="新媒体排版" data-id="11792" style="white-space: normal;"><section style="border-width: 0px;border-style: none;border-color: initial;"><section powered-by="KolEditor.us" style="box-sizing: border-box;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><section style="width: 578px;border-bottom: 5px solid rgb(1, 135, 207);box-sizing: border-box;"><section style="margin-bottom: -5px;padding-right: 5px;padding-left: 5px;display: inline-block;vertical-align: bottom;border-bottom: 5px solid rgb(169, 211, 214);min-width: 1em;text-align: center;font-size: 19.2px;box-sizing: border-box;"><section style="box-sizing: border-box;color: rgb(102, 102, 102);"><span style="font-size: 20px;">解决资产管理难题</span></section></section></section></section></section></section></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">资产管理小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">也分为了几步走，但是本文提到的最后一步是小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">还未实现的;</span></span></section><ol class="list-paddingleft-2" style="width: 577.422px;white-space: normal;"><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">黑盒资产管理：以扫描的形式发现资产（</span><span style="font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">masscan+nmap+nessus</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">等），通过将扫描结果进行数据处理后入库然后以</span><span style="font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">CMDB</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">的形式展示。但是在这个阶段中会由于云平台的拦截产生误报与漏报，所以这里的资产管理数据我们还需要更进一步的处理。</span></p></li><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">白盒资产管理（利用云API），之前小B也分析过对应的文章：</span></p><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);"></span><strong style="font-size: 15px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;text-align: left;"><span style="font-family: SourceSansPro, serif;color: rgb(66, 185, 131);">https:</span></strong><strong style="font-size: 15px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;text-align: left;"><span style="font-family: SourceSansPro, serif;color: rgb(66, 185, 131);">//bloodzer0.github.io/ossa/other-security-branch/asset-management/asset-acquisition/</span></strong></p><p><strong style="font-size: 15px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;text-align: left;"><span style="font-family: SourceSansPro, serif;color: rgb(66, 185, 131);"><img class="rich_pages js_insertlocalimg" data-ratio="0.5575117370892019" data-s="300,640" style="text-align: center;" data-type="png" data-w="852" src="https://wechat2rss.xlab.app/img-proxy/?k=befd8602&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianibqYr4GQloHM0ibzgxzkvrej8BP0lewsSoVzhOUZ5pgDGWiby6Tp90UOkDkhhGCYIPafn3JHibrq2mg%2F640%3Fwx_fmt%3Dpng"/></span></strong></p></li><li><p><span style="text-align: left;font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">利用主机入侵检测</span><span style="text-align: left;font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">Agent</span><span style="text-align: left;font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">采集数据，不论是前面的黑盒方式或利用</span><span style="text-align: left;font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">API</span><span style="text-align: left;font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">的方式，我们获取到的数据在细粒度上都达不到安全后期的要求，所以利用主机入侵检测的</span><span style="text-align: left;font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">Agent</span><span style="text-align: left;font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">可以获取更详细的信息，但是由于这个层面需要对底层开发有着足够深厚的了解，这也是小</span><span style="text-align: left;font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="text-align: left;font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">未实现的原因。但是小</span><span style="text-align: left;font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="text-align: left;font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">也实践过开源的主机入侵检测系统（</span><span style="text-align: left;font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">OSSEC</span><span style="text-align: left;font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">）采集信息完善安全的</span><span style="text-align: left;font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">CMDB</span><span style="text-align: left;font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">，效果也是很不错的。</span></p></li></ol><section data-style-type="1" data-tools="新媒体排版" data-id="11792" style="white-space: normal;"><section style="border-width: 0px;border-style: none;border-color: initial;"><section powered-by="KolEditor.us" style="box-sizing: border-box;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><section style="width: 578px;border-bottom: 5px solid rgb(1, 135, 207);box-sizing: border-box;"><section style="margin-bottom: -5px;padding-right: 5px;padding-left: 5px;display: inline-block;vertical-align: bottom;border-bottom: 5px solid rgb(169, 211, 214);min-width: 1em;text-align: center;font-size: 19.2px;box-sizing: border-box;"><section style="box-sizing: border-box;color: rgb(102, 102, 102);"><span style="font-size: 20px;">解决访问控制问题</span></section></section></section></section></section></section></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">访问控制是一个很大的话题，涉及的面也是多种多样的，小</span><span style="font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">可能一句两句也讲不清楚，但是会尽力把实践过的内容给大家讲清楚：</span></span></section><ol class="list-paddingleft-2" style="width: 577.422px;white-space: normal;"><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">制定访问控制策略与管理流程：访问控制难题不仅仅是一个通过技术就能解决的，首先我们需要制定好访问控制策略，在制定策略之前我们需要梳理我们的主体（使用者）与客体（资源），在评估主体的需求后制定出策略，访问控制策略一定要依据最小权限原则。制定好策略只是一个起始点，后期策略的管理也至关重要，在这其中小</span><span style="font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">B</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">是通过以</span><span style="font-size: 15px;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">IT</span><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">流程的形式进行策略变更管理。</span></p></li><li><p><span style="font-size: 15px;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">制定好策略以后我们需要实现策略控制，在这里对于凭证的访问控制，主要是通过云控制台管理进行。对于资产的管理主要是利用安全组来实现的，安全组可能并不具备攻击防护能力，但是具备良好的访问控制策略。在安全组实现访问控制的时候，会遇到一个大坑，就是当我们的IDC数量越来越多时，我们管理就会变的更加困难。所以如果前期就有这样的</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">安全意识是最好的，后期就会需要我们逐一的去调整已有的策略。</span><span style="text-align: center;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"></span></p><p><span style="text-align: center;font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><img class="rich_pages js_insertlocalimg" data-ratio="0.21875" data-s="300,640" data-w="1280" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=d1606f4b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianibqYr4GQloHM0ibzgxzkvreLib4UblYHtDwz1gYavlaahWGhA28ludyeDuI7yYicTpA8jcqNYH5xyKg%2F640%3Fwx_fmt%3Dpng"/></span></p></li><li><p><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">定期审计访问控制策略是否合理，这里提一点的就是，我们的策略审计最好是以实践的方式进行审计。通过将审计策略拉取到本地（</span><span style="font-size: 15px;text-align: left;font-family: SourceSansPro, serif;color: rgb(52, 73, 94);">API</span><span style="font-size: 15px;text-align: left;font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">是可以拉取的，云控制台也可以导出）然后根据策略的内容去实践策略是否有效。</span></p></li></ol><section data-style-type="1" data-tools="新媒体排版" data-id="11792" style="white-space: normal;"><section style="border-width: 0px;border-style: none;border-color: initial;"><section powered-by="KolEditor.us" style="box-sizing: border-box;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><section style="width: 578px;border-bottom: 5px solid rgb(1, 135, 207);box-sizing: border-box;"><section style="margin-bottom: -5px;padding-right: 5px;padding-left: 5px;display: inline-block;vertical-align: bottom;border-bottom: 5px solid rgb(169, 211, 214);min-width: 1em;text-align: center;font-size: 19.2px;box-sizing: border-box;"><section style="box-sizing: border-box;color: rgb(102, 102, 102);">其他安全痛点</section></section></section></section></section></section></section><section style="white-space: normal;text-align: left;font-size: 14px;color: rgb(0, 0, 0);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"><span style="font-family: PingFangSC, sans-serif;color: rgb(52, 73, 94);">每个企业在使用云都会遇到不同的安全难点，一千个读者就有一千个哈姆雷特，安全也是如此，希望大家一起讨论云安全建设。</span></span></section><section data-style-type="7" data-tools="新媒体排版" data-id="8692" style="white-space: normal;"><p style="margin-right: 8px;margin-left: 8px;padding-right: 1em;padding-left: 1em;letter-spacing: 1.5px;max-width: 100%;min-height: 1em;color: rgb(62, 62, 62);text-align: center;"><br/></p><p style="margin-right: 8px;margin-left: 8px;padding-right: 1em;padding-left: 1em;letter-spacing: 1.5px;max-width: 100%;min-height: 1em;color: rgb(62, 62, 62);text-align: center;"><span style="max-width: 100%;font-family: 微软雅黑;font-size: 14px;color: rgb(19, 79, 92);box-sizing: border-box !important;overflow-wrap: break-word !important;">■ Over ■</span></p></section><p><br/></p>



<p><a href="https://zhuanlan.zhihu.com/p/131348946">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=b7392189&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483954%26idx%3D1%26sn%3D604d60116c632278aa939e901d40b71b%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Thu, 16 Apr 2020 13:29:00 +0800</pubDate>
    </item>
    <item>
      <title>Swaks SMTP协议操作工具</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483915&amp;idx=1&amp;sn=6eb5fa78da1849ca9fd7123147977e71</link>
      <description>Swaks：Swiss Army Knife SMTP （SMTP界的瑞士军刀）利用它我们可以操作SMTP协议报文。</description>
      <content:encoded><![CDATA[<p>
原创 <span>bloodzer0</span> <span>2020-04-13 20:09</span> <span style="display: inline-block;"></span>
</p>

<p>Swaks：Swiss Army Knife SMTP （SMTP界的瑞士军刀）利用它我们可以操作SMTP协议报文。</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=3eda7b17&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6mialKM7TuhciayJiaFd2xpIy38QVzpW2XxRAibfcIn2g0ibSTKFmPXgjRD6TRr7FH6lqPq9BE4qYpfiaJNvw%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="font-size: 16px;color: black;padding-right: 10px;padding-left: 10px;line-height: 1.6;letter-spacing: 0px;word-break: break-word;overflow-wrap: break-word;text-align: left;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;margin-top: -10px;"><p><br/></p><section data-tools="新媒体排版" data-id="3155235" data-style-type="undefined"><section style="max-width: 100%;"><section style="margin: 0px 10px;display: flex;justify-content: center;align-items: center;max-width: 100%;"><section style="width: 55px;flex-shrink: 0;max-width: 100%;"><img data-ratio="0.6363636363636364" style="vertical-align: middle;max-width: 100%;width: 55px !important;height: auto !important;visibility: visible !important;" data-type="png" data-w="55" src="https://wechat2rss.xlab.app/img-proxy/?k=66d176d1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialKM7TuhciayJiaFd2xpIy38QLYYGMo5EYQgEc5WElTnZ8vJnlmenkkb7NRtog1NPL32C5shN1cVuWw%2F640%3Fwx_fmt%3Dpng"/><br style="display:none;"/></section><section style="margin: 0px 5px;max-width: 100%;"><p style="margin: 0px;font-size: 15px;color: rgb(244, 144, 57);text-align: center;max-width: 100%;">日常不稳定更新系列</p></section></section></section><p style="max-width: 100%;"><br/></p><p style="max-width: 100%;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0px;color:#000;">Swaks：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0px;color:#000;">Swiss Ar</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0px;color:#000;">my Knife SMTP （SMTP界的瑞士军刀）利用它我们可以操作</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0px;color:#000;">SMTP协议报文。</span><br/></p></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="letter-spacing: 0px;">Swaks官网地址：</span><span style="letter-spacing: 0px;">https</span><span style="letter-spacing: 0px;">://www.jetmore.org/john/code/swaks/</span></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="letter-spacing: 0px;">Swaks GitHub地址：</span><span style="letter-spacing: 0px;"><a href="https://github.com/jetmore/swaks" target="_blank">https://github.com/jetmore/swaks</a></span></section><section data-tools="新媒体排版" data-id="13409" data-style-type="9"><section data-tools-id="49736" style="max-width: 100%;"><section style="margin: 0px 10px;display: flex;justify-content: center;align-items: flex-end;max-width: 100%;"><section style="width: 25px;height: 29px;background-image: url(&#34;https://mmbiz.qpic.cn/sz_mmbiz_png/rbP97vC6mialKM7TuhciayJiaFd2xpIy38QxcRWZ5HCKfjJStK4qN2lB61re0wficwQexhtKG6FwuoWt2Khlzib7asw/640?wx_fmt=png&#34;);line-height: 29px;background-size: 100%;background-repeat: no-repeat;background-position: center center;flex-shrink: 0;max-width: 100%;"><p style="margin: 0px;font-size: 15px;color: rgb(51, 51, 51);text-align: center;max-width: 100%;">1</p></section><section style="padding: 0px 10px 2px 20px;border-bottom: 1px dashed rgb(51, 51, 51);max-width: 100%;"><section style="margin: 0px;font-size: 15px;color: rgb(51, 51, 51);text-align: center;letter-spacing: 1.5px;max-width: 100%;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 24px;">Swaks安装</span></section></section></section></section><p style="max-width: 100%;"><br/></p><p style="max-width: 100%;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 22px;font-weight: bold;letter-spacing: 0px;color:#000;">直接使用二</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 22px;font-weight: bold;letter-spacing: 0px;color:#000;">进制文件</span><br/></p></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer">wget <a href="https://www.jetmore.org/john/code/swaks/files/swaks-20190914.0.tar.gz" target="_blank">https://www.jetmore.org/john/code/swaks/files/swaks-20190914.0.tar.gz</a></span></code><code><span class="code-snippet_outer">tar -xf swaks-20190914.0.tar.gz</span></code><code><span class="code-snippet_outer"><span class="code-snippet__built_in">cd</span> swaks-20190914.0/</span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 执行</span></span></code><code><span class="code-snippet_outer">./swaks</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># git clone <a href="https://github.com/jetmore/swaks.git" target="_blank">https://github.com/jetmore/swaks.git</a></span></span></code></pre></section><h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 22px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="display: none;"></span>macOS安装Swaks</h2><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer">brew install swaks</span></code></pre></section><h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 22px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="display: none;"></span>Kali自带Swaks</h2><section data-tools="新媒体排版" data-id="13409" data-style-type="9"><section data-tools-id="49736" style="max-width: 100%;"><section style="margin: 0px 10px;display: flex;justify-content: center;align-items: flex-end;max-width: 100%;"><section style="width: 25px;height: 29px;background-image: url(&#34;https://mmbiz.qpic.cn/sz_mmbiz_png/rbP97vC6mialKM7TuhciayJiaFd2xpIy38QxcRWZ5HCKfjJStK4qN2lB61re0wficwQexhtKG6FwuoWt2Khlzib7asw/640?wx_fmt=png&#34;);line-height: 29px;background-size: 100%;background-repeat: no-repeat;background-position: center center;flex-shrink: 0;max-width: 100%;"><p style="margin: 0px;font-size: 15px;color: rgb(51, 51, 51);text-align: center;max-width: 100%;">2</p></section><section style="padding: 0px 10px 2px 20px;border-bottom: 1px dashed rgb(51, 51, 51);max-width: 100%;"><section style="margin: 0px;font-size: 15px;color: rgb(51, 51, 51);text-align: center;letter-spacing: 1.5px;max-width: 100%;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 24px;">Swaks使用</span></section></section></section></section></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 测试邮件服务器连通性</span></span></code><code><span class="code-snippet_outer">./swaks --to email_user@domain_1</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 发件人邮箱</span></span></code><code><span class="code-snippet_outer">--from email_user@domain_2</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 伪造邮件头</span></span></code><code><span class="code-snippet_outer">--ehlo domain_2</span></code></pre></section><h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 22px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="display: none;"></span>测试126邮箱</h2><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 直接发送成功，见下图</span></span></code><code><span class="code-snippet_outer">./swaks --to yyfortest@126.com</span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 伪造发件人不成功，但是在执行命令的返回中显示是成功的</span></span></code><code><span class="code-snippet_outer">./swaks --to yyfortest@126.com --from pentest@126.com --ehlo 126.com</span></code></pre></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.36191860465116277" style="display: block;margin-right: auto;margin-left: auto;" data-type="png" data-w="688" src="https://wechat2rss.xlab.app/img-proxy/?k=add0a2fc&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialKM7TuhciayJiaFd2xpIy38QRYPVvL3UC9QyvcapibQ89GjlRUwMFzoN7qNJT5gibqroZC0a2zrfdlicQ%2F640%3Fwx_fmt%3Dpng"/><section style="margin-top: 5px;text-align: center;color: rgb(136, 136, 136);font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">swaks_1</section></figure><h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 22px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="display: none;"></span>使用邮件托管平台</h2><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">smtp2go：<a href="https://support.smtp2go.com/hc/en-gb" target="_blank">https://support.smtp2go.com/hc/en-gb</a> 注册一个免费的账户可以发送1000封邮件</p><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer">./swaks --to yyfortest@126.com --from root@126.com --ehlo 126.com --server mail.smtp2go.com -p 2525 --au username --ap password</span></code></pre></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">此时邮件发送成功，但是可以看到邮件中会显示由xx服务器代发。</section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.383939774153074" style="display: block;margin-right: auto;margin-left: auto;" data-type="png" data-w="797" src="https://wechat2rss.xlab.app/img-proxy/?k=0d1f0017&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialKM7TuhciayJiaFd2xpIy38QYrUrs2BxrsJSdkMypQhh1HicnJvCIJ2DcEujr3uicB27yTHOBo3NF8tg%2F640%3Fwx_fmt%3Dpng"/><section style="margin-top: 5px;text-align: center;color: rgb(136, 136, 136);font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">swaks_2</section></figure><h2 data-tool="mdnice编辑器" style="margin-top: 30px;margin-bottom: 15px;font-weight: bold;font-size: 22px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="display: none;"></span>加载附件</h2><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer">./swaks --to yyfortest@126.com --from root@126.com --ehlo 126.com --attach 1.txt --server mail.smtp2go.com -p 2525 --au username --ap password</span></code></pre></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.452914798206278" style="display: block;margin-right: auto;margin-left: auto;" data-type="png" data-w="892" src="https://wechat2rss.xlab.app/img-proxy/?k=e4c70bc3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialKM7TuhciayJiaFd2xpIy38QBw9dmaAG6cNB85bjwGnDQS9JUpj5ZZoiaXQKu6dkZbUbkeAecZpVjicg%2F640%3Fwx_fmt%3Dpng"/><section style="margin-top: 5px;text-align: center;color: rgb(136, 136, 136);font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">swaks_3</section></figure><section data-tools="新媒体排版" data-id="13409" data-style-type="9"><section data-tools-id="49736" style="max-width: 100%;"><section style="margin: 0px 10px;display: flex;justify-content: center;align-items: flex-end;max-width: 100%;"><section style="width: 25px;height: 29px;background-image: url(&#34;https://mmbiz.qpic.cn/sz_mmbiz_png/rbP97vC6mialKM7TuhciayJiaFd2xpIy38QxcRWZ5HCKfjJStK4qN2lB61re0wficwQexhtKG6FwuoWt2Khlzib7asw/640?wx_fmt=png&#34;);line-height: 29px;background-size: 100%;background-repeat: no-repeat;background-position: center center;flex-shrink: 0;max-width: 100%;"><p style="margin: 0px;font-size: 15px;color: rgb(51, 51, 51);text-align: center;max-width: 100%;">3</p></section><section style="padding: 0px 10px 2px 20px;border-bottom: 1px dashed rgb(51, 51, 51);max-width: 100%;"><section style="margin: 0px;font-size: 15px;color: rgb(51, 51, 51);text-align: center;letter-spacing: 1.5px;max-width: 100%;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 24px;">所谓的绕过SPF</span></section></section></section></section></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">看了一些关于绕过SPF的，其实就是<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;">--from</code>后面的参数与<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;">--server</code>后面的参数保持一致，如下：</section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer">./swaks --to receiver@domain1 --from sender@domain2 --ehlo domain1 --server domain2 -p 2525 --au username --ap password</span></code></pre></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">原理就是：接收方在收到邮件时会获取发件邮件服务器的IP，然后校验发件人的IP是否在发件邮件服务的IP列表中。有点拗口，通俗理解就是发件人的后缀需要与发件邮件服务器一致或是被包含关系。</section><section data-tools="新媒体排版" data-id="13409" data-style-type="9"><section data-tools-id="49736" style="max-width: 100%;"><section style="margin: 0px 10px;display: flex;justify-content: center;align-items: flex-end;max-width: 100%;"><section style="width: 25px;height: 29px;background-image: url(&#34;https://mmbiz.qpic.cn/sz_mmbiz_png/rbP97vC6mialKM7TuhciayJiaFd2xpIy38QxcRWZ5HCKfjJStK4qN2lB61re0wficwQexhtKG6FwuoWt2Khlzib7asw/640?wx_fmt=png&#34;);line-height: 29px;background-size: 100%;background-repeat: no-repeat;background-position: center center;flex-shrink: 0;max-width: 100%;"><p style="margin: 0px;font-size: 15px;color: rgb(51, 51, 51);text-align: center;max-width: 100%;">4</p></section><section style="padding: 0px 10px 2px 20px;border-bottom: 1px dashed rgb(51, 51, 51);max-width: 100%;"><section style="margin: 0px;font-size: 15px;color: rgb(51, 51, 51);text-align: center;letter-spacing: 1.5px;max-width: 100%;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 24px;">Refer</span></section></section></section></section><p style="max-width: 100%;"><br style="display:none;"/></p></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">关于伪造邮件的简单研究：<a href="https://hex.moe/p/4878b295/" target="_blank">https://hex.moe/p/4878b295/</a></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Swaks伪造邮件：<a href="https://payloads.online/archivers/2019-05-09/1" target="_blank">https://payloads.online/archivers/2019-05-09/1</a></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Swaks绕过SPF验证进行邮件伪造：<a href="https://www.cnblogs.com/backlion/p/10842676.html" target="_blank">https://www.cnblogs.com/backlion/p/10842676.html</a></section></section><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><br/></section>



<p><a href="2247483915">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=1f892efd&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483915%26idx%3D1%26sn%3D6eb5fa78da1849ca9fd7123147977e71%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 13 Apr 2020 20:09:00 +0800</pubDate>
    </item>
    <item>
      <title>工具推荐系列 - Genymotion模拟器ARM转换</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483911&amp;idx=1&amp;sn=7ab8c3eb218407de82ba65db3b4288e4</link>
      <description>Genymotion默认使用的是x86的架构，安装ARM架构的APP时会报错，可以使用该工具进行解决。</description>
      <content:encoded><![CDATA[<p>
<span></span> <span>2020-04-08 17:47</span> <span style="display: inline-block;"></span>
</p>

<p>Genymotion默认使用的是x86的架构，安装ARM架构的APP时会报错，可以使用该工具进行解决。</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=00c3cb87&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6mianNJfoLTYtjJ7fCoNwaVQ6A5ErLiahbYhYZibdYNCj7Lz4x2Z7P8icQUtDxMKDf1RCOjibjibcFTSNbcxg%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="font-size: 16px;color: black;padding-right: 10px;padding-left: 10px;line-height: 1.6;letter-spacing: 0px;word-break: break-word;overflow-wrap: break-word;text-align: left;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;margin-top: -10px;"><p><br/></p><section data-tools="新媒体排版" data-id="3155235" data-style-type="undefined"><section style="max-width: 100%;"><section style="margin: 0px 10px;display: flex;justify-content: center;align-items: center;max-width: 100%;"><section style="width: 55px;flex-shrink: 0;max-width: 100%;"><img data-ratio="0.6363636363636364" style="vertical-align: middle;max-width: 100%;width: 55px !important;height: auto !important;visibility: visible !important;" data-type="png" data-w="55" src="https://wechat2rss.xlab.app/img-proxy/?k=4c3ad109&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianNJfoLTYtjJ7fCoNwaVQ6AvvX1u2wmicA9PoIfhibQhqLT8GVr79tn81d5icDVR7rDq5wPx1GdAKThw%2F640%3Fwx_fmt%3Dpng"/><br style="display:none;"/></section><section style="margin: 0px 5px;max-width: 100%;"><p style="margin: 0px;font-size: 15px;color: rgb(244, 144, 57);text-align: center;max-width: 100%;">日常不稳定更新系列</p></section></section></section><p style="max-width: 100%;"><br style="display:none;"/></p></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;letter-spacing: 0px;">G</span><span style="font-size: 15px;letter-spacing: 0px;">enymotion_ARM_Translation：</span><span style="font-size: 15px;letter-spacing: 0px;"><a href="https://gith" target="_blank">https://gith</a></span><span style="font-size: 15px;letter-spacing: 0px;">u</span><span style="font-size: 15px;letter-spacing: 0px;">b.com/m9rco/Genymotion_ARM_Translation</span><span style="font-size: 15px;"></span></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">Genymotion默认使用的是</span><code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span style="font-size: 15px;">x86</span></code><span style="font-size: 15px;">的架构，安装</span><code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span style="font-size: 15px;">ARM</span></code><span style="font-size: 15px;">架构的APP时会报错如下：</span></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.23446561723280862" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="1207" src="https://wechat2rss.xlab.app/img-proxy/?k=ecfe701e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianNJfoLTYtjJ7fCoNwaVQ6AcNKnRBJJeJF6ImGeiazkPls9aokNA8uC0yic20pibAmpTKGyxNxPwVwcg%2F640%3Fwx_fmt%3Dpng"/><section style="margin-top: 5px;text-align: center;color: rgb(136, 136, 136);font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">genymotion_ram_1</span></section></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">我这里的模拟器版本为：</span></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.35732984293193715" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="764" src="https://wechat2rss.xlab.app/img-proxy/?k=1b1a77c3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianNJfoLTYtjJ7fCoNwaVQ6AXrz6UdexH0gGhTTDHvUibn5icUP3uHaDEQYicYB8MRqkiajdGQATaWH1OA%2F640%3Fwx_fmt%3Dpng"/><section style="margin-top: 5px;text-align: center;color: rgb(136, 136, 136);font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">genymotion_ram_2</span></section></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">在提供的转换器地址下载6.0版本进行安装转换</span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="properties"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># push文件到模拟器中</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__attr">adb</span> <span class="code-snippet__string">push Downloads/Genymotion-ARM-Translation_for_6.0.zip /sdcard</span></span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 进入模拟器</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__attr">adb</span> <span class="code-snippet__string">shell</span></span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 执行安装</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__attr">sh</span> <span class="code-snippet__string">/system/bin/flash-archive.sh /sdcard/Genymotion-ARM-Translation_for_6.0.zip</span></span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 退出模拟器</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__attr">exit</span></span></code><code><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 重启模拟器</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__attr">adb</span> <span class="code-snippet__string">reboot</span></span></code></pre></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">这个时候再重新安装APP即可成功：</span></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.23025768911055694" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="1203" src="https://wechat2rss.xlab.app/img-proxy/?k=0e1d151d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianNJfoLTYtjJ7fCoNwaVQ6A3g8kyuRrHGBHOLG3QHeibsPq3q0rnK4X9PFRqpVjKOvsekRyyasMMRw%2F640%3Fwx_fmt%3Dpng"/><section style="margin-top: 5px;text-align: center;color: rgb(136, 136, 136);font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">genymotion_ram_3</span></section></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">APP也可以正常使用</span></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.7535301668806161" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="779" src="https://wechat2rss.xlab.app/img-proxy/?k=bded23b0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianNJfoLTYtjJ7fCoNwaVQ6A98Dt4vrwfctgMBJZibE0Gg4Idicia0v95HTKVeuicetnicvZ2Xb5icCTeQTw%2F640%3Fwx_fmt%3Dpng"/><section style="margin-top: 5px;text-align: center;color: rgb(136, 136, 136);font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">genymotion_ram_4</span></section></figure></section><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><br/></section>



<p><a href="2247483911">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=ba403f18&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483911%26idx%3D1%26sn%3D7ab8c3eb218407de82ba65db3b4288e4%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Wed, 08 Apr 2020 17:47:00 +0800</pubDate>
    </item>
    <item>
      <title>工具推荐系列 - PESecurity编译选项安全检测</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483907&amp;idx=1&amp;sn=26eb42ff033c1565986c9a6ca2c77706</link>
      <description>PESecurity：一个PowerShell的模块，用来检查EXE/DLL文件编译选项。</description>
      <content:encoded><![CDATA[<p>
<span>bloodzer0</span> <span>2020-04-07 19:00</span> <span style="display: inline-block;"></span>
</p>

<p>PESecurity：一个PowerShell的模块，用来检查EXE/DLL文件编译选项。</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=1eace3de&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6mianqFGOF9cURRGibNJZziaJluD8U20kBibicuJcXtLHfZyMOwDx4TWsZVnD1PHF7b5uG3WTiawhBQ3RjmAg%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="font-size: 16px;color: black;padding-right: 10px;padding-left: 10px;line-height: 1.6;letter-spacing: 0px;word-break: break-word;overflow-wrap: break-word;text-align: left;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;margin-top: -10px;"><p><br/></p><section data-tools="新媒体排版" data-id="13403" data-style-type="9"><section style="max-width: 100%;"><section style="margin: 0px 10px;display: flex;justify-content: center;align-items: center;max-width: 100%;"><section style="width: 55px;flex-shrink: 0;max-width: 100%;"><img data-ratio="0.6363636363636364" style="vertical-align: middle;max-width: 100%;width: 55px !important;height: auto !important;visibility: visible !important;" data-type="png" data-w="55" src="https://wechat2rss.xlab.app/img-proxy/?k=bb501720&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianqFGOF9cURRGibNJZziaJluD6lqyU3uxeaxPSVWwuGVNSibZIwsib7uTnCz2gxFlh0Up5ZJrutCrhRrQ%2F640%3Fwx_fmt%3Dpng"/><br style="display:none;"/></section><section style="margin: 0px 5px;max-width: 100%;"><p style="margin: 0px;font-size: 15px;color: rgb(244, 144, 57);text-align: center;max-width: 100%;">日常不稳定更新系列</p></section></section></section><p style="max-width: 100%;"><br style="display:none;"/></p></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="letter-spacing: 0px;font-size: 15px;">PESecurity GitHub地址：</span><span style="letter-spacing: 0px;font-size: 15px;"><a href="https://github.com/NetSPI/PESecurity" target="_blank">https://github.com/NetSPI/PESecurity</a></span><span style="font-size: 15px;letter-spacing: 0px;"></span></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">一个Powershell的模块，用来检查EXE/DLL文件编译选项，包括：</span><code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span style="font-size: 15px;">ASLR</span></code><span style="font-size: 15px;">, </span><code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span style="font-size: 15px;">DEP</span></code><span style="font-size: 15px;">, </span><code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span style="font-size: 15px;">SafeSEH</span></code><span style="font-size: 15px;">, </span><code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span style="font-size: 15px;">StrongNaming</span></code><span style="font-size: 15px;">, </span><code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;"><span style="font-size: 15px;">Authenticode</span></code><span style="font-size: 15px;">。</span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="powershell"><code><span class="code-snippet_outer"><span class="code-snippet__built_in">Import-Module</span> .\Get-PESecurity.psm1</span></code><code><span class="code-snippet_outer">Get-PESecurity -file <span class="code-snippet__string">&#34;file_path&#34;</span></span></code><code><span class="code-snippet_outer">Get-PESecurity -directory <span class="code-snippet__string">&#34;dir_path&#34;</span></span></code></pre></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.3450834879406308" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="1078" src="https://wechat2rss.xlab.app/img-proxy/?k=dfe2b155&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianqFGOF9cURRGibNJZziaJluDhPzkaibnx14bUT8ejbO9iaeet6fD4yJd8FY8c1ECt2j1jED5MicgMJ1fA%2F640%3Fwx_fmt%3Dpng"/><section style="margin-top: 5px;text-align: center;color: rgb(136, 136, 136);font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">bianyi_check_1</span></section></figure></section>



<p><a href="2247483907">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=5a86e5c7&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483907%26idx%3D1%26sn%3D26eb42ff033c1565986c9a6ca2c77706%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Tue, 07 Apr 2020 19:00:00 +0800</pubDate>
    </item>
    <item>
      <title>工具推荐系列 - sigcheck文件签名检测</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483903&amp;idx=1&amp;sn=f1f24c3bee856302fd4aed893ab94315</link>
      <description>sigcheck：分析CS应用程序需要检查应用程序是否被签名，常用于CS程序安全测试中。</description>
      <content:encoded><![CDATA[<p>
<span>bloodzer0</span> <span>2020-04-06 20:19</span> <span style="display: inline-block;"></span>
</p>

<p>sigcheck：分析CS应用程序需要检查应用程序是否被签名，常用于CS程序安全测试中。</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=75060ae6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6mialicN7G6gGzyjM6JLUEZwrvVAMXEcArB6Zf7Tia5jugB4qNMc5tWb32IiboIoVDKysdYNN6rjwOZNkfw%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="display: none;" data-tools="新媒体管家" data-label="powered by xmt.cn"><br/></section></section><section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="font-size: 16px;color: black;padding-right: 10px;padding-left: 10px;line-height: 1.6;letter-spacing: 0px;word-break: break-word;overflow-wrap: break-word;text-align: left;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;margin-top: -10px;"><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><br/></section><section data-tools="新媒体排版" data-id="13403" data-style-type="9"><section style="max-width: 100%;"><section style="margin: 0px 10px;display: flex;justify-content: center;align-items: center;max-width: 100%;"><section style="width: 55px;flex-shrink: 0;max-width: 100%;"><img data-ratio="0.6363636363636364" style="vertical-align: middle;max-width: 100%;width: 55px !important;height: auto !important;visibility: visible !important;" data-type="png" data-w="55" src="https://wechat2rss.xlab.app/img-proxy/?k=85dadda3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialicN7G6gGzyjM6JLUEZwrvV0ibibuFQt9k5nP8gtaPxUXbUI4uibicDGgM5dd26pRjMOGOqQz00NqW2jA%2F640%3Fwx_fmt%3Dpng"/><br style="display:none;"/></section><section style="margin: 0px 5px;max-width: 100%;"><p style="margin: 0px;font-size: 15px;color: rgb(244, 144, 57);text-align: center;max-width: 100%;">日常不稳定更新系列</p></section></section></section><p style="max-width: 100%;"><br style="display:none;"/></p></section><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">sigcheck官网地址：<a href="https://docs.microsoft.com/en-us/sysinternals/downloads/sigcheck" target="_blank">https://docs.microsoft.com/en-us/sysinternals/downloads/sigcheck</a></p><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="letter-spacing: 0px;">分</span><span style="letter-spacing: 0px;">析CS应用程序需要检查应用程序是否被签名，</span><span style="letter-spacing: 0px;">常用于CS程序安全测试中。</span><span style="letter-spacing: 0px;">小B找了两个</span><span style="letter-spacing: 0px;">例子：</span><span style="letter-spacing: 0px;">一个是没有签名的文件，一个签名的文件：</span></p><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.3504117108874657" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="1093" src="https://wechat2rss.xlab.app/img-proxy/?k=79341008&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialicN7G6gGzyjM6JLUEZwrvVtLia9zKdM22NQpfHGEnOBZjBqUtNtTo5Xn4ia1Vc0bmy8Y0YNwYFTuSA%2F640%3Fwx_fmt%3Dpng"/><section style="margin-top: 5px;text-align: center;color: rgb(136, 136, 136);font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">sigcheck_1</section></figure><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.34615384615384615" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="1092" src="https://wechat2rss.xlab.app/img-proxy/?k=c7b978e9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialicN7G6gGzyjM6JLUEZwrvVNQBkUdVibyTAiaCBQGAMxLJSic5Jx9ibzcfYy1QRpT9ibCialtfm49LxMr4w%2F640%3Fwx_fmt%3Dpng"/><section style="margin-top: 5px;text-align: center;color: rgb(136, 136, 136);font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">sigcheck_2</section></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">当然<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;">sigcheck</code>还支持对整个目录进行签名检查：</section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.4986225895316804" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="1089" src="https://wechat2rss.xlab.app/img-proxy/?k=ac1c22c7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialicN7G6gGzyjM6JLUEZwrvVZ9q41iaOFdhac9C8Eldricg9m918RKNMjUugXEN53xgRXyDQ4j4NbrCw%2F640%3Fwx_fmt%3Dpng"/><section style="margin-top: 5px;text-align: center;color: rgb(136, 136, 136);font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">sigcheck_3</section></figure></section><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><br/></section>



<p><a href="2247483903">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=695e47c2&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483903%26idx%3D1%26sn%3Df1f24c3bee856302fd4aed893ab94315%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 06 Apr 2020 20:19:00 +0800</pubDate>
    </item>
    <item>
      <title>日志分析系列(三):分析实战篇</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483899&amp;idx=1&amp;sn=c8de3d1a0d74981bc7a78814056d67a5</link>
      <description>在之前的系列中，小B完成了日志分析平台的实现，也接入了各种日志源，做好了这些前期工作，接下来就是真正利用平台实现分析并体现日志价值的时候了。</description>
      <content:encoded><![CDATA[<p>
原创 <span>bloodzer0</span> <span>2020-03-16 08:46</span> <span style="display: inline-block;"></span>
</p>

<p>在之前的系列中，小B完成了日志分析平台的实现，也接入了各种日志源，做好了这些前期工作，接下来就是真正利用平台实现分析并体现日志价值的时候了。</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=f7d0d99d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6mian6DPiavhqDyobce5aa40ROEDRwZ0Nib6iac4U3ibkfRCJHbOurx5KVWiaMwUaycqH4U8x4zicX3Sr9LzxQ%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="font-size: 16px;color: black;padding: 10px;line-height: 1.6;letter-spacing: 0px;word-break: break-word;overflow-wrap: break-word;text-align: left;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;"><section style="caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;"><p style="text-align: center;line-height: normal;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="caret-color: rgb(240, 84, 84);color: rgb(240, 84, 84);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 15px;">本系列故事纯属虚构，如有雷同纯属巧合</span><br/></p></section><p style="caret-color: rgb(51, 51, 51);white-space: normal;text-align: center;line-height: normal;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><img data-ratio="0.05555555555555555" data-w="180" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=58a39579&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMdiaNr0OwpmzM4NhqDiaQCfAXn29rSVjqibNP5g9NFiabNR83tdz2F8qEyLQ%2F640%3Fwx_fmt%3Dpng"/></p><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);">在之前的系列中，小B完成了日志分析平台的实现，也接入了各种日志源，做好了这些前期工作，接下来就是真正利用平台实现分析并体现日志价值的时候了。<br/></p><section data-width="100%" data-opacity="1" data-rotate="0" style="margin-right: auto;margin-left: auto;caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;border-width: 0px;border-style: none;border-color: initial;width: 574px;opacity: 1;transform: rotateZ(0deg);"><section style="width: 574px;text-align: center;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="margin-top: 10px;display: inline-block;width: auto;"><section style="display: -webkit-flex;justify-content: center;"><section style="margin-top: 8px;margin-right: -30px;font-size: 16px;width: 45px;"><section style="width: 58px;"><img data-w="70" title="" data-ratio="0.5714285714285714" src="https://wechat2rss.xlab.app/img-proxy/?k=36a6308f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarsp6wbKDYd4qxib2QHqtT18Nic5AmjBMzOcjy8bRauPMsLXiaBuBO1GqlHHg%2F640"/></section></section><section style="padding-right: 16px;padding-left: 16px;line-height: 22px;letter-spacing: 2px;"><p style="color: rgb(63, 62, 63);min-width: 1px;"><span style="font-size: 22px;">日志分析价值</span></p></section><section style="margin-top: -11px;margin-left: -30px;font-size: 16px;width: 35px;"><section style="width: 30px;"><img style="width: 30px;display: block;vertical-align: top;" data-ratio="0.625" data-w="40" src="https://wechat2rss.xlab.app/img-proxy/?k=99a3bd6d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspeahQl4dC745C0AQblUiaZWq1tVYWXxoEbgtzn7BskoD56sWSiczWsOdQ%2F640"/></section></section></section></section></section></section><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);">在安全日志分析的大场景中，我们都是根据不同场景下的特征来进行分析，我们以主机安全场景特征判断为例：<br/></p><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.5924978687127025" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="1173" src="https://wechat2rss.xlab.app/img-proxy/?k=30e0a2b6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mian6DPiavhqDyobce5aa40ROENHUeQ5a5ONWQN04mZ5ZkWggmUc0U3UtcdZg1b0n2KnnGAFwWV7UvNw%2F640%3Fwx_fmt%3Dpng"/></figure><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);">通过对这些场景的思路整理，我们可以发现识别攻击场景的方式大致包括：<strong style="color: rgb(68, 68, 68);">关键字匹配</strong>、<strong style="color: rgb(68, 68, 68);">统计分析</strong>、<strong style="color: rgb(68, 68, 68);">聚合分析</strong>、<strong style="color: rgb(68, 68, 68);">关联分析</strong>。这四种分析方式在前面的文章中我们也提到过，大家有兴趣可以翻看历史文章进行查看。</p><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);">熟悉ES的朋友都应该知道（如果不熟悉的建议阅读几遍ES的官方文档）它支持上述的<strong style="color: rgb(68, 68, 68);">关联分析</strong>之外的所有分析方式，那么我们就可以使用ES的这些查询语句来实现我们的安全日志分析，下文我分享了几个安全日志分析的具体案例：</p><section data-width="100%" data-opacity="1" data-rotate="0" style="margin-right: auto;margin-left: auto;caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;border-width: 0px;border-style: none;border-color: initial;width: 574px;opacity: 1;transform: rotateZ(0deg);"><section style="width: 574px;text-align: center;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="margin-top: 10px;display: inline-block;width: auto;"><section style="display: -webkit-flex;justify-content: center;"><section style="margin-top: 8px;margin-right: -30px;font-size: 16px;width: 45px;"><section style="width: 58px;"><img data-w="70" title="" data-ratio="0.5714285714285714" src="https://wechat2rss.xlab.app/img-proxy/?k=36a6308f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarsp6wbKDYd4qxib2QHqtT18Nic5AmjBMzOcjy8bRauPMsLXiaBuBO1GqlHHg%2F640"/></section></section><section style="padding-right: 16px;padding-left: 16px;line-height: 22px;letter-spacing: 2px;"><p style="color: rgb(63, 62, 63);min-width: 1px;"><span style="font-size: 22px;">demo1:常见的Web攻击</span></p></section><section style="margin-top: -11px;margin-left: -30px;font-size: 16px;width: 35px;"><section style="width: 30px;"><img style="width: 30px;display: block;vertical-align: top;" data-ratio="0.625" data-w="40" src="https://wechat2rss.xlab.app/img-proxy/?k=99a3bd6d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspeahQl4dC745C0AQblUiaZWq1tVYWXxoEbgtzn7BskoD56sWSiczWsOdQ%2F640"/></section></section></section></section></section></section><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);">普通的Web攻击在日志分析中的分析方式与WAF识别攻击相似，都是通过正则表达式或者关键字匹配的方式来实现，ES中存在很多相关的查询语句，我们来体验一下：<br/></p><ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;list-style-type: circle;color: rgb(51, 51, 51);" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;">match匹配</section></li></ul><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.4426705370101596" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="1378" src="https://wechat2rss.xlab.app/img-proxy/?k=43a10096&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mian6DPiavhqDyobce5aa40ROE8N3ugDhDLveibVeicvwNuDGzsefvtETibKHkTPvOPQicVpzD6bShRibWCcQ%2F640%3Fwx_fmt%3Dpng"/></figure><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.361211247296323" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="1387" src="https://wechat2rss.xlab.app/img-proxy/?k=6c687fd1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mian6DPiavhqDyobce5aa40ROETG4sictxgZQyJ0BsibUnjWCktBUPTMI4ZRXEGfbderncxicW6Vg5m2ckw%2F640%3Fwx_fmt%3Dpng"/></figure><ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;list-style-type: circle;color: rgb(51, 51, 51);" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;">利用bool方式进行复合查询</section></li></ul><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.4617067833698031" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="1371" src="https://wechat2rss.xlab.app/img-proxy/?k=96de506f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mian6DPiavhqDyobce5aa40ROExeeoYpvadxS1S6JVib2gLuiaxZBfyGgU27rhBSyiaHQ1EjicBvia5TkweWA%2F640%3Fwx_fmt%3Dpng"/></figure><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);">可以看到的是，我们使用match来进行查找时，需要对关键字进行优化，否则会出现无法找到的情况。那么如何解决这个问题呢？ES中其实还提供了<strong style="color: rgb(68, 68, 68);">通配符（Wildcard）<strong>与</strong>正则表达式</strong>查询</p><ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;list-style-type: circle;color: rgb(51, 51, 51);" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;">通配符查询</section></li></ul><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.485838779956427" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="1377" src="https://wechat2rss.xlab.app/img-proxy/?k=f28c6a90&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mian6DPiavhqDyobce5aa40ROEutBxwEDp1Wp3k8C26BvFFFQLYZRHQvNjiawknrV1ed9ukVMfgTpubxA%2F640%3Fwx_fmt%3Dpng"/></figure><ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;list-style-type: circle;color: rgb(51, 51, 51);" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;">正则表达式查询：正则表达式匹配的方式与通配符类似，但是正则表达式支持更复杂的模式进行查询。</section></li></ul><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);"><strong style="color: rgb(68, 68, 68);">对于正则匹配我们还有一种方式就是使用logstash，jeary曾经在<a href="https://github.com/anbai-inc/AttackFilter实现了。" target="_blank">https://github.com/anbai-inc/AttackFilter实现了。</a></strong></p><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);">我们可以利用此种模式对常见的Web攻击进行分析，需要的就是我们收集常见的关键字：</p><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="2.602112676056338" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="284" src="https://wechat2rss.xlab.app/img-proxy/?k=1862f68b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mian6DPiavhqDyobce5aa40ROEmlCyVECz8YT2DzVR4ib1ibJxyX1efQj2e0HcRSJxRTrjuTlicqtAGX1Zw%2F640%3Fwx_fmt%3Dpng"/></figure><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);">值得一提的是，以正则或者查询的方式去做安全分析都不适合做实时的分析拦截，因为数据量很大的时候查询很费时间，而如果使用Logstash Grok更是可能将日志分析平台搞挂。</p><section data-width="100%" data-opacity="1" data-rotate="0" style="margin-right: auto;margin-left: auto;caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;border-width: 0px;border-style: none;border-color: initial;width: 574px;opacity: 1;transform: rotateZ(0deg);"><section style="width: 574px;text-align: center;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="margin-top: 10px;display: inline-block;width: auto;"><section style="display: -webkit-flex;justify-content: center;"><section style="margin-top: 8px;margin-right: -30px;font-size: 16px;width: 45px;"><section style="width: 58px;"><img data-w="70" title="" data-ratio="0.5714285714285714" src="https://wechat2rss.xlab.app/img-proxy/?k=36a6308f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarsp6wbKDYd4qxib2QHqtT18Nic5AmjBMzOcjy8bRauPMsLXiaBuBO1GqlHHg%2F640"/></section></section><section style="padding-right: 16px;padding-left: 16px;line-height: 22px;letter-spacing: 2px;"><p style="color: rgb(63, 62, 63);min-width: 1px;"><span style="font-size: 22px;">demo2:统计与聚合<br/></span></p></section><section style="margin-top: -11px;margin-left: -30px;font-size: 16px;width: 35px;"><section style="width: 30px;"><img style="width: 30px;display: block;vertical-align: top;" data-ratio="0.625" data-w="40" src="https://wechat2rss.xlab.app/img-proxy/?k=99a3bd6d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspeahQl4dC745C0AQblUiaZWq1tVYWXxoEbgtzn7BskoD56sWSiczWsOdQ%2F640"/></section></section></section></section></section></section><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);">对常见API的聚合统计分析，根据访问API的IP进行排序：查询5分钟内访问api_path的数据，并根据remote_addr进行聚合排序。<br/></p><pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><code style="overflow-x: auto;padding: 16px;color: #333;background: #f8f8f8;display: -webkit-box;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;-webkit-overflow-scrolling: touch;font-size: 14px;">{<br/>    <span style="color: #d14;line-height: 26px;">&#34;size&#34;</span>: 0,<br/>    <span style="color: #d14;line-height: 26px;">&#34;query&#34;</span>: {<br/>    <span style="color: #d14;line-height: 26px;">&#34;bool&#34;</span>: {<br/>        <span style="color: #d14;line-height: 26px;">&#34;must&#34;</span>: [<br/>        {<span style="color: #d14;line-height: 26px;">&#34;term&#34;</span>: {<br/>            <span style="color: #d14;line-height: 26px;">&#34;request_api.keyword&#34;</span>: {<br/>            <span style="color: #d14;line-height: 26px;">&#34;value&#34;</span>: <span style="color: #d14;line-height: 26px;">&#34;api_path&#34;</span><br/>            }<br/>        }}<br/>        ],<br/>        <span style="color: #d14;line-height: 26px;">&#34;filter&#34;</span>: {<br/>        <span style="color: #d14;line-height: 26px;">&#34;range&#34;</span>: {<br/>            <span style="color: #d14;line-height: 26px;">&#34;@timestamp&#34;</span>: {<br/>            <span style="color: #d14;line-height: 26px;">&#34;gte&#34;</span>: <span style="color: #d14;line-height: 26px;">&#34;now-5m&#34;</span>,<br/>            <span style="color: #d14;line-height: 26px;">&#34;lte&#34;</span>: <span style="color: #d14;line-height: 26px;">&#34;now&#34;</span><br/>            }<br/>        }<br/>        }<br/>    }<br/>    },<br/>    <span style="color: #d14;line-height: 26px;">&#34;aggs&#34;</span>: {<br/>    <span style="color: #d14;line-height: 26px;">&#34;ip_count&#34;</span>: {<br/>        <span style="color: #d14;line-height: 26px;">&#34;terms&#34;</span>: {<br/>        <span style="color: #d14;line-height: 26px;">&#34;field&#34;</span>: <span style="color: #d14;line-height: 26px;">&#34;remote_addr.keyword&#34;</span>,<br/>        <span style="color: #d14;line-height: 26px;">&#34;size&#34;</span>: 1000000<br/>        }<br/>    }<br/>    }<br/>}<br/></code></pre><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);">完整的demo我放在了GitHub上：<a href="https://github.com/bloodzer0/python_es_aggs" target="_blank">https://github.com/bloodzer0/python_es_aggs</a></p><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.42892156862745096" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="408" src="https://wechat2rss.xlab.app/img-proxy/?k=9d326cff&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mian6DPiavhqDyobce5aa40ROEd23HouqAJnjva27hIwPZwlljtXZIdgQSrNs9FdpYD84MwwjNoc0z1g%2F640%3Fwx_fmt%3Dpng"/></figure><ul data-tool="mdnice编辑器" style="margin-top: 8px;margin-bottom: 8px;padding-left: 25px;list-style-type: circle;color: rgb(51, 51, 51);" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;">嵌套聚合<img data-ratio="0.48546511627906974" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="1376" src="https://wechat2rss.xlab.app/img-proxy/?k=7afccb7b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mian6DPiavhqDyobce5aa40ROEM6PRPr5wamtsXkuibYPNLeP9ByUdh41H4BdxVc2iaH2Qv16ibrrQk7pKA%2F640%3Fwx_fmt%3Dpng"/></section></li></ul><section data-width="100%" data-opacity="1" data-rotate="0" style="margin-right: auto;margin-left: auto;caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;border-width: 0px;border-style: none;border-color: initial;width: 574px;opacity: 1;transform: rotateZ(0deg);"><section style="width: 574px;text-align: center;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="margin-top: 10px;display: inline-block;width: auto;"><section style="display: -webkit-flex;justify-content: center;"><section style="margin-top: 8px;margin-right: -30px;font-size: 16px;width: 45px;"><section style="width: 58px;"><img data-w="70" title="" data-ratio="0.5714285714285714" src="https://wechat2rss.xlab.app/img-proxy/?k=36a6308f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarsp6wbKDYd4qxib2QHqtT18Nic5AmjBMzOcjy8bRauPMsLXiaBuBO1GqlHHg%2F640"/></section></section><section style="padding-right: 16px;padding-left: 16px;line-height: 22px;letter-spacing: 2px;"><p style="color: rgb(63, 62, 63);min-width: 1px;"><span style="font-size: 22px;">ElastAlert分析模式<br/></span></p></section><section style="margin-top: -11px;margin-left: -30px;font-size: 16px;width: 35px;"><section style="width: 30px;"><img style="width: 30px;display: block;vertical-align: top;" data-ratio="0.625" data-w="40" src="https://wechat2rss.xlab.app/img-proxy/?k=99a3bd6d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspeahQl4dC745C0AQblUiaZWq1tVYWXxoEbgtzn7BskoD56sWSiczWsOdQ%2F640"/></section></section></section></section></section></section><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);">ElastALert GitHub地址<span style="font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 15px;text-align: left;">：</span><span style="letter-spacing: 0px;"><a href="https://github.com/Yelp/elastalert/" target="_blank">https://github.com/Yelp/elastalert/</a></span></p><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);">elastalert支持多样的规则类型：<a href="https://elastalert.readthedocs.io/en/latest/ruletypes.html#rule-types" target="_blank">https://elastalert.readthedocs.io/en/latest/ruletypes.html#rule-types</a></p><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);">本文写的很仓促，很多东西都没有完整的去写。由于工作变更的原因，没有时间去折腾这个系列了，所以今天就算是写个结尾。后续应该会开个新的系列，但是更多偏向于乙方的东西！对于日志分析系列的虎头蛇尾，小B也很抱歉，后期在有精力的时候，我会把一些之前在甲方企业中实践的内容分享出来。主要是如下这幅图的内容：</p><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.6373429084380611" style="display: block;margin-right: auto;margin-left: auto;width: auto;" data-type="png" data-w="1114" src="https://wechat2rss.xlab.app/img-proxy/?k=a6a30e08&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mian6DPiavhqDyobce5aa40ROEIK6ylgYYQgOdFySySYoHIjtEfvUMbEZWASdZpoUyB3IUnUNz5egISg%2F640%3Fwx_fmt%3Dpng"/></figure><section data-style-type="5" data-tools="新媒体排版" data-id="2848935" style="caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;"><section style="text-align: center;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong style="max-width: 100%;color: rgb(62, 62, 62);font-size: 16px;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;line-height: 1.75em;font-size: 15px;color: rgb(171, 25, 66);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="color: rgb(63, 63, 63);font-size: 14px;letter-spacing: 0px;text-align: justify;"><strong style="text-align: center;max-width: 100%;color: rgb(62, 62, 62);font-size: 16px;line-height: 28px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;line-height: 1.75em;font-size: 15px;color: rgb(171, 25, 66);box-sizing: border-box !important;overflow-wrap: break-word !important;"><img class="__bg_gif" data-ratio="1" style="box-sizing: border-box !important;overflow-wrap: break-word !important;visibility: visible !important;width: auto !important;" data-type="gif" data-w="55" src="https://wechat2rss.xlab.app/img-proxy/?k=7875a89b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_gif%2FrbP97vC6mialQaYRulU8sIiced8iapAvkwlPgfvQ3kBp7HzM7mGg1oq2etjkibqXzZAIOOyS4mW0VeU6iczicibyY9w0g%2F640%3Fwx_fmt%3Dgif"/></span></strong></span></span></strong></section></section><section style="color: rgb(0, 0, 0);white-space: normal;caret-color: rgb(51, 51, 51);text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 14px;"><strong>- REFER -</strong></span></section><section style="color: rgb(0, 0, 0);white-space: normal;caret-color: rgb(51, 51, 51);text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">《19个很有用的ES查询语句</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">》：<a href="https://n3xtchen.github.io/n3xtchen/elasticsearch/2017/07/05/elasticsearch-23-useful-query-example" target="_blank">https://n3xtchen.github.io/n3xtchen/elasticsearch/2017/07/05/elasticsearch-23-useful-query-example</a></span></section><section style="caret-color: rgb(51, 51, 51);white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 14px;color: rgb(0, 0, 0);"><strong>- HISTORY -</strong></span><br/></section><section style="caret-color: rgb(51, 51, 51);white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483849&amp;idx=1&amp;sn=cdb1bbe88e24156df44b12f531c48456&amp;chksm=fc981509cbef9c1f499f03b9d520c1e48057829fbafa34c7b54674cc61d2ae3b33c526aa80af&amp;scene=21#wechat_redirect" textvalue="《日志分析系列(一)：介绍篇》" data-itemshowtype="0" tab="innerlink" data-linktype="2"><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">《日志分析系列(一)：</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">介绍篇》</span></a></section><section style="caret-color: rgb(51, 51, 51);white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483869&amp;idx=1&amp;sn=5b43cdc88622a39b9f3eddf930d653cc&amp;chksm=fc98151dcbef9c0b9bab0008ec0e84765cd4bed6a3c9043566d647dd300ffc8739080b3b14fc&amp;scene=21#wechat_redirect" textvalue="《日志分析系列(二)：平台实现篇》" data-itemshowtype="0" tab="innerlink" data-linktype="2"><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">《日志分析系列(二)：</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;"></span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">平台实现</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">篇》</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;"></span></a></section><section style="caret-color: rgb(51, 51, 51);white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483806&amp;idx=1&amp;sn=dbd9264bc3fece3bcaa92f18c2dd0bd4&amp;chksm=fc98155ecbef9c48529617523d1bdc2e85bc26ea24ef2b340f59218f0b9713357067a098ce33&amp;scene=21#wechat_redirect" textvalue="《日志分析系列(外传一)：Nginx透过代理获取真实客户端IP》" data-itemshowtype="0" tab="innerlink" data-linktype="2"><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">《日志分析系列(外传一)：</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">Nginx透过代理获取真实客户端IP</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">》</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;"></span></a></section><section style="caret-color: rgb(51, 51, 51);white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483868&amp;idx=1&amp;sn=c66ce6cf610faf3f10b5bf0011d5386d&amp;chksm=fc98151ccbef9c0aa7b2d3608330cc8091fc7a27a264d9a8ffb5baf827e22f870244654dae0c&amp;scene=21#wechat_redirect" textvalue="《日志分析系列(外传二)：Nginx日志统一化》" data-itemshowtype="0" tab="innerlink" data-linktype="2"><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">《日志分析系列(外传二)：</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">Nginx日志统一化</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">》</span></a></section><section style="caret-color: rgb(51, 51, 51);white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483870&amp;idx=1&amp;sn=d662fb5ed290f19d1dc9f650f59ef0ae&amp;chksm=fc98151ecbef9c08f6f1c34435f1549b4ec89b7e60b81ee6679de94283269b37eff48908a6f2&amp;scene=21#wechat_redirect" textvalue="《日志分析系列(外传三)：平台安全性》" data-itemshowtype="0" tab="innerlink" data-linktype="2"><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">《日志分析系列(外传三)：</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">平台安全性</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">》</span></a></section></section>



<p><a href="https://zhuanlan.zhihu.com/p/113403639">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=7a5ded46&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483899%26idx%3D1%26sn%3Dc8de3d1a0d74981bc7a78814056d67a5%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 16 Mar 2020 08:46:00 +0800</pubDate>
    </item>
    <item>
      <title>完成一次渗透测试项目</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483895&amp;idx=1&amp;sn=06be4f21fd7410af16c73d3ec15bd113</link>
      <description>小B接到一个渗透测试任务，由于很久没有从乙方视⻆执行渗透测试的他决定先梳理一下自己的思路。</description>
      <content:encoded><![CDATA[<p>
原创 <span>bloodzer0</span> <span>2020-03-02 08:45</span> <span style="display: inline-block;"></span>
</p>

<p>小B接到一个渗透测试任务，由于很久没有从乙方视⻆执行渗透测试的他决定先梳理一下自己的思路。</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=2e600bfb&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6mialOokUGo6kteF7GeglkHPibmLF5PGUUz9Fxo0CCmRFMj8ra1tUPgkIQOGF2SyZSyaBSzSMQEblqbqg%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section data-style-type="2" data-id="9100"><section powered-by="xiumi.us"><section><section><section powered-by="xiumi.us"><section><section><section powered-by="xiumi.us"><section><section><section powered-by="xiumi.us"><section><section><section data-style-type="5" data-id="2950900"><p><img data-ratio="0.45454545454545453" width="auto" data-type="gif" data-w="22" src="https://wechat2rss.xlab.app/img-proxy/?k=51b4f18d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_gif%2FrbP97vC6mialOokUGo6kteF7GeglkHPibmd0OuZYny2fs1cwwUgqcic8ndHAKVhLuIxxWuaqejXKnILdvzKmHRrng%2F640%3Fwx_fmt%3Dgif"/><span style="text-align: start;font-family: 微软雅黑, sans-serif;font-size: 15px;"> 背景：小B接到一个渗透测试任务，由于很久没有从乙方视</span><span style="font-size: 15px;"><span style="text-align: start;font-family: &#34;PingFang SC&#34;, sans-serif;">⻆</span><span style="text-align: start;font-family: 微软雅黑, sans-serif;">执行渗透测试的他决定先梳理一下自己的思路。</span></span></p></section><p><span style="font-size: 22px;"><strong><span style="font-size: 22px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">准备工作</span></strong></span><span style="font-size: 15px;"><strong><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);"></span></strong></span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><section data-style-type="2" data-tools="新媒体排版" data-id="9100" style="white-space: normal;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="display: inline-block;width: 578px;vertical-align: top;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-left: 25px;display: inline-block;width: 578px;vertical-align: top;border-width: 0px;border-radius: 0px;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-right: 10px;padding-left: 10px;display: inline-block;width: 553px;vertical-align: top;border-bottom-left-radius: 0px;box-sizing: border-box;border-left: 2px dashed rgb(61, 133, 198);"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="margin-bottom: 20px;box-sizing: border-box;"><section style="font-size: 14px;box-sizing: border-box;"><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="text-align: start;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">第一个是渗透测试用例：对于技术人员来讲这是一个比较好的知识点沉淀的方式，不但有助于你在每一次的渗透测试中不遗漏掉某个点，并且还可以在团队内部进行共享方便提升团队内部成员的技能。</span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><p style="white-space: normal;"><br/></p><section data-style-type="2" data-tools="新媒体排版" data-id="9100" style="white-space: normal;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="display: inline-block;width: 578px;vertical-align: top;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-left: 25px;display: inline-block;width: 578px;vertical-align: top;border-width: 0px;border-radius: 0px;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-right: 10px;padding-left: 10px;display: inline-block;width: 553px;vertical-align: top;border-bottom-left-radius: 0px;box-sizing: border-box;border-left: 2px dashed rgb(61, 133, 198);"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="margin-bottom: 20px;box-sizing: border-box;"><section style="font-size: 14px;box-sizing: border-box;"><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">第二个是工具箱：工欲善其事必先利其器，有一个好的工具箱决定我们在渗透测试时的效率。一个好的工具箱应该包括，不同操作系统(Win、Linux、macOS)；各种环境与基础工具(Java、Py2与Py3、Ruby、NodeJS、Go、数据库连接客户端、SSH连接客户端等等)；常用的工具(Nessus、AWVS、BurpSuite、SQLMap、各种小工具、CVE漏洞利用POC)；</span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><p style="white-space: normal;"><br/></p><section data-style-type="2" data-tools="新媒体排版" data-id="9100" style="white-space: normal;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="display: inline-block;width: 578px;vertical-align: top;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-left: 25px;display: inline-block;width: 578px;vertical-align: top;border-width: 0px;border-radius: 0px;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-right: 10px;padding-left: 10px;display: inline-block;width: 553px;vertical-align: top;border-bottom-left-radius: 0px;box-sizing: border-box;border-left: 2px dashed rgb(61, 133, 198);"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="margin-bottom: 20px;box-sizing: border-box;"><section style="font-size: 14px;box-sizing: border-box;"><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">做好准备工作是平时的积累，不要在每一次面对项目时再去做。</span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 22px;"><strong><span style="font-size: 22px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">前期沟通</span></strong></span><span style="font-size: 15px;"><strong><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);"></span></strong></span></p><section data-style-type="2" data-tools="新媒体排版" data-id="9100" style="white-space: normal;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="display: inline-block;width: 578px;vertical-align: top;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-left: 25px;display: inline-block;width: 578px;vertical-align: top;border-width: 0px;border-radius: 0px;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-right: 10px;padding-left: 10px;display: inline-block;width: 553px;vertical-align: top;border-bottom-left-radius: 0px;box-sizing: border-box;border-left: 2px dashed rgb(61, 133, 198);"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="margin-bottom: 20px;box-sizing: border-box;"><section style="font-size: 14px;box-sizing: border-box;"><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">对于乙方的渗透测试而言，在开始之前与客户沟通一些相关事宜是非常有必要的：</span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><p style="white-space: normal;"><br/></p><section data-style-type="2" data-tools="新媒体排版" data-id="9100" style="white-space: normal;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="display: inline-block;width: 578px;vertical-align: top;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-left: 25px;display: inline-block;width: 578px;vertical-align: top;border-width: 0px;border-radius: 0px;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-right: 10px;padding-left: 10px;display: inline-block;width: 553px;vertical-align: top;border-bottom-left-radius: 0px;box-sizing: border-box;border-left: 2px dashed rgb(61, 133, 198);"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="margin-bottom: 20px;box-sizing: border-box;"><section style="font-size: 14px;box-sizing: border-box;"><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">第一个是渗透测试目的：客户进行本次需求是为了什么？等保、日常安全巡检还是其他目的，不同的目的决定漏洞评判等级的不一样，也觉得测试过程中方法的不一样。</span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><p style="white-space: normal;"><br/></p><section data-style-type="2" data-tools="新媒体排版" data-id="9100" style="white-space: normal;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="display: inline-block;width: 578px;vertical-align: top;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-left: 25px;display: inline-block;width: 578px;vertical-align: top;border-width: 0px;border-radius: 0px;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-right: 10px;padding-left: 10px;display: inline-block;width: 553px;vertical-align: top;border-bottom-left-radius: 0px;box-sizing: border-box;border-left: 2px dashed rgb(61, 133, 198);"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="margin-bottom: 20px;box-sizing: border-box;"><section style="font-size: 14px;box-sizing: border-box;"><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="color: rgb(51, 51, 51);font-family: 微软雅黑, sans-serif;font-size: 15px;">第二个是渗透测试目标：</span><span style="color: rgb(51, 51, 51);font-family: 微软雅黑, sans-serif;font-size: 15px;">目标通常情况会分为主机和应用系统，这两类目标的渗透方法上是大致相同的。</span><span style="color: rgb(51, 51, 51);font-family: 微软雅黑, sans-serif;font-size: 15px;">做应用系统的渗透测试，我们需要判断应用系统后端的主机，往往在渗透应用系统无果的时候我们可以从主机层面出发突破，反之亦然。</span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><p style="white-space: normal;"><br/></p><section data-style-type="2" data-tools="新媒体排版" data-id="9100" style="white-space: normal;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="display: inline-block;width: 578px;vertical-align: top;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-left: 25px;display: inline-block;width: 578px;vertical-align: top;border-width: 0px;border-radius: 0px;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-right: 10px;padding-left: 10px;display: inline-block;width: 553px;vertical-align: top;border-bottom-left-radius: 0px;box-sizing: border-box;border-left: 2px dashed rgb(61, 133, 198);"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="margin-bottom: 20px;box-sizing: border-box;"><section style="font-size: 14px;box-sizing: border-box;"><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="color: rgb(51, 51, 51);font-family: 微软雅黑, sans-serif;font-size: 15px;">第三个是目标环境：</span><span style="color: rgb(51, 51, 51);font-family: 微软雅黑, sans-serif;font-size: 15px;">一般我们渗透测试会在两种环境中进行，一是生产，二是测试。</span><span style="color: rgb(51, 51, 51);font-family: 微软雅黑, sans-serif;font-size: 15px;">不同的环境对渗透测试的要求也不一样，假设是生产环境，我们需要避免对目标进行DoS拒绝服务、缓冲区溢出等可能导致服务中断或延缓服务响应的攻击；</span><span style="color: rgb(51, 51, 51);font-family: 微软雅黑, sans-serif;font-size: 15px;">其次生产环境的测试时间段需要选择在非业务高峰期；</span><span style="color: rgb(51, 51, 51);font-family: 微软雅黑, sans-serif;font-size: 15px;">还有就是生产环境我们做渗透测试的时候要避免向目标插入、删除或修改数据的动作。</span><br/></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;"><br/></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">在目标环境的不同上，做渗透测试还会面临一个问题就是如何接入目标环境中。一般对互联网开放的生产系统或主机我们可以直接通过Internet进行测试；但是如果客户的测试目标是内部的系统或主机，尤其是测试环境这时Internet都是不可以直接访问的，此时我们有几个选择一是进入客户现场执行渗透测试，二是VPN或者IP访问白名单的形式访问。记住一个点，如果是在家进行渗透测试建议买一个云主机提供一个公网IP，因为这个IP是固定的，家用的宽带一般都是动态IP，客户一般是不应该允许将这种类型的动态IP添加访问的。</span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><p><br/></p><section data-style-type="2" data-tools="新媒体排版" data-id="9100" style="white-space: normal;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="display: inline-block;width: 578px;vertical-align: top;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-left: 25px;display: inline-block;width: 578px;vertical-align: top;border-width: 0px;border-radius: 0px;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-right: 10px;padding-left: 10px;display: inline-block;width: 553px;vertical-align: top;border-bottom-left-radius: 0px;box-sizing: border-box;border-left: 2px dashed rgb(61, 133, 198);"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="margin-bottom: 20px;box-sizing: border-box;"><section style="font-size: 14px;box-sizing: border-box;"><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">第四个是执行时间：这一点在第三点中我也提到了，主要是需要与客户确认好特别是在生产环境执行。</span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><p style="white-space: normal;"><br/></p><section data-style-type="2" data-tools="新媒体排版" data-id="9100" style="white-space: normal;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="display: inline-block;width: 578px;vertical-align: top;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-left: 25px;display: inline-block;width: 578px;vertical-align: top;border-width: 0px;border-radius: 0px;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-right: 10px;padding-left: 10px;display: inline-block;width: 553px;vertical-align: top;border-bottom-left-radius: 0px;box-sizing: border-box;border-left: 2px dashed rgb(61, 133, 198);"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="margin-bottom: 20px;box-sizing: border-box;"><section style="font-size: 14px;box-sizing: border-box;"><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">第五个是</span><span style="font-size: 15px;color: rgb(51, 51, 51);">⻛</span><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">险规避方案：与客户一起协商做好</span><span style="font-size: 15px;color: rgb(51, 51, 51);">⻛</span><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">险规避方案，有助于我们在测试过程中应对各种紧急情况。执行系统备份与做好应急预案方便在出现突发情况时恢复系统；做好测试时间段内的安全监控，当出现异常时及时叫停；</span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><p style="white-space: normal;"><br/></p><section data-style-type="2" data-tools="新媒体排版" data-id="9100" style="white-space: normal;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="display: inline-block;width: 578px;vertical-align: top;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-left: 25px;display: inline-block;width: 578px;vertical-align: top;border-width: 0px;border-radius: 0px;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-right: 10px;padding-left: 10px;display: inline-block;width: 553px;vertical-align: top;border-bottom-left-radius: 0px;box-sizing: border-box;border-left: 2px dashed rgb(61, 133, 198);"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="margin-bottom: 20px;box-sizing: border-box;"><section style="font-size: 14px;box-sizing: border-box;"><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">沟通好以上的内容之后，就可以开始技术测试部分了。</span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 22px;"><strong><span style="font-size: 22px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">技术测试</span></strong></span><span style="font-size: 15px;"><strong><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);"></span></strong></span></p><section data-style-type="2" data-tools="新媒体排版" data-id="9100" style="white-space: normal;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="display: inline-block;width: 578px;vertical-align: top;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-left: 25px;display: inline-block;width: 578px;vertical-align: top;border-width: 0px;border-radius: 0px;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-right: 10px;padding-left: 10px;display: inline-block;width: 553px;vertical-align: top;border-bottom-left-radius: 0px;box-sizing: border-box;border-left: 2px dashed rgb(61, 133, 198);"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="margin-bottom: 20px;box-sizing: border-box;"><section style="font-size: 14px;box-sizing: border-box;"><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">技术测试这部分是老生常谈的话题了，其实当有了渗透测试用例以后你会发现技术测试这个部分就是：1.常规操作；2.外带&#34;猥琐&#34;思路的突发奇想；3.坚持不懈的精神。我们还是从流程上过一遍整个技术测试：</span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><p style="white-space: normal;"><br/></p><section data-style-type="2" data-tools="新媒体排版" data-id="9100" style="white-space: normal;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="display: inline-block;width: 578px;vertical-align: top;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-left: 25px;display: inline-block;width: 578px;vertical-align: top;border-width: 0px;border-radius: 0px;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-right: 10px;padding-left: 10px;display: inline-block;width: 553px;vertical-align: top;border-bottom-left-radius: 0px;box-sizing: border-box;border-left: 2px dashed rgb(61, 133, 198);"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="margin-bottom: 20px;box-sizing: border-box;"><section style="font-size: 14px;box-sizing: border-box;"><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="color: rgb(51, 51, 51);font-family: 微软雅黑, sans-serif;font-size: 15px;">第一步信息收集</span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="color: rgb(51, 51, 51);font-family: 微软雅黑, sans-serif;font-size: 15px;"><br/></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">记住做信息收集时需要从渗透测试目的出发。</span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;"><br/></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">子域名收集：需要注意的是否需要做此步骤，如果客户的目的只是做一个域名的安全测试，那么做子域名收集的意义不是很大，如果是要求对某个网站进行以某种目的为导向的渗透就需要做子域名收集了。子域名收集的方法偏向DNS漏洞、暴力破解、DNS解析查询等方式。对于部分的渗透来说通过旁站查询也是一种思路。</span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;"><br/></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">IP信息收集：C段与B段适用于目标传统IDC机房或自建私有云的情况，如果是云环境大家可以关注一下私钥或Token泄露的情况，在文末我放了一些关于云环境渗透的参考资料。</span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);"><br/></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">端口与服务信息：主要是通过相关工具进行扫描，nmap、masscan。敏感目录与路径：注意依赖于平日收集的字典与工具判断返回的方式；</span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;"><br/></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">Web容器与后端组件可以依赖一些浏览器插件(Wapplayzer)来识别，也可以通过扫描器识别；</span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);"><br/></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">CMS：这个比较重要，一般比较大的客户要么是自研发系统要么是成熟的CMS系统，我们收集这个信息方便我们查询已知漏洞从而进一步攻击；</span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);"><br/></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">其他信息：还有就是账号密码、Token、AK/SK信息、历史漏洞、历史漏洞中的敏感信息等信息，收集途径主要是搜索引擎与第三方平台(GitHub为主要渠道)。</span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;"><br/></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">在做信息收集比较重要的是平日里字典、工具库的收集，以及多变通做信息收集的方式，不要局限自己的思路。</span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><p style="white-space: normal;"><br/></p><section data-style-type="2" data-tools="新媒体排版" data-id="9100" style="white-space: normal;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="display: inline-block;width: 578px;vertical-align: top;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-left: 25px;display: inline-block;width: 578px;vertical-align: top;border-width: 0px;border-radius: 0px;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-right: 10px;padding-left: 10px;display: inline-block;width: 553px;vertical-align: top;border-bottom-left-radius: 0px;box-sizing: border-box;border-left: 2px dashed rgb(61, 133, 198);"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="margin-bottom: 20px;box-sizing: border-box;"><section style="font-size: 14px;box-sizing: border-box;"><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="color: rgb(51, 51, 51);font-family: 微软雅黑, sans-serif;font-size: 15px;">第二步漏洞利用</span><br/></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="color: rgb(51, 51, 51);font-family: 微软雅黑, sans-serif;font-size: 15px;"><br/></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">漏洞利用主要依赖于第一步信息收集的结果，一般会有四种结果：可直接利用，比如敏感文件信息泄露；可间接利用，后端组件或CMS版本处于已知漏洞的影响范围之内；未来可用，部分信息当前不能给出一些帮助，但是在后续的渗透过程中会提供帮助，比如某个内网的账号密码；无用信息。</span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;"><br/></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 15px;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">一般漏洞利用就是常</span><span style="color: rgb(51, 51, 51);">⻅</span><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">的漏洞，如SQL注入、XSS跨站；一些CVE漏洞，如：CVE-2017-10271；逻辑漏洞，如任意密码重置；</span></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 15px;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);"><br/></span></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">平日多积累，漏洞利用的时候就不会慌。</span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><p style="white-space: normal;"><br/></p><section data-style-type="2" data-tools="新媒体排版" data-id="9100" style="white-space: normal;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="display: inline-block;width: 578px;vertical-align: top;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-left: 25px;display: inline-block;width: 578px;vertical-align: top;border-width: 0px;border-radius: 0px;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-right: 10px;padding-left: 10px;display: inline-block;width: 553px;vertical-align: top;border-bottom-left-radius: 0px;box-sizing: border-box;border-left: 2px dashed rgb(61, 133, 198);"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="margin-bottom: 20px;box-sizing: border-box;"><section style="font-size: 14px;box-sizing: border-box;"><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">第三步后渗透：如果有需要做后渗透的话，一般包括：内网渗透，权限维持，权限提升，读取用户hash，浏览器密码等。关于这块小B也是菜鸡写不出来很有营养的东</span><span style="font-size: 15px;"><span style="color: rgb(51, 51, 51);">⻄</span><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">，也是小B正在学习的东</span><span style="color: rgb(51, 51, 51);">⻄</span><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">，大家可以多看看网上的资料。</span></span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><p style="white-space: normal;"><br/></p><section data-style-type="2" data-tools="新媒体排版" data-id="9100" style="white-space: normal;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="display: inline-block;width: 578px;vertical-align: top;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-left: 25px;display: inline-block;width: 578px;vertical-align: top;border-width: 0px;border-radius: 0px;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-right: 10px;padding-left: 10px;display: inline-block;width: 553px;vertical-align: top;border-bottom-left-radius: 0px;box-sizing: border-box;border-left: 2px dashed rgb(61, 133, 198);"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="margin-bottom: 20px;box-sizing: border-box;"><section style="font-size: 14px;box-sizing: border-box;"><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="color: rgb(51, 51, 51);font-family: 微软雅黑, sans-serif;font-size: 15px;">技术测试小结：</span><br/></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="color: rgb(51, 51, 51);font-family: 微软雅黑, sans-serif;font-size: 15px;"><br/></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">不要总盯着一个点不放，思路需要打开；</span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;"><br/></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);font-size: 15px;">不是每一次都能成功拿到权限或者找到高危等级的漏洞的：给一台只开放了443的独立主机让你入侵，直接攻击就算了吧!也许通过APT能实现呢~~~先对内部人员弄个钓</span><span style="font-size: 15px;"><span style="color: rgb(51, 51, 51);">⻥</span><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">，获取一个内网权限，再横向移动，找到可访问目标的网络段，再想办法从内部获取账号(纯属YY)</span></span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 22px;"><strong><span style="font-size: 22px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">报告输出</span></strong></span></p><section data-style-type="2" data-tools="新媒体排版" data-id="9100" style="white-space: normal;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="display: inline-block;width: 578px;vertical-align: top;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-left: 25px;display: inline-block;width: 578px;vertical-align: top;border-width: 0px;border-radius: 0px;box-sizing: border-box;"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="box-sizing: border-box;"><section style="padding-right: 10px;padding-left: 10px;display: inline-block;width: 553px;vertical-align: top;border-bottom-left-radius: 0px;box-sizing: border-box;border-left: 2px dashed rgb(61, 133, 198);"><section powered-by="xiumi.us" style="box-sizing: border-box;"><section style="margin-bottom: 20px;box-sizing: border-box;"><section style="font-size: 14px;box-sizing: border-box;"><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">一份渗透测试报告是客户评估此次渗透测试效果的东</span><span style="font-size: 15px;color: rgb(51, 51, 51);">⻄</span><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">，所以报告至关重要。要输出一份好的报告需要我们做到以下几个点：</span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);"><br/></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">1.与客户沟通报告的要求，不同客户对于报告的详细程度是不一致的，有些客户甚至会提供报告模板只要填入对应的内容；</span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);"><br/></span></p><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">2.对漏洞理解足够深入，需要描述清楚漏洞的概述、漏洞的</span><span style="font-size: 15px;color: rgb(51, 51, 51);">⻛</span><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">险、漏洞的危险等级(危险等级的计算方式)、漏洞的发现过程(图文结合的方式是最好的，同时要求我们在做渗透测试时养成良好的过程记录习惯)、漏洞的修复建议(不同客户对于漏洞的修复要求是不一致的，内外部系统的修复建议也应该是不一致的)。</span></p></section></section></section></section></section></section></section></section></section></section></section></section></section><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 22px;"><strong><span style="font-size: 22px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">refer</span></strong></span></p><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 15px;"><span style="font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">ATT&amp;CK针对云上环境入侵手法的总结:</span><span style="font-family: 微软雅黑, sans-serif;color: rgb(63, 130, 193);"><a href="https://attack.mitre.org/matrices/enterprise/cloud/" target="_blank">https://attack.mitre.org/matrices/enterprise/cloud/</a></span></span></p></li><li><p style="text-align: left;font-size: 14px;font-family: DengXian;color: rgb(0, 0, 0);white-space: normal;background: white;"><span style="font-size: 15px;"><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(51, 51, 51);">针对AWS入侵框架:</span><span style="font-size: 15px;font-family: 微软雅黑, sans-serif;color: rgb(63, 130, 193);"><a href="https://github.com/RhinoSecurityLabs/pacu" target="_blank">https://github.com/RhinoSecurityLabs/pacu</a></span></span></p></li></ul>



<p><a href="https://zhuanlan.zhihu.com/p/110141855">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=2cb0125f&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483895%26idx%3D1%26sn%3D06be4f21fd7410af16c73d3ec15bd113%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 02 Mar 2020 08:45:00 +0800</pubDate>
    </item>
    <item>
      <title>挖矿应急响应小结</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483890&amp;idx=1&amp;sn=904136c23baa60a8c818843b13bd5b7f</link>
      <description>总结一下遇到挖矿时应该如何做应急响应与溯源分析。</description>
      <content:encoded><![CDATA[<p>
原创 <span>bloodzer0</span> <span>2020-02-24 08:45</span> <span style="display: inline-block;"></span>
</p>

<p>总结一下遇到挖矿时应该如何做应急响应与溯源分析。</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=b35a37b8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6mialXuyKYCmMocHfibGroTqOErIfkYOWtQpaeO1sgPRgGiao2RYnhyIjbFN9tcwBN1YKhmR7k4pGUvsxw%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="display: none;" data-tools="新媒体管家" data-label="powered by xmt.cn"><br/></section></section><section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="letter-spacing: 0px;white-space: normal;padding: 10px;line-height: 1.6;word-break: break-word;overflow-wrap: break-word;text-align: left;"><section data-style-type="5" data-tools="新媒体排版" data-id="2950900" style="color: black;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;"><p style="padding-right: 0em;padding-left: 0em;max-width: 100%;min-height: 1em;text-align: center;"><img class="__bg_gif" data-ratio="0.45454545454545453" width="auto" data-type="gif" data-w="22" style="font-size: 10px;box-sizing: border-box !important;word-wrap: break-word !important;visibility: visible !important;width: auto !important;height: auto !important;" src="https://wechat2rss.xlab.app/img-proxy/?k=d1b13f02&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_gif%2FrbP97vC6mialXuyKYCmMocHfibGroTqOErt9ov0ASHz3Qr6cTvwJVQp4Cga6ic4x2xicbibgDV0NprmCjDbDXtONlLQ%2F640%3Fwx_fmt%3Dgif"/></p></section><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">背景：总结一下遇到挖矿时应该如何做应急响应与溯源分析。<br/></section><section data-style-type="1" data-tools="新媒体排版" data-id="12982" style="color: black;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;"><section style="border-width: 0px;border-style: none;border-color: initial;padding: 0px;margin-top: 20px;"><section style="margin-bottom: 5px;text-align: center;"><section style="margin-bottom: -5px;width: 100%;height: 1px;background-image: -webkit-linear-gradient(left, transparent, rgb(102, 102, 102), transparent);"><br/></section><section style="padding-right: 10px;padding-left: 10px;box-shadow: rgba(0, 0, 0, 0.498) 0px 2px 3px;display: inline-block;border-radius: 0px 0px 6px 6px;"><p style="color: rgb(121, 121, 121);min-width: 1em;font-size: 22px;">1.挖矿特征分析</p></section></section></section></section><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">当服务器或PC处于什么样的状态时，我们可以判定为被挖矿。通常来说，当我们的服务器或PC资源(CPU)使用率接近或超过100%，并持续高居不下导致服务器或PC操作延缓，我们就可以判定被挖矿。常见挖矿其它特征如下：</section><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">服务器或PC访问[过]不受信任的地址，这些地址包括：主机、IP、域名。这是由于大部分挖矿都需要从一个不受信任的地址下载初始化程序，而不受信任的来源主要是：第三方情报结构，企业内部历史数据沉淀。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">服务器或PC新增异常或恶意文件、进程或服务，并且大部分异常文件保存在服务器或PC的TMP目录中。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">服务器或PC的定时任务发生变更。</section></li></ul><section data-style-type="1" data-tools="新媒体排版" data-id="12982" style="color: black;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;"><section style="border-width: 0px;border-style: none;border-color: initial;padding: 0px;margin-top: 20px;"><section style="margin-bottom: 5px;text-align: center;"><section style="margin-bottom: -5px;width: 100%;height: 1px;background-image: -webkit-linear-gradient(left, transparent, rgb(102, 102, 102), transparent);"><br/></section><section style="padding-right: 10px;padding-left: 10px;box-shadow: rgba(0, 0, 0, 0.498039) 0px 2px 3px;display: inline-block;border-radius: 0px 0px 6px 6px;"><p style="color: rgb(121, 121, 121);min-width: 1em;font-size: 22px;">2.挖矿应急响应流程</p></section></section></section></section><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">PS：在整个处理挖矿的应急响应过程中，我们应该严格执行做好记录与备份工作。包括对分析过程中的命令、分析的文件都做好记录与备份。</section><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">这里的流程是一个最简化的流程，通常对于小B来说完整的流程包括：</section><figure data-tool="mdnice编辑器" style="color: black;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.41975308641975306" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="810" src="https://wechat2rss.xlab.app/img-proxy/?k=dd8803b0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialXuyKYCmMocHfibGroTqOErx14tmIuHIOH585tfX6QcpUgYuTPwoibmGdhPibhCufh8cgll1Y5me1dQ%2F640%3Fwx_fmt%3Dpng"/></figure><section style="margin-top: 20px;caret-color: rgb(51, 51, 51);white-space: normal;text-size-adjust: auto;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="padding-right: 10px;line-height: 25.6px;text-align: center;display: inline-block;height: 40px;background-image: url(&#34;https://mmbiz.qpic.cn/sz_mmbiz_png/rbP97vC6mialXuyKYCmMocHfibGroTqOErhQemU4TQGFiaJ60dnibP1tZ0sVhichDh4EicXtLnQcuavDZ8snTOibbTwmw/640&#34;);background-size: auto 40px;background-repeat: no-repeat;"><section style="margin-left: 12px;display: inline-block;line-height: 40px;vertical-align: top;font-weight: bold;"><p style="color: rgb(0, 0, 0);min-width: 1px;font-size: 16px;"><span style="font-size: 20px;">2.1 确认告警是否属于挖矿</span></p></section></section></section><section data-style-type="1" data-tools="新媒体排版" data-id="11919"><section style="border-width: 0px;border-style: none;border-color: initial;padding: 0px;"><section style="box-sizing: border-box;" powered-by="KolEditor.us"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><span style="letter-spacing: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;color: rgb(0, 0, 0);"></span></section><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><span style="letter-spacing: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;color: rgb(0, 0, 0);">通常我们都是通过告警的形式得知服务器或PC被挖矿。</span><span style="letter-spacing: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;color: rgb(0, 0, 0);">这个时候我们首先需要判断告警是否属于误报，如果不是误报那么需要确认告警是否真的属于恶意挖矿，如果不属于需要丢到其它的应急响应流程中，如果属于挖矿就需要进行后续的处理。</span><br/></section></section></section></section><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">下面是一些常见的确认挖矿方法：</section><h3 data-tool="mdnice编辑器" style="color: black;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 18px;color: rgb(51, 51, 51);">2.1.1 Windows确认挖矿</span></h3><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;"><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">使用图形化界面分析确认</section><p style="padding-top: 8px;padding-bottom: 8px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;line-height: normal;">a. 打开<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">任务管理器</code>：<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">Ctrl + Alt + Delete</code> 快捷键 或者 <code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">win + r</code> 快捷键，输入 <code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">taskmgr</code>；</p><p style="padding-top: 8px;padding-bottom: 8px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;line-height: normal;">b. 在<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">任务管理器</code>中找到<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">资源管理器</code>；</p><p style="padding-top: 8px;padding-bottom: 8px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;line-height: normal;">c. 通过<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">资源管理器</code>找到占用CPU资源较高的服务或进程，获取其PID信息；</p><p style="padding-top: 8px;padding-bottom: 8px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;line-height: normal;">d. 利用获取的PID信息在<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">任务管理器</code>中的<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">详细信息</code>一栏中找到对应的程序，右键<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">打开文件位置</code>，获取异常文件目录；</p><p style="padding-top: 8px;padding-bottom: 8px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;line-height: normal;">e. 进入到异常文件目录中，对文件进行分析，确认是否属于挖矿程序；</p></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;"><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">使用命令分析确认：打开终端或powershell：<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">win + r</code> 快捷键，输入 <code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">cmd</code></section></section></li></ul><pre data-tool="mdnice编辑器" style="color: black;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background-color: rgb(248, 248, 248);display: -webkit-box;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"># 获取所有进程详情并将结果输出到tmp.txt文件<br/>wmic process get caption,commandline /value &gt;&gt; tmp.txt<br/># 获取单一进程详情<br/>wmic process where caption=”svchost.exe” get caption,commandline /value<br/># 获取子进程的父进程信息<br/>wmic process where Name=&#34;svchost.exe&#34; get ParentProcessID<br/></section></pre><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">使用第三方工具分析确认：各有千秋，大家自己选择。</section></li><ul class="list-paddingleft-2" style="list-style-type: square;"><li><section><span style="font-size: 15px;">Process Monitor：</span><span style="font-size: 15px;">无需安装</span></section></li><li><section><span style="font-size: 15px;">Process Hacker：</span><span style="font-size: 15px;">无需安装</span></section></li><li><section><span style="font-size: 15px;">火绒剑：</span><span style="font-size: 15px;">需安装，界面展示更友好(个人意见)</span></section></li></ul></ul><h3 data-tool="mdnice编辑器" style="color: black;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 18px;color: rgb(51, 51, 51);">2.1.2 Linux确认挖矿</span></h3><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">a. 使用<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">top</code>命令查看系统性能，找出消耗资源较高的进程PID；</section><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">b. 根据获取的PID信息利用<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">ps -ef -p PID</code>命令找出系统进程详细信息；</section><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">c. 根据进程详细信息定位到文件位置，进入文件位置进行文件分析，确认是否属于挖矿程序。</section><pre data-tool="mdnice编辑器" style="color: black;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background-color: rgb(248, 248, 248);display: -webkit-box;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 除了top之外，还有很多比较好用的一些Linux命令</span><br/>uptime <span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 查看机器的负载情况</span><br/>vmstat 1 <span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 每秒输出一次系统核心指标</span><br/>mpstat -P ALL 1 <span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 每秒显示所有CPU的占用情况</span><br/>pidstat 1 <span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 每秒输出一次CPU的占用率</span><br/>iostat -xz 1 <span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 每秒输出一次磁盘IO</span><br/><span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 在使用ps时，需要注意一些ps的参数</span><br/></section></pre><section style="margin-top: 20px;caret-color: rgb(51, 51, 51);white-space: normal;text-size-adjust: auto;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="padding-right: 10px;line-height: 25.6px;text-align: center;display: inline-block;height: 40px;background-image: url(&#34;https://mmbiz.qpic.cn/sz_mmbiz_png/rbP97vC6mialXuyKYCmMocHfibGroTqOErhQemU4TQGFiaJ60dnibP1tZ0sVhichDh4EicXtLnQcuavDZ8snTOibbTwmw/640&#34;);background-size: auto 40px;background-repeat: no-repeat;"><section style="margin-left: 12px;display: inline-block;line-height: 40px;vertical-align: top;font-weight: bold;"><p style="color: rgb(0, 0, 0);min-width: 1px;font-size: 16px;"><span style="font-size: 20px;">2.2 确认挖矿后的清理工作</span></p></section></section></section><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">当我们通过2.1确认服务器或PC属于被挖矿后，我们需要执行清理工作。当然了关于不同应急响应人员在执行2.2与2.3这两步时顺序可能不太一样，在小B看来没什么区别，如果先分析再删除，更多是为了不破坏被攻击的环境方便溯源；但是如果我们在整个过程中做好完整的备份与记录，先删除再分析也OK。</section><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">下面是一些常见的清理挖矿方法：</section><h3 data-tool="mdnice编辑器" style="color: black;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 18px;color: rgb(51, 51, 51);">2.2.1 Windows清理挖矿</span></h3><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">在2.1.1小节确认挖矿程序后，先对挖矿程序进行备份。然后先关闭对应的服务与进程，再删除对应的定时任务，最后删除对应的文件。在删除文件之后，反向再查询一遍定时任务、进程与服务，最好是在间隔一定时间段后再复查一次。</section><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">在Windows中通常使用图形界面进行操作，所以就不废话了。</section><h3 data-tool="mdnice编辑器" style="color: black;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 18px;color: rgb(51, 51, 51);">2.2.2 Linux清理挖矿</span></h3><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">Linux中在确认挖矿以后，也同样需要备份挖矿程序，再执行响应的操作。</section><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">停止服务：<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">systemctl stop *.service</code>；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">杀掉进程：<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">kill 9 PID</code>，很多时候不光杀掉一个进程；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">删除文件：<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">rm -fr abnormal_file</code>，删除文件时可以使用<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">find / -name abnormal_file</code>查找出系统中所有的恶意文件；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">清理定时任务：<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">crontab -e</code>；</section></li></ul><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">与Windows相同的是在删除完成后我们需要反向操作一次与间隔一定时间后再复查一次是否清理干净。</section><section style="margin-top: 20px;caret-color: rgb(51, 51, 51);white-space: normal;text-size-adjust: auto;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="padding-right: 10px;line-height: 25.6px;text-align: center;display: inline-block;height: 40px;background-image: url(&#34;https://mmbiz.qpic.cn/sz_mmbiz_png/rbP97vC6mialXuyKYCmMocHfibGroTqOErhQemU4TQGFiaJ60dnibP1tZ0sVhichDh4EicXtLnQcuavDZ8snTOibbTwmw/640&#34;);background-size: auto 40px;background-repeat: no-repeat;"><section style="margin-left: 12px;display: inline-block;line-height: 40px;vertical-align: top;font-weight: bold;"><p style="color: rgb(0, 0, 0);min-width: 1px;font-size: 16px;"><span style="font-size: 20px;">2.3 为什么会被挖矿（溯源）？</span></p></section></section></section><h3 data-tool="mdnice编辑器" style="color: black;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 18px;color: rgb(51, 51, 51);">2.3.1 用户分析</span></h3><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">主要分析用户的新增、修改(用户属性的修改)、删除、登录，以及两类用户：特权用户和可登录用户。</section><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Linux：分析用户除了使用命令之外，还可以使用系统日志和安全设备日志进行分析。</section></li></ul><pre data-tool="mdnice编辑器" style="color: black;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background-color: rgb(248, 248, 248);display: -webkit-box;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">cat /etc/passwd <span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 查看用户信息</span><br/>awk -F <span style="color: rgb(221, 17, 68);line-height: 26px;">&#34;:&#34;</span> <span style="color: rgb(221, 17, 68);line-height: 26px;">&#39;{ if($3==0)print $1 }&#39;</span> /etc/passwd <span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 查看特权账户</span><br/>awk -F <span style="color: rgb(221, 17, 68);line-height: 26px;">&#34;:&#34;</span> <span style="color: rgb(221, 17, 68);line-height: 26px;">&#39;{ print $1,$7 }&#39;</span> /etc/passwd | grep -E <span style="color: rgb(221, 17, 68);line-height: 26px;">&#34;/bin/bash*&#34;</span> <span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 查看可登陆用户</span><br/><span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 除此之外Linux还有很多查看用户登录信息的命令</span><br/>lastlog<br/>users<br/>w <span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># w -s</span><br/>who <span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># who | cut -d&#39; &#39; -f1 | sort | uniq</span><br/>whoami<br/></section></pre><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Windows：分析用户可以使用图形化界面：<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">控制面板</code> --&gt; <code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">用户账户</code>，也可以通过命令行进行分析，对于Windows要分析历史登录用户信息需要从系统事件日志或安全设备日志着手，我这边没有发现有效的命令，大家知道可以私我。</section></li></ul><pre data-tool="mdnice编辑器" style="color: black;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background-color: rgb(248, 248, 248);display: -webkit-box;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">net user # 查看用户，值得注意的是，如果攻击者添加一个类似username$的用户，使用net user命令查看不到<br/>net localgroup administrators # 查看属于管理员组用户，使用此命令可以看到类似username$的用户<br/>query user # 查询当前登录用户<br/></section></pre><h3 data-tool="mdnice编辑器" style="color: black;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 18px;color: rgb(51, 51, 51);">2.3.2 端口与网络连接分析</span></h3><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">在分析端口与网络连接时有2个点需要注意，一是系统开放给互联网的端口并不一定真实开放了，需要考虑是否有防火墙等因素的存在，如果有我们还需要分析防火墙的规则；二是攻击者可能不一定是通过被挖矿服务器攻入，也可能是通过局域网内部其他机器侵入。</section><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Linux：分析端口与网络连接可以使用命令，还可以使用第三方工具tcpdump与网络流量监控设备等。</section></li></ul><pre data-tool="mdnice编辑器" style="color: black;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background-color: rgb(248, 248, 248);display: -webkit-box;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">netstat -tulnp <span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 查看系统的udp与tcp连接</span><br/></section></pre><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Windows：分析端口与网络连接可以使用命令，也可以使用第三方工具windump、wireshark等。</section></li></ul><pre data-tool="mdnice编辑器" style="color: black;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background-color: rgb(248, 248, 248);display: -webkit-box;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">netstat -ano | find &#34;ACK&#34;<br/>netstat -ano -p tcp | findstr &#34;LISTENING&#34;<br/></section></pre><h3 data-tool="mdnice编辑器" style="color: black;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 18px;color: rgb(51, 51, 51);">2.3.3 定时任务分析</span></h3><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">分析定时任务需要注意不同目录、不同用户下的定时任务。</section><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Linux</section></li></ul><pre data-tool="mdnice编辑器" style="color: black;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background-color: rgb(248, 248, 248);display: -webkit-box;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 查看crontab目录中所有文件</span><br/>cat /etc/cron.*/*<br/>cat /etc/crontab<br/><span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 查看不同用户的定时任务</span><br/>crontab -u username -l<br/><span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 通过定时任务日志进行分析</span><br/>cat /var/<span style="color: rgb(0, 134, 179);line-height: 26px;">log</span>/cron*<br/></section></pre><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Windows：对于Windows中的定时任务，一般有两种形态：一是图形化界面<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">管理工具</code> --&gt; <code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">任务计划程序</code>(PS：2008之后<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">任务计划程序</code>不在<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">控制面板</code>中了，而是在<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">管理工具</code>中) ；二是BAT文件。前者打开即可查看，后者需要找到对应的文件进行查看。</section></li></ul><h3 data-tool="mdnice编辑器" style="color: black;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 18px;color: rgb(51, 51, 51);">2.3.4 启动项分析</span></h3><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Linux</section></li></ul><pre data-tool="mdnice编辑器" style="color: black;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background-color: rgb(248, 248, 248);display: -webkit-box;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 查看所有已启动服务</span><br/>systemctl list-units --<span style="color: rgb(0, 134, 179);line-height: 26px;">type</span>=service<br/><span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;"># 查看服务启动项</span><br/>systemctl list-unit-files | grep enabled<br/></section></pre><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Windows：对于Windows的启动项有两种形式分析</section></li><ul style="list-style-type: square;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;"><span style="font-size: 15px;">win + r</span></code><span style="font-size: 15px;">，输入</span><code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;"><span style="font-size: 15px;">shell:startup</span></code><span style="font-size: 15px;"> 查看。</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">注册表启动项：</span><span style="font-size: 15px;">：</span><code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;"><span style="font-size: 15px;">win + r</span></code><span style="font-size: 15px;">，输入</span><code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;"><span style="font-size: 15px;">regedit</span></code><span style="font-size: 15px;">，找到</span><code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;"><span style="font-size: 15px;">HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run</span></code><span style="font-size: 15px;">查看</span></section></li></ul></ul><h3 data-tool="mdnice编辑器" style="color: black;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 18px;color: rgb(51, 51, 51);">2.3.5 历史命令分析</span></h3><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">历史命令分析一般只可以在Linux上进行分析，并且要保证历史执行命令以日志形式存储到统一日志分析平台中，否则历史命令容易被攻击者清除，并且如果攻击者未登陆服务器(以webshell的形式)执行命令也记录不到攻击者执行的命令。</section><h3 data-tool="mdnice编辑器" style="color: black;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 18px;color: rgb(51, 51, 51);">2.3.6 日志分析</span></h3><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">溯源很多程度依赖日志分析，不论是 Windows Server 或者是 Linux Server ，我们都需要从日志中提取攻击者的攻击路径，是通过暴力破解服务还是通过应用层服务进入都可以从日志中找到痕迹，这里不做太多的叙述，大家有兴趣可以读一下公众号heysec的日志分析系列，关于分析的文章后续会陆续放出。</section><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">特定说一下的是Linux下的日志可以通过 <code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">awk</code>、<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">grep</code>、<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">sed</code> 等命令直接进行分析，在文末的Refer中我有引入一些比较好的文章大家可以查看；对于Windows查看事件日志可以在图形化界面直接查看 <code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">win + r</code>，输入<code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">eventvwr</code> 或者 <code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">控制面板</code> --&gt; <code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">系统和安全</code> --&gt; <code style="word-wrap: break-word;padding: 2px 4px;border-top-left-radius: 4px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;border-bottom-left-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.0470588);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">查看事件日志</code> 。</section><h3 data-tool="mdnice编辑器" style="color: black;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 18px;color: rgb(51, 51, 51);">2.3.7 病毒木马等分析</span></h3><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;"><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Webshell：可以使用免费的一些工具对系统网站目录进行排查与分析。</section></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;"><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Linux：相对Windows来说，Linux的病毒木马较少，主要是分析是否有rootkit，可以使用chkrootkit与rkhunter检查后门或rootkit信息。</section></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;"><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Windows：Windows有很多的恶意病毒查杀软件，包括上文中提到的火绒也可以进行分析。</section></section></li></ul><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">分析方法还可以查找系统特定目录最近一段时间被修改或访问过的文件。</section><h3 data-tool="mdnice编辑器" style="color: black;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 18px;color: rgb(51, 51, 51);">2.3.8 通过挖矿程序分析</span></h3><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">在找到挖矿程序之后，首先我们可以分析挖矿程序在服务器或PC做的操作，这有助于帮助我们清理挖矿程序；其次我们还可以得到几个基本信息，利用这些信息我们也可以对其进行溯源。大部分的挖矿程序都是脚本文件可以直接使用文本编辑器进行分析，仅有少部分的挖矿程序需要用到类似WinHex等专业的文本工具。</section><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">挖矿程序运行用户，比如运用Confluence用户运行挖矿程序，很可能意味着我们服务器上的Confluence被攻陷了。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">挖矿程序自身特征：名称、矿池或钱包地址。</section></li></ul><figure data-tool="mdnice编辑器" style="color: black;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.5514950166112956" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="2408" src="https://wechat2rss.xlab.app/img-proxy/?k=919f4c19&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialXuyKYCmMocHfibGroTqOErjic2BvGPB9rqSCvxPYjoIFicLrSZuQ6MQcbRa0CEPYv3gu28qI2Rgiafg%2F640%3Fwx_fmt%3Dpng"/></figure><h3 data-tool="mdnice编辑器" style="color: black;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 18px;color: rgb(51, 51, 51);">2.3.9 模拟攻击</span></h3><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">通过模拟攻击者入侵的方式，对目标进行以获取权限的多维度渗透，一般耗时比较久不到万不得已一般不推荐使用。主要包括：端口扫描、暴力破解、GetWebShell、RCE、未授权访问等主流的获取权限方式。</section><h3 data-tool="mdnice编辑器" style="color: black;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 18px;color: rgb(51, 51, 51);">2.3.10 其他信息</span></h3><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">服务器或PC补丁安装信息；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">服务器或PC运行服务版本信息；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">…………</section></li></ul><section style="margin-top: 20px;caret-color: rgb(51, 51, 51);white-space: normal;text-size-adjust: auto;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="padding-right: 10px;line-height: 25.6px;text-align: center;display: inline-block;height: 40px;background-image: url(&#34;https://mmbiz.qpic.cn/sz_mmbiz_png/rbP97vC6mialXuyKYCmMocHfibGroTqOErhQemU4TQGFiaJ60dnibP1tZ0sVhichDh4EicXtLnQcuavDZ8snTOibbTwmw/640&#34;);background-size: auto 40px;background-repeat: no-repeat;"><section style="margin-left: 12px;display: inline-block;line-height: 40px;vertical-align: top;font-weight: bold;"><p style="color: rgb(0, 0, 0);min-width: 1px;font-size: 16px;"><span style="font-size: 20px;">2.4 对被攻陷目标进行安全加固</span></p></section></section></section><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">其实做加固，大部分情况都是如下三种：</section><ol data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">打补丁或升级版本：</span><span style="font-size: 15px;">不论是系统、应用程序、服务组件等都应该使用不含有已知高危漏洞的版本；</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">关端口或者通过防火墙做访问控制策略；</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">购买安全防护产品：</span><span style="font-size: 15px;">IDS、IPS、Firewalls等；</span></section></li></ol><section style="margin-top: 20px;caret-color: rgb(51, 51, 51);white-space: normal;text-size-adjust: auto;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="padding-right: 10px;line-height: 25.6px;text-align: center;display: inline-block;height: 40px;background-image: url(&#34;https://mmbiz.qpic.cn/sz_mmbiz_png/rbP97vC6mialXuyKYCmMocHfibGroTqOErhQemU4TQGFiaJ60dnibP1tZ0sVhichDh4EicXtLnQcuavDZ8snTOibbTwmw/640&#34;);background-size: auto 40px;background-repeat: no-repeat;"><section style="margin-left: 12px;display: inline-block;line-height: 40px;vertical-align: top;font-weight: bold;"><p style="color: rgb(0, 0, 0);min-width: 1px;font-size: 16px;"><span style="font-size: 20px;">2.5 举一反三内部排查</span></p></section></section></section><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">当我们完成了以上所有步骤后，我们还有件事情待做，这也是很多应急响应程序中忽视的一步，就是通过当前的整个过程去排查内部服务器或PC是否还有被挖矿的情况。也许没有被挖矿的情况但服务器或PC存在被攻击的可能性也是我们需要去排查的。</section><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">做完这一步，整个挖矿的应急响应流程也就基本结束了，写好报告进行汇报就是最后的收尾工作了！</section><section data-style-type="1" data-tools="新媒体排版" data-id="12982" style="color: black;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;"><section style="border-width: 0px;border-style: none;border-color: initial;padding: 0px;margin-top: 20px;"><section style="margin-bottom: 5px;text-align: center;"><section style="margin-bottom: -5px;width: 100%;height: 1px;background-image: -webkit-linear-gradient(left, transparent, rgb(102, 102, 102), transparent);"><br/></section><section style="padding-right: 10px;padding-left: 10px;box-shadow: rgba(0, 0, 0, 0.498039) 0px 2px 3px;display: inline-block;border-radius: 0px 0px 6px 6px;"><p style="color: rgb(121, 121, 121);min-width: 1em;font-size: 14px;"><span style="font-size: 22px;">3.常见的挖矿附链接</span></p></section></section></section></section><section style="color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;">一般挖矿的攻击者是不会去找一些复杂的入侵手段的，目前市面上比较多的挖矿都是未授权访问和RCE漏洞，所以大家平时在对内部服务器或PC进行扫描或者测试的时候需要额外注意这类型的漏洞，以及在分析的时候也可以多向这个思路靠近。</section></section><section data-style-type="5" data-tools="新媒体排版" data-id="2950898"><section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="font-size: 16px;color: black;padding: 10px;line-height: 1.6;letter-spacing: 0px;word-break: break-word;overflow-wrap: break-word;text-align: left;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;"><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><p style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">confluence 挖矿木马应急响应：<a href="https://www.w3xue.com/exp/article/20199/53730.html" target="_blank">https://www.w3xue.com/exp/article/20199/53730.html</a></p></li><li><p style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a href="https://github.com/Bypass007/Emergency-Response-Notes" target="_blank">https://github.com/Bypass007/Emergency-Response-Notes</a></p></li><li><p style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a href="https://mp.weixin.qq.com/s?__biz=MzU3ODAyMjg4OQ==&amp;mid=2247483906&amp;idx=1&amp;sn=929d368159a46de8a10b673883a0bd70&amp;scene=21#wechat_redirect" style="overflow-wrap: break-word;border-bottom: 1px solid rgb(243, 156, 19);color: rgb(243, 156, 19);" data-linktype="2">Hadoop Yarn REST API未授权漏洞利用挖矿分析</a></p></li><li><p style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a href="https://mp.weixin.qq.com/s?__biz=MzU3ODAyMjg4OQ==&amp;mid=2247483874&amp;idx=1&amp;sn=06baad6c0a11a3ee2c3e5bba13fd69c2&amp;scene=21#wechat_redirect" style="overflow-wrap: break-word;border-bottom: 1px solid rgb(243, 156, 19);color: rgb(243, 156, 19);" data-linktype="2">Linux Redis自动化挖矿感染蠕虫分析及安全建议</a></p></li><li><p style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a href="https://mp.weixin.qq.com/s?__biz=MzU3ODAyMjg4OQ==&amp;mid=2247484556&amp;idx=1&amp;sn=b626b05727ae929ac03f2115ad2665fe&amp;scene=21#wechat_redirect" style="overflow-wrap: break-word;border-bottom: 1px solid rgb(243, 156, 19);color: rgb(243, 156, 19);" data-linktype="2">Linux watchdogs 感染性隐藏挖矿病毒入侵还原录</a></p></li><li><p style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Linux 遭入侵，挖矿进程被隐藏案例分析：<a href="https://paper.seebug.org/629/" target="_blank">https://paper.seebug.org/629/</a></p></li><li><p style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">记一次失败的挖矿病毒应急响应：<a href="https://m09ic.top/posts/35826/" target="_blank">https://m09ic.top/posts/35826/</a></p></li><li><p style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">无文件挖矿应急响应处置报告：<a href="https://www.freebuf.com/articles/system/206611.html" target="_blank">https://www.freebuf.com/articles/system/206611.html</a></p></li><li><p style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">一次入侵应急响应分析：<a href="https://www.freebuf.com/articles/network/186071.html" target="_blank">https://www.freebuf.com/articles/network/186071.html</a></p></li><li><p style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a href="https://mp.weixin.qq.com/s?__biz=MzU3ODAyMjg4OQ==&amp;mid=2247484173&amp;idx=1&amp;sn=47df9fb555a2037d072903f4b2fc8438&amp;scene=21#wechat_redirect" style="overflow-wrap: break-word;border-bottom: 1px solid rgb(243, 156, 19);color: rgb(243, 156, 19);" data-linktype="2">一起攻击者利用 Redis 未授权访问漏洞进行新型入侵挖矿事件</a></p></li><li><p style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">应急响应系列之OA被入侵挖矿分析报告：<a href="https://www.freebuf.com/articles/network/205387.html" target="_blank">https://www.freebuf.com/articles/network/205387.html</a></p></li><li><p style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">应急响应系列之无文件攻击分析：<a href="https://www.freebuf.com/articles/network/216918.html" target="_blank">https://www.freebuf.com/articles/network/216918.html</a></p></li></ul></section><section data-style-type="5" data-tools="新媒体排版" data-id="2950898"><p style="min-height: 1em;color: rgb(62, 62, 62);font-size: 16px;text-align: center;white-space: normal;max-width: 100% !important;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="font-size: 14px;"></span></p><p style="text-align: center;"><img class="__bg_gif" data-copyright="0" data-ratio="0.6666666666666666" style="width: auto !important;height: auto !important;visibility: visible !important;" data-type="gif" data-w="30" src="https://wechat2rss.xlab.app/img-proxy/?k=e2f06c43&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_gif%2FrbP97vC6mialXuyKYCmMocHfibGroTqOEr523p34LfdHtC90ibRBC9jcrDBul2m041fEUHicjia5d4UxBXSR9TvsBRw%2F640%3Fwx_fmt%3Dgif"/></p></section></section>



<p><a href="https://zhuanlan.zhihu.com/p/108688360">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=4aef51e7&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483890%26idx%3D1%26sn%3D904136c23baa60a8c818843b13bd5b7f%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 24 Feb 2020 08:45:00 +0800</pubDate>
    </item>
    <item>
      <title>分享一个漏洞的发现到利用的过程</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483881&amp;idx=1&amp;sn=1002320620a54b3d944c11e804ccf105</link>
      <description>本文将分享一个RocketMQ的漏洞从发现到自动化利用的实践过程，最后也将安利一个开源的神器Arthas(阿尔萨斯)。本文技术含金量不高，但也希望读者能从中有所收获。</description>
      <content:encoded><![CDATA[<p>
原创 <span>CF_HB</span> <span>2020-02-17 08:15</span> <span style="display: inline-block;"></span>
</p>

<p>本文将分享一个RocketMQ的漏洞从发现到自动化利用的实践过程，最后也将安利一个开源的神器Arthas(阿尔萨斯)。本文技术含金量不高，但也希望读者能从中有所收获。</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=85bddc6a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzcc7GxO8t51uYLibJgt6uJcUYD1FbdD09nZbsDd3vGgocLtzUnEva40c8Q%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="display: none;" data-tools="新媒体管家" data-label="powered by xmt.cn"><br/></section></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">哈喽，EveryOne。本文将分享一个RocketMQ的漏洞从发现到自动化利用的实践过程，最后也将安利一个开源的神器Arthas(阿尔萨斯)。本文技术含金量不高，但也希望读者能从中有所收获。</section><section data-style-type="1" data-tools="新媒体排版" data-id="11792" style="white-space: normal;"><section style="border-width: 0px;border-style: none;border-color: initial;"><section powered-by="KolEditor.us" style="box-sizing: border-box;"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><section style="width: 578px;border-bottom: 5px solid rgb(1, 135, 207);box-sizing: border-box;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="margin-bottom: -5px;padding-right: 5px;padding-left: 5px;display: inline-block;vertical-align: bottom;border-bottom: 5px solid rgb(169, 211, 214);min-width: 1em;text-align: center;box-sizing: border-box;"><section style="box-sizing: border-box;color: rgb(0, 0, 0);font-size: 20px;">一、介绍一下RocketMQ</section></section></section></section></section></section></section><p><img data-ratio="0.5251509054325956" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="497" src="https://wechat2rss.xlab.app/img-proxy/?k=5264ac5e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzcckwQtu4A7ef8gsHS0DW8P0v4Wvubt3ribcxC8b63cHjd1kHxLrwPtbQw%2F640%3Fwx_fmt%3Dpng"/></p><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><br/></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">RocketMQ是阿里贡献给apache的开源项目，地址在：<a href="https://github.com/apache/rocketmq，它是一种纯Java语言开发的消息中间件。也是国内首个非Hadoop生态体系的顶级项目，被国内外数百家企业广泛使用。具有：" target="_blank">https://github.com/apache/rocketmq，它是一种纯Java语言开发的消息中间件。也是国内首个非Hadoop生态体系的顶级项目，被国内外数百家企业广泛使用。具有：</a><strong style="color: rgb(68, 68, 68);">高性能、低延迟、高可靠</strong> 的特点。</section><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">1.1 架构简图</span></h3><p><img data-ratio="0.5768518518518518" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=ac77dc5b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzcc5X4loTuOa20WCF6sKf7TsfvMEdzfqxCVX9vCEdYga5Ih6BNJhVqdWA%2F640%3Fwx_fmt%3Dpng"/></p><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">RocketMQ的服务端由Name Server 和 Broker组成。消费者/生产者在使用RocketMQ做消息调度时，必须要指定Topic。Broker在整个RocketMQ中又担当着消息中枢的功能，Topic的创建和更新消息通过Broker转发到namesrv。</section><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">1.2 如何运行RocketMQ</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">我们从官方下载rocketmq-all-4.6.1.zip 解压后打开到bin目录：</section><p><img data-ratio="1.4560975609756097" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="410" src="https://wechat2rss.xlab.app/img-proxy/?k=aa01be5a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccGWwkUKxNkfB02ibTZChbic4fuQN6qDpV9h7v6GUe31jqiaWeaSfnAa7VQ%2F640%3Fwx_fmt%3Dpng"/></p><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: black;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 16px;letter-spacing: 0px;text-align: left;">同时配置环境变量如下：</span></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.43471074380165287" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="605" src="https://wechat2rss.xlab.app/img-proxy/?k=536308d3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzcc7TvxsJ0sgIia9r9zgRmHpwDTQgKibicPopAUwXBlogq1OGGDUE7u9NEFw%2F640%3Fwx_fmt%3Dpng"/></figure><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">1.3 可视化管理界面：rocketmq-console</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">可以下载这个工具的jar包，然后用下面的命令，就可以很方便的管理RocketMQ了。【TIPS：RocketMQ 9876端口未授权访问，可以用这个工具很方便的利用哟。】</section><pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background-color: rgb(248, 248, 248);display: -webkit-box;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">java -Xmx512m -Xms512m -jar rocketmq-console-ng-1.0.0.jar --server.port=8081<br/>--rocketmq.config.namesrvAddr=&#34;10.13.32.203:9876&#34; --auth.username=admin --auth.password=admin<br/></section></pre><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.25" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=ce3d5cec&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccsXA8vqqUuWbs32dr32pQRCvWREzIGzItTwO3hXoKh1avCTRGwQtvhQ%2F640%3Fwx_fmt%3Dpng"/></figure><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">1.4 消息存储</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">RocketMQ的消息存储是由consume queue和commit log配合完成的。consume queue是消息的逻辑队列，相当于字典的目录，用来指定消息在物理文件commit log上的位置。当创建一个话题（Topic）时会创建一个独立的存储文件夹，官方定义是：</section><pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background-color: rgb(248, 248, 248);display: -webkit-box;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">${rocketmq.home}/store/consumequeue/${topicName}/${queueId}/${fileName}<br/></section></pre><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">例如下面的：</section><p><img data-ratio="0.325" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=35d382e3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccUXXxMOCuOIYeY2KJfcewdZzFdic7POtHSTuTKFlXypNicLpAgnuaUukA%2F640%3Fwx_fmt%3Dpng"/></p><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">生产者在使用RocketMQ进行创建消息时，必须要指定topic，对于topic的设置有一个开关autoCreateTopicEnable，一般在开发测试环境中会使用autoCreateTopicEnable = true（默认为true），官方建议在生产环境里需要手动设置autoCreateTopicEnable = false</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">当开启autoCreateTopicEnable后，我们的每一个topic在RocketMQ的服务端上都会创建一个独立的文件夹来存储 consume queue。</section><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">1.5 构造一个生产者</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">我们构造一个生产者来实践如下，具体的细节就不细说了。如下：</section><p><img data-ratio="0.6696658097686375" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="778" src="https://wechat2rss.xlab.app/img-proxy/?k=35529b4b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzcceey4FUgBWZkKGUqBYh4UTE0SMQ6KQovNsc1ORDghK9zs5FESKoxxcg%2F640%3Fwx_fmt%3Dpng"/></p><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">在Windows上我们看到存储消息的文件夹创建成功了，并且文件初始大小约为5.72M如下：</section><p><img data-ratio="0.8835978835978836" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="567" src="https://wechat2rss.xlab.app/img-proxy/?k=de76fb4f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccnGv0IllAwxF2bcP5UXFBMoxOicoFk7mK7W24Huy9bKwBfiavs8w7G3SQ%2F640%3Fwx_fmt%3Dpng"/></p><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">这个创建的路径为固定的：当前用户目录\store\consumequeue 这是所有消息存储的文件路径，更多关于这块的介绍可以看文档：</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">消息存储设计</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">(<a href="https://github.com/apache/rocketmq/blob/971fa8ed8b209b39bdfe41c57cd64576d244e6bd/docs/en/Design_Store.md)" target="_blank">https://github.com/apache/rocketmq/blob/971fa8ed8b209b39bdfe41c57cd64576d244e6bd/docs/en/Design_Store.md)</a></section><section data-style-type="1" data-tools="新媒体排版" data-id="11792"><section style="border-width: 0px;border-style: none;border-color: initial;padding: 0px;"><section style="box-sizing: border-box;" powered-by="KolEditor.us"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><section style="width: 100%;border-bottom: 5px solid rgb(1, 135, 207);box-sizing: border-box;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="display: inline-block;vertical-align: bottom;margin-bottom: -5px;border-bottom: 5px solid rgb(169, 211, 214);min-width: 1em;text-align: center;padding: 0px 5px;box-sizing: border-box;"><section style="box-sizing: border-box;color: rgb(0, 0, 0);font-size: 20px;">二、猜测与攻击</section></section></section></section></section></section></section><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">2.1 像黑客一样思考</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">黑客大多都是脑洞大开的，既然topic由生产者创建消息时指定的，哪么创建文件时会不会有<strong style="color: rgb(68, 68, 68);">漏洞</strong>呢？如果创建文件夹的参数为 <code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.047);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">../../../fuzz2019</code> ，即topic参数传值为<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.047);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">../../../fuzz2019</code>，哪么服务端会发生什么呢？？</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">构造Topic为 <code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.047);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">../../../demo</code> 试一试，发现结果如下：</section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.49444444444444446" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=fbac3b26&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccfaJhSZ3fkwOrZotoYkrnkSlUQ5ibVYeYwsuryg5IMOI7XkJqbfhwUxg%2F640%3Fwx_fmt%3Dpng"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong style="color: rgb(68, 68, 68);">红色提示</strong></section><pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background-color: rgb(248, 248, 248);display: -webkit-box;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">The specified topic[../../../fuzz2019] contains illegal characters, allowing only ^[%|a-zA-Z0-9_-]+$<br/></section></pre><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">看来是对topic的格式有要求，根据提示找到 过滤类 org.apache.rocketmq.client.Validators</section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.372507869884575" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="jpeg" data-w="953" src="https://wechat2rss.xlab.app/img-proxy/?k=86c5b5ca&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccn4oIKAwdXZKVEaYeDlRKhKzwBscOWvbv8ddVAPuibzzDjnL944k1ibIQ%2F640%3Fwx_fmt%3Djpeg"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">错误信息提示了在86行这里的有对消息的topic做本地检查 <code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.047);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">Validators.checkTopic(msg.getTopic());</code></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">这里是被本地创建消息时被检查格式不合法给拒绝了，如果RocketMQ服务端没有做这个Topic的格式检查，信任了客户端的Topic，直接使用传入的Topic值进行了文件夹创建。这就可能存在漏洞，使用 ../ 可以目录穿越到其他任意目录。</section><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">2.2 想办法进行POC验证</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">为了验证上面的想法，于是需要客户端构造恶意的Topic值如：../../../fuzz2019</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">这里下面我想到有三种方式实现我们的目的：</section><ol data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">使用IDE工具调试功能，通过下断点动态修改内存中Topic值。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">下载源码修改检查逻辑后，编译新的rocketmq-client包导入使用。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">使用JAVA Agent技术，运行时修改对象的值。</section></li></ol><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">为了快速验证猜想，就通过在Eclipse上调试，动态修改内存中对象的topic的值为恶意的poc。</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">首先传一个正常的topic值，如：fuzz2019,当执行流程通过 Validators.checkTopic(msg.getTopic())的格式检查后，下断点，在IDE里直接修改msg对象的topic值为恶意的如：../../../../fuzz2019</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">如下所示</section><p><img data-ratio="0.470532319391635" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="jpeg" data-w="1052" src="https://wechat2rss.xlab.app/img-proxy/?k=48e5eab3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccFE7wOwQHc9sLlXtxuCWFgicytI4GPccuyPko7nSWln44r19tbJjnqCw%2F640%3Fwx_fmt%3Djpeg"/></p><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">在Eclipse里，右键-Change Value</span></section><p><img data-ratio="0.5847665847665847" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="jpeg" data-w="407" src="https://wechat2rss.xlab.app/img-proxy/?k=bb631f74&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccyxGicnjEQC6zjfr33QzvfxcjZkhIwXfaicRiagGrdf58tvpyjsVYycbYA%2F640%3Fwx_fmt%3Djpeg"/></p><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">填入 payload</section><p><img data-ratio="0.5585365853658537" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="jpeg" data-w="820" src="https://wechat2rss.xlab.app/img-proxy/?k=a674e031&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccP514xgCjsicvueRyRQmRvWPgGGMVOaC3CLreVCO7nzlnbNXnAQJ0dnA%2F640%3Fwx_fmt%3Djpeg"/></p><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">然后快速的放行，等待程序执行完成如下。</section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.19614711033274956" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="jpeg" data-w="571" src="https://wechat2rss.xlab.app/img-proxy/?k=28fab28f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccTTT0ACxiasYlYkOpwVYeNJSp6rBoP8KvCToEjKUSAAIkpQuPslfEfZQ%2F640%3Fwx_fmt%3Djpeg"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">可以看到在C盘的根目录下成功创建一个名叫 fuzz2019的文件夹</section><p><img data-ratio="0.32465543644716693" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="jpeg" data-w="653" src="https://wechat2rss.xlab.app/img-proxy/?k=bed77ed9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccZFAvic6ooicBtjxARphMNrr42IO1jhmdcoU1VFJbtKRluQ4DH4BpY7QA%2F640%3Fwx_fmt%3Djpeg"/></p><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">或者穿越到其他目录下创建</span></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.25384615384615383" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="jpeg" data-w="520" src="https://wechat2rss.xlab.app/img-proxy/?k=4244b858&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccKoa9vSAR55gCdwJRG36RVp7USOKuJ8XuQ4iaP6ic8TImYySy9pIyY5zg%2F640%3Fwx_fmt%3Djpeg"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">至此，一个简单的构想，POC验证已经完成，证明RocketMQ服务端，未做topic的格式合法检查，仅在rocketmq-client端生产者请求时做了特殊字符判断，该漏洞存在～～</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">试着分析了一下产生的原因在于broker的处理类中：</section><pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background-color: rgb(248, 248, 248);display: -webkit-box;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java<br/></section></pre><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">这个文件的165行的msgCheck函数里，在对rocketmq-client发过来的消息检查时，如果topic不存在就会通过TopicConfigManager类调用createTopicInSendMessageMethod方法，将请求头里获取的topic直接用于创建topic.</section><p><img data-ratio="0.1425925925925926" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=14d35881&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccI9YZIiayNAFPtNm0iaQhWmlfFq3UQJPlU8w0A4mw0CLgplicfgrP1fB8g%2F640%3Fwx_fmt%3Djpeg"/></p><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;">TopicConfigManager类文件为 /broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java</span></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">这里我做了一些其他测试，结论：</section><ol data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">不能覆盖已存在的文件夹，因为服务端检查会认为已经存在该文件夹，然后直接存放在其下面。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">不能控制生成任意的文件和文件内容</section></li></ol><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">到此关于这个漏洞的发现过程，产生原因已经描述清楚。哪么这个漏洞还能有什么更大的利用空间吗？？我能想到的就是 <strong style="color: rgb(68, 68, 68);">利用目录穿越到系统敏感目录，fuzz创建带有特殊字符的文件夹，使系统core dump或某些服务的crash</strong></section><section data-style-type="1" data-tools="新媒体排版" data-id="11792"><section style="border-width: 0px;border-style: none;border-color: initial;padding: 0px;"><section style="box-sizing: border-box;" powered-by="KolEditor.us"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><section style="width: 100%;border-bottom: 5px solid rgb(1, 135, 207);box-sizing: border-box;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="display: inline-block;vertical-align: bottom;margin-bottom: -5px;border-bottom: 5px solid rgb(169, 211, 214);min-width: 1em;text-align: center;font-size: 19.2px;padding: 0px 5px;box-sizing: border-box;"><section style="box-sizing: border-box;"><span style="font-size: 20px;">三、如何更进一步利用</span></section></section></section></section></section></section></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">虽然这个漏洞不及反序列化导致RCE那样的严重危害，但是这个如果被恶意利用也是有一定安全隐患的。从官方设计文档 存储设计文档(<a href="https://github.com/apache/rocketmq/blob/master/docs/cn/design.md)" target="_blank">https://github.com/apache/rocketmq/blob/master/docs/cn/design.md)</a> 中关于存储架构中1.1节中的描述：</section><pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background-color: rgb(248, 248, 248);display: -webkit-box;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">具体存储路径为：$HOME/store/consumequeue/{topic}/{queueId}/{fileName}。同样consumequeue文件采取定长设计，每一个条目共20个字节，分别为8字节的commitlog物理偏移量、4字节的消息长度、8字节tag hashcode，单个文件由30W个条目组成，可以像数组一样随机访问每一个条目，每个ConsumeQueue文件大小约5.72M<br/></section></pre><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">攻击者每发送一次网络请求，都可以在任意指定的目录下创建5.72M大小的文件夹。这个放大的比例应该是非常大了吧：<strong style="color: rgb(68, 68, 68);">1次请求换来消耗目标5.72M磁盘空间</strong> 这个是不是可以用作于放大攻击呢？？攻击者可以写出EXP向服务器任意目录进行喷射，短时间内可以在任意目录下创建大量垃圾文件，消耗尽磁盘存储空间。</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">为了方便自动化攻击或方便前面提到的Fuzz，需要更好的方式解决传入../../这样的特殊符号。</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">下面将介绍第二种的方式： <strong style="color: rgb(68, 68, 68);">RASP中使用的JAVA Agent技术之 agentmain(热部署)。</strong> agentmain是JDK6后引入的新的特性，agentmain 可以在类加载之后再次加载一个类，也就是重定义。更多的介绍可以看：</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">agentmain(<a href="https://www.jianshu.com/p/6096bfe19e41)" target="_blank">https://www.jianshu.com/p/6096bfe19e41)</a></section><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">3.1 编写用于Hook 替换的目标Class</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">关于agentmain的原理就不介绍了，直接上手使用吧。经过debug,我知道关键的校验点在Validators类里的checkMessage函数，这里我直接注释掉所有的检查，只打印 当前传入的topic值。</section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.4444444444444444" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=4d93effe&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzcc7UFUrSY15vt3xBHg3aicIyGNwTnUZjnUB69hrjjJSmCNsZnmzDSw0HA%2F640%3Fwx_fmt%3Djpeg"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">编写好以后，保存，然后你就准备好了用于替换目标Class的字节码文件啦。。地址在这里： <code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.047);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">/Users/CFHB/DevTools/rocketmq-master/client/target/classes/org/apache/rocketmq/client/Validators.class</code></section><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">3.2 编写agent代理</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">后面用到的代码都来自GitHub的Demo JavaHotSwap(<a href="https://github.com/Jason112788/JavaHotSwap/)，" target="_blank">https://github.com/Jason112788/JavaHotSwap/)，</a> 感谢GitHub上的无数无私的网友们，不然一天从入门到上手真的难。</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">拿到JavaAgent的Demo后，需要做的就是重写agentmain函数里的内部transform函数,这个的作用就是前面说的利用JDK提供的API，重定义已经加载的类。我这里需要这样做：</section><pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background-color: rgb(248, 248, 248);display: -webkit-box;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: rgb(153, 153, 153);font-weight: bold;line-height: 26px;">@Override</span><br/><span style="font-weight: bold;line-height: 26px;">public</span> <span style="font-weight: bold;line-height: 26px;">byte</span>[] transform(ClassLoader loader, String className, Class&lt;?&gt; classBeingRedefined, ProtectionDomain protectionDomain, <span style="font-weight: bold;line-height: 26px;">byte</span>[] classfileBuffer) <span style="font-weight: bold;line-height: 26px;">throws</span> IllegalClassFormatException {<br/>    System.out.println(<span style="color: rgb(221, 17, 68);line-height: 26px;">&#34;[transform] hotswap class name :&#34;</span> + className);<br/>    <span style="font-weight: bold;line-height: 26px;">if</span> (<span style="color: rgb(221, 17, 68);line-height: 26px;">&#34;org/apache/rocketmq/client/Validators&#34;</span>.equalsIgnoreCase(className)){ <span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;">//如果是目标类，则进行替换。</span><br/>        <span style="font-weight: bold;line-height: 26px;">byte</span>[] bytes = fileToBytes(<span style="font-weight: bold;line-height: 26px;">new</span> File(<span style="color: rgb(221, 17, 68);line-height: 26px;">&#34;/Users/CFHB/DevTools/rocketmq-master/client/target/classes/org/apache/rocketmq/client/Validators.class&#34;</span>));<br/>        <span style="font-weight: bold;line-height: 26px;">return</span> bytes;<br/>    }<span style="font-weight: bold;line-height: 26px;">else</span>{<br/>        <span style="font-weight: bold;line-height: 26px;">return</span> <span style="font-weight: bold;line-height: 26px;">null</span>; <span style="color: rgb(153, 153, 136);font-style: italic;line-height: 26px;">// 返回null,表示不修改</span><br/>    }<br/></section></pre><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">简单理解，transform 是进行替换的，返回null则不做替换，返回字节数组，则进行替换。上面判断如果是目标类：</section><pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background-color: rgb(248, 248, 248);display: -webkit-box;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">org/apache/rocketmq/client/Validators<br/></section></pre><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">就会进行替换，如果你要问为什么是/这样的？你先不替换，只打印出来className，看看格式就知道了。</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">至此，JavaAgent编写已完成，maven 命令打包一下吧。</section><pre data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background-color: rgb(248, 248, 248);display: -webkit-box;border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">maven clean<br/>maven package<br/>maven install<br/></section></pre><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.725" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=a31c7c0f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzcc0rgfDNCF9dWzjyKuuyia5fPhZWOVgFFk3wnugsPCRma7lGa4Ze3HdXg%2F640%3Fwx_fmt%3Djpeg"/></figure><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">3.3 编写测试热更新代码</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">也就是这里的JavaHotSwap，这里就是给JVM加载agentmain.jar，传递目标类做参数：<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.047);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">org.apache.rocketmq.client.Validators</code></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.25092592592592594" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=82b336c0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccoD8ooPSrkpeU9fFpq7F4gVkI6CvWPQyvqIfOk4EnvN7WBPsbxsahRQ%2F640%3Fwx_fmt%3Djpeg"/></figure><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">3.4 编写RocketMQ的生产者，发送payload</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">上面的工作是利用热更新，动态改掉了rocket-client包里的检查逻辑，现在需要做的就是构造../../这样的请求啦。这里循环100次，每次sleep 2秒，代码如下：</section><p><img data-ratio="0.7722222222222223" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=ed736e31&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzcc231K0EM1Ih6qyGfNibZBxt3zkhlDJmNP6iaRib9K9ibicd5llPnXGtosdibg%2F640%3Fwx_fmt%3Djpeg"/></p><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">至此，所有的东西已经准备好了，</section><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">3.5 测试效果</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong style="color: rgb(68, 68, 68);">直接攻击，被检查拦截</strong></section><p><img data-ratio="0.5509259259259259" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=90650aa8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccZ6tlba99n5JvaMrx9GC0TYJGmr53qGSFrgialSvibyOHt8Y8OzIA68iaQ%2F640%3Fwx_fmt%3Djpeg"/></p><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong style="color: rgb(68, 68, 68);">加载热更新，改掉检查逻辑</strong></section><p><img data-ratio="0.4305555555555556" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=4f276998&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccgDaKlwMuCBRsibkdiaNJz5OcRiaD41GK806CzaJHYic5ymvTSIE1fQicjAw%2F640%3Fwx_fmt%3Djpeg"/></p><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong style="color: rgb(68, 68, 68);">攻击成功效果：</strong></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.9953703703703703" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=2040577f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccQTCVtYJaXZhlCXicZE0vBiaNUXzR3PEQGiaPAGRWwWJP1siclpBoRTh8vw%2F640%3Fwx_fmt%3Djpeg"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">ubuntu下被攻击后：</section><p><img data-ratio="1.5238095238095237" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="jpeg" data-w="924" src="https://wechat2rss.xlab.app/img-proxy/?k=285528c1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzcc9SD8icJb738qFDl37JibaQ2ItSFAIibCNN9N3stsvdJWAnSjIp503Hrdw%2F640%3Fwx_fmt%3Djpeg"/></p><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">至此，介绍完毕利用JAVA Agent技术帮助Fuzz攻击的演示。</section><section data-style-type="1" data-tools="新媒体排版" data-id="11792"><section style="border-width: 0px;border-style: none;border-color: initial;padding: 0px;"><section style="box-sizing: border-box;" powered-by="KolEditor.us"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><section style="width: 100%;border-bottom: 5px solid rgb(1, 135, 207);box-sizing: border-box;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="display: inline-block;vertical-align: bottom;margin-bottom: -5px;border-bottom: 5px solid rgb(169, 211, 214);min-width: 1em;text-align: center;font-size: 19.2px;padding: 0px 5px;box-sizing: border-box;"><section style="box-sizing: border-box;"><span style="font-size: 20px;">四、关于修复</span></section></section></section></section></section></section></section><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">4.1 官方发布4.6.1修复</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">RocketMQ在最新发布的4.6.1版本中已经完成了该漏洞的修复。在文件<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.047);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java</code>中将rocketmq-client客户端的检查逻辑，同样添加在了服务端。</section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.47635524798154555" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="867" src="https://wechat2rss.xlab.app/img-proxy/?k=7016966f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzcc2wzRIicCMTP1Q0AOK3DJMsReB6wibSVOib5mMvhFOFiag5YS1RcNKPmYicg%2F640%3Fwx_fmt%3Dpng"/></figure><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.28425925925925927" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=c501d7a6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccO7HRP29jDSTyCbGaMeSLeuewJ7zyAk3WicBHrnFQDHOvhJbqpUiaclgg%2F640%3Fwx_fmt%3Dpng"/></figure><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">4.2 安全实践</span></h3><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">推荐使用最新版本，RocketMQ 4.6.1（已修复）</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">rocketmq-client使用4.6.0以上版本（fastjson已升级到1.2.61）</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">禁止使用ROOT权限启用RocketMQ服务端和消费端</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">禁止自动创建topic，必须将autoCreateTopicEnableRocketMQ设置为false. <code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.047);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">修改Broker配置文件，broker.properties，添加一项autoCreateTopicEnable=false.</code></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">配置ACL，开启用户身份认证。修改RocketMQ的默认端口9876为不常用端口，防止被扫描发现。</section></li></ul><section data-style-type="1" data-tools="新媒体排版" data-id="11792"><section style="border-width: 0px;border-style: none;border-color: initial;padding: 0px;"><section style="box-sizing: border-box;" powered-by="KolEditor.us"><section style="margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;"><section style="width: 100%;border-bottom: 5px solid rgb(1, 135, 207);box-sizing: border-box;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="display: inline-block;vertical-align: bottom;margin-bottom: -5px;border-bottom: 5px solid rgb(169, 211, 214);min-width: 1em;text-align: center;font-size: 19.2px;padding: 0px 5px;box-sizing: border-box;"><section style="box-sizing: border-box;"><span style="font-size: 20px;color:#000;">五、安利神器（Arthas）</span></section></section></section></section></section></section></section><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">5.1 GitHub地址：</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Arthas(<a href="https://github.com/alibaba/arthas/blob/master/README_CN.md)" target="_blank">https://github.com/alibaba/arthas/blob/master/README_CN.md)</a></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Arthas 是Alibaba开源的Java诊断工具，深受开发者喜爱。</section><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">5.2 Arthas可以做什么？</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong style="color: rgb(68, 68, 68);">当你遇到以下类似问题而束手无策时，Arthas可以帮助你解决：</strong></section><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">这个类从哪个 jar 包加载的？为什么会报各种类相关的 Exception？</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">我改的代码为什么没有执行到？难道是我没 commit？分支搞错了？</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">遇到问题无法在线上 debug，难道只能通过加日志再重新发布吗？</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">线上遇到某个用户的数据处理有问题，但线上同样无法 debug，线下无法重现！</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">是否有一个全局视角来查看系统的运行状况？</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">有什么办法可以监控到JVM的实时运行状态？</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">怎么快速定位应用的热点，生成火焰图？</section></li></ul><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong style="color: rgb(68, 68, 68);">总结一句话：查看任意方法调用情况，传入参数，返回值，反编译源码，热更新等等。</strong></section><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">5.3 怎么使用</span></h3><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">启动命令： <code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.047);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">java -jar arthas-boot.jar</code></section></li></ul><p><img data-ratio="0.5388888888888889" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=f8e1d807&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccd1vgedanz2g5u6v4XEMrJ9z7fSulgelqowJRKN0hbuycl4tFST5dWQ%2F640%3Fwx_fmt%3Dpng"/></p><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">输入help，查看支持哪些命令。下面介绍几个关键的命令：sc、watch、</section><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">sc 命令</section><p><img data-ratio="0.22407407407407406" style="display: block;margin-right: auto;margin-left: auto;width: 739px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=19f1e52c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccdmQZWrPnmRKJ02oia3xwc0COWLxkptDtyHHiah0icfx7931hfjoR2ibajA%2F640%3Fwx_fmt%3Dpng"/></p></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">watch命令</section><p><img data-ratio="0.4462962962962963" style="display: block;margin-right: auto;margin-left: auto;width: 739px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=e08c4890&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccovKVnkonxiav0FVvq8Ol2kR6O44UmprUiaMHXPJlN4EaoTSaapzY8IOQ%2F640%3Fwx_fmt%3Dpng"/></p></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">sm命令</section><p><img data-ratio="0.6287037037037037" style="display: block;margin-right: auto;margin-left: auto;width: 739px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=2b7790e5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccqO7fna7lUEPgVv1YM1ntBjqhMeIyZJQSw7rocd1dPxDlqtp5v3eISw%2F640%3Fwx_fmt%3Dpng"/></p></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">jad命令</section><p><img data-ratio="0.5055555555555555" style="display: block;margin-right: auto;margin-left: auto;width: 739px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=e060a817&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccGC2g2aHP7n3rek8EhFQbgXJlm8M09dVZoWicWroMK0mdAibh7XzQd01A%2F640%3Fwx_fmt%3Dpng"/></p></li></ul><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">5.4 热更新-实例：bypass Rocketmq-client限制</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">我们以修改上面漏洞的Rocketmq-client客户端Topic合法检查为例子，哪么需要下面几步，命令如下：</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong style="color: rgb(68, 68, 68);">使用的命令如下：</strong></section><ol data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">java -jar arthas-boot.jar --telnet-port 9996 --http-port -1</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">jad --source-only org.apache.rocketmq.client.Validators &gt; /tmp/Validators.java</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">vim /tmp/Validators.java, 注释掉check处代码</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">sc -d *Validators | grep classLoaderHash</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">mc -c 2a139a55 /tmp/Validators.java -d /tmp</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">redefine /tmp/org/apache/rocketmq/client/Validators.class</section></li></ol><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">效果如下：</section><p><img data-ratio="0.2537037037037037" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=ee31b65c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzcckARnO7ugticQ13nwRdibAt1luoQkHoKGR54BZ94ibm2B3OZbQmlJuh51A%2F640%3Fwx_fmt%3Dpng"/></p><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.44537037037037036" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=9cf9bb31&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccdCsHXTskPCheiaossxIpO5kQfSAOswRtUkBa5ics9epLEnYthDK8qoOQ%2F640%3Fwx_fmt%3Dpng"/></figure><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">5.5 辅助发现SQL注入漏洞</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">这里以某套大数据分析工具的漏洞为例子，漏洞如下：</section><p><img data-ratio="0.6157407407407407" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=7199e064&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccbdG1ufPPuvvAx64BTMMYs78MDr3uxFbX8YqW2r6DA0WONFp0PHqrpg%2F640%3Fwx_fmt%3Dpng"/></p><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">找到漏洞存在的本质：<strong style="color: rgb(68, 68, 68);">错误的使用预编译方法，将SQL语句拼接了传入prepareStatement函数。</strong></section><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">类：java.sql.PreparedStatement 函数：prepareStatement 参数sql</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">类：java.sql.Statement 函数：executeQuery 参数 sql</section></li></ul><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">对比一下正确和错误的用法如下：</section><p><img data-ratio="0.2111111111111111" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=0e3e3065&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccYgb5rQYB5at1Shf3hy5anQRMiaMy6dUnAjJsm19fzlqqwMRuPlOzKLQ%2F640%3Fwx_fmt%3Dpng"/></p><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.3648148148148148" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=180c8118&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccaMZcc6SaCzlYz8xzHGkgKich00DbiajJr6ia2kTvicQ4KtUIWgX1OESXcQ%2F640%3Fwx_fmt%3Dpng"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">所以，我们使用watch命令关注prepareStatement函数，如果直接把我们的参数拼接进了SQL语句并传入了这个函数，哪么一定是存在SQL注入漏洞的。watch命令如下： <code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.047);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">watch java.sql.Connection prepareStatement &#34;params[0]&#34; -n 888888</code></section><p><img data-ratio="0.43703703703703706" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=fcbfdf81&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzcc9yF6ibc36Fl9UYWw0UkdRP14GWRoaxZSpRD0szPL337z5xSia5icDceyg%2F640%3Fwx_fmt%3Dpng"/></p><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: rgb(51, 51, 51);">5.6 取证冰蝎</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">甚至可以用于webshell的取证哟，比如冰蝎工具的。 <code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.047);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">options unsafe true</code></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.45740740740740743" style="display: block;margin-right: auto;margin-left: auto;width: 764px;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=22668ec7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzccog63RcJ2yoSrCCZQZcIQOibGn2xsuMjqakqPLqjFXnothYBIvITndPw%2F640%3Fwx_fmt%3Dpng"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">其他更多的玩法，更多的技巧，可以看使用文档：<a href="https://alibaba.github.io/arthas/index.html" target="_blank">https://alibaba.github.io/arthas/index.html</a></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">也欢迎大家去发现更多的玩法，然后和我交流带带我。</section><section data-style-type="2" data-tools="新媒体排版" data-id="9772"><blockquote style="white-space: normal;margin: 5px 0px 0px;padding: 10px;max-width: 100%;border-left-width: 5px;border-left-style: solid;border-left-color: rgb(157, 180, 194);line-height: 25px;color: rgb(102, 102, 102);"><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">参考文章：</section><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">1. <a href="https://alibaba.github.io/arthas/index.html" target="_blank">https://alibaba.github.io/arthas/index.html</a></section><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">2. 认识 JavaAgent  </section><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">    <a href="https://paper.seebug.org/1099/" target="_blank">https://paper.seebug.org/1099/</a></section><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">3. 探秘 Java 热部署三 (agentmain) </section><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">    <a href="https://www.jianshu.com/p/6096bfe19e41" target="_blank">https://www.jianshu.com/p/6096bfe19e41</a></section></blockquote>				<section style="border: 0px none;padding: 0px;color: rgb(169, 211, 214);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><br/></section></section><section data-style-type="2" data-tools="新媒体排版" data-id="8733"><section style="text-align: center;line-height: 8px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><br/></section><section data-style-type="7" data-tools="新媒体排版" data-id="1688"><section data-style-type="7" data-tools="新媒体排版" data-id="1687"><section style="padding: 0px;margin: 0px;text-align: center;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><img data-ratio="0.03333333333333333" title="1431316510672092293.gif" data-type="gif" data-w="600" style="" src="https://wechat2rss.xlab.app/img-proxy/?k=c2fa70d2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_gif%2FrbP97vC6miak1W3PgOlZAm4IzVTcuHzcc7zwMZLRR0oYfzTaj1zNf7FxTa7icl87BT1VlLicBcIgqhQFKdbzPWmMA%2F640%3Fwx_fmt%3Dgif"/></section></section><section data-style-type="2" data-tools="新媒体排版" data-id="8633"><section style="box-sizing: border-box;" powered-by="xiumi.us"><section style="margin: 30px 0% 0px;box-sizing: border-box;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="display: inline-block;width: 100%;vertical-align: top;border-style: solid;border-width: 1px;border-radius: 0px;padding: 10px;box-sizing: border-box;border-color:rgb(204, 204, 204);"><section style="box-sizing: border-box;" powered-by="xiumi.us"><section style="transform: translate3d(0px, 0px, 0px);-webkit-transform: translate3d(0px, 0px, 0px);-moz-transform: translate3d(0px, 0px, 0px);-o-transform: translate3d(0px, 0px, 0px);margin: -30px 0% 0px;box-sizing: border-box;"><section style="font-size: 24px;box-sizing: border-box;color:rgb(169, 211, 213);"><p style="margin: 0px;padding: 0px;box-sizing: border-box;"><span style="background-color: rgb(254, 255, 255);box-sizing: border-box;"><em style="box-sizing: border-box;"><strong style="box-sizing: border-box;"> </strong></em></span><span style="background-color: rgb(254, 255, 255);box-sizing: border-box;font-size: 18px;color: rgb(140, 165, 180);"><strong style="box-sizing: border-box;">插播一则小广告</strong></span></p></section></section></section><p style="color: rgb(62, 62, 62);font-size: 14px;white-space: normal;"><strong style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">base：</strong><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">成都 or  深圳</span><br/></p><p style="color: rgb(62, 62, 62);font-size: 14px;white-space: normal;"><strong>招聘：</strong>安全攻防、安全研究</p><p style="color: rgb(62, 62, 62);font-size: 14px;white-space: normal;"><strong style="color: rgb(62, 62, 62);font-size: 14px;white-space: normal;">WeChatID：</strong><span style="color: rgb(62, 62, 62);font-size: 14px;">lc10516</span></p></section></section></section></section></section></section>



<p><a href="https://zhuanlan.zhihu.com/p/107290230">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=3bc44814&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483881%26idx%3D1%26sn%3D1002320620a54b3d944c11e804ccf105%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 17 Feb 2020 08:15:00 +0800</pubDate>
    </item>
    <item>
      <title>日志分析系列(外传三):平台安全性</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483870&amp;idx=1&amp;sn=d662fb5ed290f19d1dc9f650f59ef0ae</link>
      <description>本系列故事纯属虚构，如有雷同纯属巧合小B在实现了统一日志分析平台后，想到的第一个问题就是平台的安全性，用于安</description>
      <content:encoded><![CDATA[<p>
原创 <span>bloodzer0</span> <span>2020-01-13 08:00</span> <span style="display: inline-block;"></span>
</p>

<p>本系列故事纯属虚构，如有雷同纯属巧合小B在实现了统一日志分析平台后，想到的第一个问题就是平台的安全性，用于安</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=10232078&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miam3gxp3NYKg8FN0ogeKMJtthpibD6sDgSYyfkyVqyZq6WZbiaQiaACVnI0WRTqvVC4JFnPE7pPA57FNg%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section style="caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;"><p style="text-align: center;line-height: normal;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="caret-color: rgb(240, 84, 84);color: rgb(240, 84, 84);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 15px;">本系列故事纯属虚构，如有雷同纯属巧合</span><br/></p></section><p style="caret-color: rgb(51, 51, 51);white-space: normal;text-size-adjust: auto;text-align: center;line-height: normal;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><img data-ratio="0.05555555555555555" data-w="180" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=58a39579&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMdiaNr0OwpmzM4NhqDiaQCfAXn29rSVjqibNP5g9NFiabNR83tdz2F8qEyLQ%2F640%3Fwx_fmt%3Dpng"/></p><p style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="letter-spacing: 0px;">小B在实现了统一日志分析平台后，想到的第一个问题就是平台的安全性，用于安全分析的平台被攻击成功，那么小B将颜面扫地还可能被扫地出门。</span><span style="letter-spacing: 0px;">所以小B认证分析了平台可能存在的安全风险：</span><br/></p><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><p style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">平台产品自身的安全漏洞(解决方案：及时安装补丁或升级版本)；</p></li><li><p style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">数据泄露：在采集存储使用等过程中造成的数据泄露问题(解决方案：加密)；</p></li><li><p style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">未授权访问：平台无任何访问控制措施导致未授权访问(解决方案：见后文)；</p></li></ul><p style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">对于平台的安全性，小B觉得首要的是使用没有已知漏洞的产品版本，其次就是添加访问控制。对于小B的日志分析平台，其中有这么几个地方需要额外注意：ES与Kibana的安全性、Kafka的安全性。</p><section data-width="100%" data-opacity="1" data-rotate="0" style="margin-right: auto;margin-left: auto;caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;border-width: 0px;border-style: none;border-color: initial;width: 574px;opacity: 1;transform: rotateZ(0deg);"><section style="width: 574px;text-align: center;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="margin-top: 10px;display: inline-block;width: auto;"><section style="display: -webkit-flex;justify-content: center;"><section style="font-size: 16px;margin-top: 8px;margin-right: -30px;width: 45px;"><section style="width: 58px;"><img data-w="70" title="" data-ratio="0.5714285714285714" src="https://wechat2rss.xlab.app/img-proxy/?k=36a6308f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarsp6wbKDYd4qxib2QHqtT18Nic5AmjBMzOcjy8bRauPMsLXiaBuBO1GqlHHg%2F640"/></section></section><section style="padding-right: 16px;padding-left: 16px;line-height: 22px;letter-spacing: 2px;"><p style="color: rgb(63, 62, 63);min-width: 1px;"><span style="font-size: 22px;">通用访问控制实现</span></p></section><section style="font-size: 16px;margin-top: -11px;margin-left: -30px;width: 35px;"><section style="width: 30px;"><img style="width: 30px;display: block;vertical-align: top;" data-ratio="0.625" data-w="40" src="https://wechat2rss.xlab.app/img-proxy/?k=99a3bd6d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspeahQl4dC745C0AQblUiaZWq1tVYWXxoEbgtzn7BskoD56sWSiczWsOdQ%2F640"/></section></section></section></section></section></section><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">使用防火墙实现第一层访问控制是常见也是很多中小型企业使用的方法。大家一般在网络防火墙(云安全组)、本机防火墙实现访问控制功能。</section><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">在使用防火墙时，推荐使用白名单对平台的安全性进行保障，我这里使用firewall实现基础的访问控制：</section><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #998;font-style: italic;line-height: 26px;"># 如果操作系统是Centos系列7以上版本，推荐使用</span><br/><span style="color: #998;font-style: italic;line-height: 26px;"># 保护Kafka与Zookeeper</span><br/><span style="color: #998;font-style: italic;line-height: 26px;"># 只允许Kafka的机器访问ZK，这种方法也是最有效防护ZK未授权访问导致信息泄露的办法</span><br/>firewall-cmd --permanent --add-rich-rule=<span style="color: #d14;line-height: 26px;">&#39;rule family=&#34;ipv4&#34; source address=&#34;10.10.10.9&#34; port port=&#34;2181&#34; protocol=&#34;tcp&#34; accept&#39;</span><br/><span style="color: #998;font-style: italic;line-height: 26px;"># 只允许Beats机器访问Kafka</span><br/>firewall-cmd --permanent --add-rich-rule=<span style="color: #d14;line-height: 26px;">&#39;rule family=&#34;ipv4&#34; source address=&#34;10.10.10.0/24&#34; port port=&#34;9092&#34; protocol=&#34;tcp&#34; accept&#39;</span><br/><span style="color: #998;font-style: italic;line-height: 26px;"># 只允许办公网络IP访问Kibana</span><br/>firewall-cmd --permanent --add-rich-rule=<span style="color: #d14;line-height: 26px;">&#39;rule family=&#34;ipv4&#34; source address=&#34;182.*.*.107&#34; port port=&#34;5601&#34; protocol=&#34;tcp&#34; accept&#39;</span><br/><span style="color: #998;font-style: italic;line-height: 26px;"># 如果白名单IP比较分散，可以使用firewall结合ipset，关于ipset的使用大家就自行百度吧！</span><br/>firewall-cmd --permanent --add-rich-rule=<span style="color: #d14;line-height: 26px;">&#39;rule family=&#34;ipv4&#34; source ipset=&#34;ipset_name&#34; port port=&#34;9092&#34; protocol=&#34;tcp&#34; accept&#39;</span><br/></section></pre><section data-width="100%" data-opacity="1" data-rotate="0" style="margin-right: auto;margin-left: auto;caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;border-width: 0px;border-style: none;border-color: initial;width: 574px;opacity: 1;transform: rotateZ(0deg);"><section style="width: 574px;text-align: center;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="margin-top: 10px;display: inline-block;width: auto;"><section style="display: -webkit-flex;justify-content: center;"><section style="margin-top: 8px;margin-right: -30px;width: 45px;"><section style="width: 58px;"><img data-w="70" title="" data-ratio="0.5714285714285714" src="https://wechat2rss.xlab.app/img-proxy/?k=36a6308f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarsp6wbKDYd4qxib2QHqtT18Nic5AmjBMzOcjy8bRauPMsLXiaBuBO1GqlHHg%2F640"/></section></section><section style="padding-right: 16px;padding-left: 16px;line-height: 22px;letter-spacing: 2px;"><p style="color: rgb(63, 62, 63);font-size: 16px;min-width: 1px;"><span style="font-size: 22px;">Elastic安全性</span><br/></p><p style="color: rgb(63, 62, 63);font-size: 16px;min-width: 1px;"><br/></p></section><section style="margin-top: -11px;margin-left: -30px;width: 35px;"><section style="width: 30px;"><img style="width: 30px;display: block;vertical-align: top;" data-ratio="0.625" data-w="40" src="https://wechat2rss.xlab.app/img-proxy/?k=99a3bd6d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspeahQl4dC745C0AQblUiaZWq1tVYWXxoEbgtzn7BskoD56sWSiczWsOdQ%2F640"/></section></section></section></section></section></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="font-size: 18px;color: rgb(0, 0, 0);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);letter-spacing: -2px;display: inline-block;"><span style="font-size: 20px;"><span style="color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;</span></span></section><section style="margin-left: 10px;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);color: rgb(28, 89, 165);display: inline-block;"><p style="color: rgb(121, 121, 121);min-width: 1em;"><span style="font-size: 20px;">Xpack实现访问控制</span></p></section></section><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Elastic在6.8与7.2版本之后开放了免费认证功能。我这里是7.4.1的实验环境：<br/></section><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #998;font-style: italic;line-height: 26px;"># 停止Kibana与elasticsearch服务</span><br/>systemctl stop kibana.service<br/>systemctl stop elasticsearch.service<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 创建es证书颁发机构</span><br/>/usr/share/elasticsearch/bin/elasticsearch-certutil ca<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 创建es集群通信证书</span><br/>/usr/share/elasticsearch/bin/elasticsearch-certutil cert --ca /etc/elasticsearch/elastic-stack-ca.p12<br/></section></pre><figure data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.37222222222222223" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=25c91995&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialQaYRulU8sIiced8iapAvkwlFFAGKlSic2GgrUed3RgKPRS6pDT79XePeJcgKo5j6ibwVxa1UjibFATibQ%2F640%3Fwx_fmt%3Dpng"/></figure><figure data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.2601851851851852" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=1b6039c7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialQaYRulU8sIiced8iapAvkwlMAffV5BFiaoGvy9kJGL0vVJ3nlDUYtk7nx9KrOBkTq6rq7zxA1VGqLg%2F640%3Fwx_fmt%3Dpng"/></figure><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #998;font-style: italic;line-height: 26px;"># 修改证书权限</span><br/>chmod 644 /etc/elasticsearch/elastic-certificates.p12<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 修改配置文件</span><br/>vim /etc/elasticsearch/elasticsearch.yml<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 在文件末尾添加如下内容</span><br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #d14;line-height: 26px;">xpack.security.enabled:</span> <span style="color: #008080;line-height: 26px;">true</span><br/><span style="color: #d14;line-height: 26px;">xpack.security.transport.ssl.enabled:</span> <span style="color: #008080;line-height: 26px;">true</span><br/><span style="color: #d14;line-height: 26px;">xpack.security.transport.ssl.verification_mode:</span> <span style="color: #d14;line-height: 26px;">certificate</span><br/><span style="color: #d14;line-height: 26px;">xpack.security.transport.ssl.keystore.path:</span> <span style="color: #d14;line-height: 26px;">/etc/elasticsearch/elastic-certificates.p12</span><br/><span style="color: #d14;line-height: 26px;">xpack.security.transport.ssl.truststore.path:</span> <span style="color: #d14;line-height: 26px;">/etc/elasticsearch/elastic-certificates.p12</span><br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #998;font-style: italic;line-height: 26px;"># 如果配置了证书密码</span><br/><span style="color: #998;font-style: italic;line-height: 26px;"># /usr/share/elasticsearch/bin/elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password</span><br/><span style="color: #998;font-style: italic;line-height: 26px;"># /usr/share/elasticsearch/bin/elasticsearch-keystore add xpack.security.transport.ssl.truststore.secure_password</span><br/><span style="color: #998;font-style: italic;line-height: 26px;"># 启动Elasticsearch服务</span><br/>systemctl start elasticsearch.service<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 创建账号密码</span><br/>/usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive<br/></section></pre><figure data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.3851851851851852" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=57f4e1ad&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialQaYRulU8sIiced8iapAvkwlNIJuZg97uv0ltc0Rz3KeccGjwFhrqb6trfNtbBPWEFb22c1YNsBskA%2F640%3Fwx_fmt%3Dpng"/></figure><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">elastic：超级用户</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">apm_system：使用APM时的用户</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">kibana：用来连接ES的用户</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">logstash_system：使用Logstash时的用户</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">beats_system：使用Beats时的用户</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">remote_monitoring_user：收集和存储监控信息的用户</section></li></ul><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #998;font-style: italic;line-height: 26px;"># 修改kibana配置文件</span><br/>vim /etc/kibana/kibana.yml<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 在文件末尾添加如下内容</span><br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #d14;line-height: 26px;">elasticsearch.username:</span> <span style="color: #d14;line-height: 26px;">&#34;kibana&#34;</span><br/><span style="color: #d14;line-height: 26px;">elasticsearch.password:</span> <span style="color: #d14;line-height: 26px;">&#34;kibana&#34;</span><br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #998;font-style: italic;line-height: 26px;"># 启动kibana</span><br/>systemctl start kibana.service<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 使用elastc账户登录kibana</span><br/></section></pre><figure data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.5314814814814814" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=310a315c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialQaYRulU8sIiced8iapAvkwlq6vu4PGp3kfWiadE3Lzywn2wbxNa7yM73aZnyEW0vHOCMXSYcydLASA%2F640%3Fwx_fmt%3Dpng"/></figure><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 20px;font-weight: normal;color: #222222;"></span></section><section style="color: black;padding: 10px;line-height: 1.6;letter-spacing: 0px;word-break: break-word;overflow-wrap: break-word;text-align: left;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="color: rgb(0, 0, 0);text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);font-size: 18px;letter-spacing: -2px;display: inline-block;"><span style="font-size: 20px;"><span style="color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;</span></span></section><section style="margin-left: 10px;text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);color: rgb(28, 89, 165);display: inline-block;"><p style="color: rgb(121, 121, 121);font-size: 16px;min-width: 1em;"><span style="font-size: 20px;">Nginx实现访问控制</span></p></section></section><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">方法一：使用Nginx Proxy实现</section></li></ul><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #998;font-style: italic;line-height: 26px;"># 安装认证模块</span><br/>yum install httpd-tools.x86_64 -y<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 创建认证账号</span><br/>htpasswd -cm /etc/nginx/kibana-user kibana<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 配置nginx</span><br/>vim /etc/nginx/nginx.conf<br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">server {<br/>        listen       <span style="color: #008080;line-height: 26px;">80</span>;<br/>        server_name  kibana;<br/>        auth_basic      <span style="color: #d14;line-height: 26px;">&#34;Restricted Access&#34;</span>;<br/>        auth_basic_user_file    /opt/nginx/conf/kibana-user;<br/>        #charset koi8-r;<br/>        #access_log  logs/host.access.log  main;<br/>        location / {<br/>            proxy_pass http:<span style="color: #998;font-style: italic;line-height: 26px;">//10.10.10.9:5601;</span><br/>            proxy_http_version <span style="color: #008080;line-height: 26px;">1.1</span>;<br/>            proxy_set_header Upgrade $http_upgrade;<br/>            proxy_set_header Connection <span style="color: #d14;line-height: 26px;">&#39;upgrade&#39;</span>;<br/>            proxy_set_header Host $host;<br/>            proxy_cache_bypass $http_upgrade;<br/>        }<br/>    }<br/></section></pre><figure data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.3055555555555556" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=1c368c3b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialQaYRulU8sIiced8iapAvkwlR0nWQFBhL7WTkhVibPnib0jVHvIIZtiaj68faKwwFjusKVWhHefmgxGxQ%2F640%3Fwx_fmt%3Dpng"/></figure><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">方法二：使用Nginx Lua实现</section></li></ul><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 20px;font-weight: normal;color: #222222;"></span></section><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="color: rgb(0, 0, 0);text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);font-size: 18px;letter-spacing: -2px;display: inline-block;"><span style="font-size: 20px;"><span style="color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;</span></span></section><section style="margin-left: 10px;text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);color: rgb(28, 89, 165);display: inline-block;"><p style="color: rgb(121, 121, 121);font-size: 16px;min-width: 1em;"><span style="font-size: 20px;">其他实现访问控制方法</span></p></section></section><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">SearchGuard：<a href="http://docs.search-guard.com/latest/index" target="_blank">http://docs.search-guard.com/latest/index</a> (来自小B朋友的用后感：不稳定、插件容易出问题)</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Shield：<a href="https://www.elastic.co/guide/en/shield/current/index.html" target="_blank">https://www.elastic.co/guide/en/shield/current/index.html</a> (没有使用过不做评论)</section></li></ul><section data-width="100%" data-opacity="1" data-rotate="0" style="margin-right: auto;margin-left: auto;caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;border-width: 0px;border-style: none;border-color: initial;width: 574px;opacity: 1;transform: rotateZ(0deg);"><section style="width: 574px;text-align: center;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="margin-top: 10px;display: inline-block;width: auto;"><section style="display: -webkit-flex;justify-content: center;"><section style="margin-top: 8px;margin-right: -30px;width: 45px;"><section style="width: 58px;"><img data-w="70" title="" data-ratio="0.5714285714285714" src="https://wechat2rss.xlab.app/img-proxy/?k=36a6308f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarsp6wbKDYd4qxib2QHqtT18Nic5AmjBMzOcjy8bRauPMsLXiaBuBO1GqlHHg%2F640"/></section></section><section style="padding-right: 16px;padding-left: 16px;line-height: 22px;letter-spacing: 2px;"><p style="color: rgb(63, 62, 63);font-size: 16px;min-width: 1px;"><span style="font-size: 22px;">Kafka与Zookeeper安全性</span><br/></p></section><section style="margin-top: -11px;margin-left: -30px;width: 35px;"><section style="width: 30px;"><img style="width: 30px;display: block;vertical-align: top;" data-ratio="0.625" data-w="40" src="https://wechat2rss.xlab.app/img-proxy/?k=99a3bd6d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspeahQl4dC745C0AQblUiaZWq1tVYWXxoEbgtzn7BskoD56sWSiczWsOdQ%2F640"/></section></section></section></section></section></section><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">对于Kafka与Zookeeper，其官网都提供了加密(TLS)、认证(SASL)和授权(ACL)的方式来保障安全性。但本节只介绍了Kafka与Zookeeper关于SASL认证的情况，其他的方式大家可以阅读参考资料自行获取。</section><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">TLS：提供加密，是否能解决未授权访问？未知。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">SASL：只针对客户端连接访问，无法解决Zookeeper未授权访问；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">ACL：只针对节点内的授权，无法解决Zookeeper未授权访问；</section></li></ul><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="color: rgb(0, 0, 0);text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);font-size: 18px;letter-spacing: -2px;display: inline-block;"><span style="font-size: 20px;"><span style="color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;</span></span></section><section style="margin-left: 10px;text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);color: rgb(28, 89, 165);display: inline-block;"><p style="color: rgb(121, 121, 121);font-size: 16px;min-width: 1em;"><span style="font-size: 20px;">Zookeeper配置SASL认证</span></p></section></section><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Zookeeper是一个分布式服务框架，在Kafka的依赖中，ZK主要用于：</section><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">存放Broker节点的配置信息和controller节点的配置信息；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">监听父节点的子节点列表来进行controller的选举；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">partition信息的存储；</section></li></ul><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">下面就是用SASL来对Zookeeper进行认证(实际没什么用)：</section><ol data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">修改Zookeeper的配置文件，加入官网提供的配置文件</section></li></ol><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">vim /opt/zookeeper-3.4.14/conf/zoo.cfg<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 在文件末尾添加如下内容</span><br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"># 打开SASL开关<br/>quorum.auth.enableSasl=<span style="color: #008080;line-height: 26px;">true</span><br/># 打开Client-to-Server authentication<br/>authProvider<span style="color: #008080;line-height: 26px;">.1</span>=org.apache.zookeeper.server.auth.SASLAuthenticationProvider<br/>quorum.cnxn.threads.size=<span style="color: #008080;line-height: 26px;">20</span><br/># 认证模式使用SASL<br/>requireClientAuthScheme=sasl<br/></section></pre><ol start="2" data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">创建Zookeeper的认证文件</section></li></ol><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">vim /opt/zookeeper-3.4.14/conf/zookeeper-server.conf<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 创建一个用户名为kafka，密码为123456的用户信息</span><br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Server {<br/>    org.apache.zookeeper.server.auth.DigestLoginModule required<br/>    user_kafka=<span style="color: #d14;line-height: 26px;">&#34;123456&#34;</span>;<br/>};<br/></section></pre><ol start="3" data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">修改Zookeeper运行的环境变量</section></li></ol><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">vim /opt/zookeeper-3.4.14/bin/zkServer.sh<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 在140行，nohup后面加入运行的环境变量</span><br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #998;font-style: italic;line-height: 26px;"># 原文 nohup &#34;$JAVA&#34; &#34;-Dzookeeper.log.dir=${ZOO_LOG_DIR}&#34; &#34;-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}&#34; \</span><br/><span style="color: #998;font-style: italic;line-height: 26px;"># 添加 -DJava.security.auth.login.config信息</span><br/>nohup <span style="color: #d14;line-height: 26px;">&#34;<span style="color: #008080;line-height: 26px;">$JAVA</span>&#34;</span> <span style="color: #d14;line-height: 26px;">&#34;-Djava.security.auth.login.config=/opt/zookeeper-3.4.14/conf/zookeeper-server.conf&#34;</span> <span style="color: #d14;line-height: 26px;">&#34;-Dzookeeper.log.dir=<span style="color: #008080;line-height: 26px;">${ZOO_LOG_DIR}</span>&#34;</span> <span style="color: #d14;line-height: 26px;">&#34;-Dzookeeper.root.logger=<span style="color: #008080;line-height: 26px;">${ZOO_LOG4J_PROP}</span>&#34;</span> \<br/></section></pre><ol start="4" data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">启动Zookeeper验证SASL是否配置成功</section></li></ol><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #998;font-style: italic;line-height: 26px;"># 启动服务端</span><br/>/opt/zookeeper-3.4.14/bin/zkServer.sh start<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 使用客户端连接</span><br/>/opt/zookeeper-3.4.14/bin/zkCli.sh<br/></section></pre><figure data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.5731481481481482" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=a3e1317a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialQaYRulU8sIiced8iapAvkwl6glzmeLjk7Nk4H0QGvPhjDs8bUVq7aBYMy3EWu0Sygg79XSfS850Lg%2F640%3Fwx_fmt%3Dpng"/></figure><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">注意图片中被红色框起来的部分，我们会发现即使我们服务端配置了SASL认证，客户端依旧可以连接，那么我们再来使用账号密码连接一下。</section><ol start="5" data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">创建客户端认证文件</section></li></ol><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">vim /opt/zookeeper-3.4.14/conf/zookeeper-client.conf<br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Client {<br/>    org.apache.zookeeper.server.auth.DigestLoginModule required<br/>    username=<span style="color: #d14;line-height: 26px;">&#34;kafka&#34;</span><br/>    password=<span style="color: #d14;line-height: 26px;">&#34;12345&#34;</span>;<br/>};<br/></section></pre><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">注意配置文件中的密码是错误的，这时我们来使用客户端连接就会出现</section><figure data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.5555555555555556" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=ccfe230d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialQaYRulU8sIiced8iapAvkwl1j9ZWI1VNnvOw0ibt352peiaInTOoTSZeBZ95I1FW47PTVdAa6xqqPUQ%2F640%3Fwx_fmt%3Dpng"/></figure><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">我们将密码修改正确后重新连接发现</section><figure data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.5861111111111111" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=daaa573e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialQaYRulU8sIiced8iapAvkwlMstiaSDKXL5STxvrosgxMlBXh67ic04ePiajtDVRUhGWFJOhHAFw1Vu2w%2F640%3Fwx_fmt%3Dpng"/></figure><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">上述就是Zookeeper配置SASL的全过程，但是我们使用Zookeeper未授权访问脚本测试此时的Zookeeper发现(此时我的端口是开放给外网所有的)：</section><figure data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.2324074074074074" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=6e8645d6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialQaYRulU8sIiced8iapAvkwlkO1olzyt3zeLVSoJ7KfRsBelB38SoP4Hx8nHYudVLZibqzvO2gFscIA%2F640%3Fwx_fmt%3Dpng"/></figure><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">所以SASL不能解决Zookeeper的未授权访问问题。Zookeeper的ACL也不能解决该问题，至于TLS能否解决待研究。</section><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong style="color: rgb(68, 68, 68);">备注：在这里回答为什么我们配置了服务端SASL，客户端不使用账号密码也可以登录，只是会提示unknown error。来自非官方的回答：&#34;Zookeeper认证是插件化架构，SASL只是其中一种方式，故没有Client能进入，错误的不能进入为特性，而非bug。&#34;</strong></section><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong style="color: rgb(68, 68, 68);">所以对于Zookeeper而言，最好的办法就是使用防火墙进行安全防护。</strong></section><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="color: rgb(0, 0, 0);text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);font-size: 18px;letter-spacing: -2px;display: inline-block;"><span style="font-size: 20px;"><span style="color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;</span></span></section><section style="margin-left: 10px;text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);color: rgb(28, 89, 165);display: inline-block;"><p style="color: rgb(121, 121, 121);font-size: 16px;min-width: 1em;"><span style="font-size: 20px;">Kafka配置SASL认证</span></p></section></section><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">在新版本的Kafka中支持SASL的GSSAPI与PLAIN两种认证方式，但是在fIlebeat output kafka配置中只支持SASL/PLAIN，所以我们这里也只测试SASL/PLAIN的方法：</section><figure data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.5805555555555556" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=2ca85cda&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialQaYRulU8sIiced8iapAvkwlustXNl4p5xaibVvlBNE3n2vmiceg63ibQGRetVHs3JjdE0d6Utpv21iclw%2F640%3Fwx_fmt%3Dpng"/></figure><ol data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">在上面我们已经配置好了Zookeeper的SASL了，这里我们直接进行Kafka的SASL配置</section></li></ol><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #998;font-style: italic;line-height: 26px;"># 首先修改Kafka服务端配置文件，启动SASL/PLAIN认证</span><br/>vim /opt/kafka_2.11-2.3.1/config/server.properties<br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"># PLAIN是SASL的一种认证方式，PLAINTEXT是通信过程是明文，不加密。<br/>listeners=SASL_PLAINTEXT:<span style="color: #998;font-style: italic;line-height: 26px;">//10.10.10.9:9092</span><br/># 启用的认证模式PLAIN，也可使用GSSAPI<br/>sasl.enabled.mechanisms=PLAIN<br/># kafka broker之间也需要使用PLAIN方式认证，也可使用GSSAPI<br/>sasl.mechanism.inter.broker.protocol=PLAIN<br/># 通信为明文。如果需要使用SSL加密通信，则使用SASL_SSL，不过需要配置证书<br/>security.inter.broker.protocol=SASL_PLAINTEXT<br/></section></pre><ol start="2" data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">创建一个Kafka的认证文件</section></li></ol><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">vim /opt/kafka_2.11-2.3.1/config/kafka.conf<br/><span style="color: #998;font-style: italic;line-height: 26px;"># kafkaServer为KafkaServer的SASL</span><br/><span style="color: #998;font-style: italic;line-height: 26px;"># Client是Kafka用来连接Zookeeper的配置，如果不配置Client，会提示WARN不会报错，原理在上面已经解释过了</span><br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">KafkaServer {<br/>    org.apache.kafka.common.security.plain.PlainLoginModule required<br/>    username=<span style="color: #d14;line-height: 26px;">&#34;kafka_user&#34;</span><br/>    password=<span style="color: #d14;line-height: 26px;">&#34;kafka_pass&#34;</span><br/>    user_producer=<span style="color: #d14;line-height: 26px;">&#34;producer&#34;</span><br/>    user_consumer=<span style="color: #d14;line-height: 26px;">&#34;consumer&#34;</span>;<br/>};<br/>Client {<br/>    org.apache.kafka.common.security.plain.PlainLoginModule required<br/>    username=<span style="color: #d14;line-height: 26px;">&#34;kafka&#34;</span><br/>    password=<span style="color: #d14;line-height: 26px;">&#34;123456&#34;</span>;<br/>};<br/></section></pre><ol start="3" data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">修改Kafka运行的环境变量</section></li></ol><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">vim /opt/kafka_2.11-2.3.1/bin/kafka-run-class.sh<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 找到KAKFA_OPTS</span><br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-weight: bold;line-height: 26px;">if</span> [ -z <span style="color: #d14;line-height: 26px;">&#34;$KAFKA_OPTS&#34;</span> ]; then<br/>  KAFKA_OPTS=<span style="color: #d14;line-height: 26px;">&#34;-Djava.security.auth.login.config=/opt/kafka_2.11-2.3.1/config/kafka.conf&#34;</span><br/>fi<br/></section></pre><ol start="4" data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">启动Kafka并测试Kafka认证</section></li></ol><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #998;font-style: italic;line-height: 26px;"># 启动Kafka服务</span><br/>/opt/kafka_2.11-2.3.1/bin/kafka-server-start.sh -daemon /opt/kafka_2.11-2.3.1/config/server.properties<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 启动Kafka Producer测试是否能使用Kafka，记住先创建一个system-messages的topic</span><br/>/opt/kafka_2.11-2.3.1/bin/kafka-console-producer.sh --broker-list 10.10.10.9:9092 --topic system-messages<br/></section></pre><figure data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.4444444444444444" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=3a63789d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialQaYRulU8sIiced8iapAvkwl1lOGfZnm3BDfjqxyzfs3CibAxOic30eopdibogLBJQiclX2yRTnf9QNickA%2F640%3Fwx_fmt%3Dpng"/></figure><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">如图证明我们没有配置客户端的账号密码就不能使用Kafka。</section><ol start="5" data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">配置Kafka Client SASL认证</section></li></ol><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #998;font-style: italic;line-height: 26px;"># 首先是修改Producer的配置文件</span><br/>vim /opt/kafka_2.11-2.3.1/config/producer.properties<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 在文件末尾添加如下内容</span><br/><span style="color: #998;font-style: italic;line-height: 26px;"># 如果不添加还是不能使用</span><br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">security.protocol=SASL_PLAINTEXT<br/>sasl.mechanism=PLAIN<br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #998;font-style: italic;line-height: 26px;"># 其次是创建Kafka认证的文件，我这里Kafka CLient与Server是同一台，所以配置文件我写在同一个文件中</span><br/>vim /opt/kafka_2.11-2.3.1/config/kafka.conf<br/><span style="color: #998;font-style: italic;line-height: 26px;"># 在文件末尾添加如下内容</span><br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">KafkaClient {<br/>    org.apache.kafka.common.security.plain.PlainLoginModule required<br/>    username=<span style="color: #d14;line-height: 26px;">&#34;producer&#34;</span><br/>    password=<span style="color: #d14;line-height: 26px;">&#34;producer&#34;</span>;<br/>};<br/></section></pre><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">如果不是使用同一个文件，需要单独配置运行环境变量。</section><ol start="6" data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Kafka客户端配置完成后，我们再来测试</section></li></ol><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #998;font-style: italic;line-height: 26px;"># 切记，必须制定producer的配置文件</span><br/>/opt/kafka_2.11-2.3.1/bin/kafka-console-producer.sh --broker-list 10.10.10.9:9092 --topic system-messages<br/></section></pre><ol start="7" data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">与Producer一样的配置Consumer。如果你与小B一样使用的是一个配置文件就不用重复配置了，如果不是记得配置，并且需要指定运行环境变量。</section></li></ol><figure data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.21851851851851853" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=b58a5be8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialQaYRulU8sIiced8iapAvkwl49svnILW9ZUic5oibaibEF9ThibcGjf35V2574XGPiad0h5Tia2N5CkLtWJw%2F640%3Fwx_fmt%3Dpng"/></figure><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 20px;font-weight: normal;color: #222222;"></span></section><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="color: rgb(0, 0, 0);text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);font-size: 18px;letter-spacing: -2px;display: inline-block;"><span style="font-size: 20px;"><span style="color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;</span></span></section><section style="margin-left: 10px;text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);color: rgb(28, 89, 165);display: inline-block;"><p style="color: rgb(121, 121, 121);font-size: 16px;min-width: 1em;"><span style="font-size: 20px;">Filebeat与Logstash配置Kafka</span></p></section></section><ol data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">首先是Filebeat成为Kafka的Producer</section></li></ol><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">vim /etc/filebeat/filebeat.yml<br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #d14;line-height: 26px;">filebeat.inputs:</span><br/><span style="line-height: 26px;">- type:</span> <span style="color: #d14;line-height: 26px;">log</span><br/><span style="line-height: 26px;">  enabled:</span> <span style="color: #008080;line-height: 26px;">true</span><br/><span style="line-height: 26px;">  paths:</span><br/><span style="color: #990073;line-height: 26px;">    -</span> <span style="color: #d14;line-height: 26px;">/var/log/test.log</span><br/><span style="color: #d14;line-height: 26px;">output.kafka:</span><br/><span style="line-height: 26px;">  hosts:</span> <span style="color: #d14;line-height: 26px;">[&#34;10.10.10.9:9092&#34;]</span><br/><span style="line-height: 26px;">  topic:</span> <span style="color: #d14;line-height: 26px;">&#34;test&#34;</span><br/><span style="line-height: 26px;">  username:</span> <span style="color: #d14;line-height: 26px;">&#34;producer&#34;</span><br/><span style="line-height: 26px;">  password:</span> <span style="color: #d14;line-height: 26px;">&#34;producer&#34;</span><br/></section></pre><ol start="2" data-tool="mdnice编辑器" style="" class="list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">其次就是Logstash成为Kafka的Consumer</section></li></ol><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">vim /etc/logstash/conf.d/kafka.conf<br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">input {<br/>	kafka {<br/>		<span style="line-height: 26px;"><span style="line-height: 26px;">bootstrap_servers</span> =&gt;</span> <span style="color: #d14;line-height: 26px;">&#34;10.10.10.9:9092&#34;</span><br/>		security_protocol =&gt; <span style="color: #d14;line-height: 26px;">&#34;SASL_PLAINTEXT&#34;</span><br/>		sasl_mechanism =&gt; <span style="color: #d14;line-height: 26px;">&#34;PLAIN&#34;</span><br/>		jaas_path =&gt; <span style="color: #d14;line-height: 26px;">&#34;/etc/logstash/kafka-client-jaas.conf&#34;</span><br/>		topics =&gt; [<span style="color: #d14;line-height: 26px;">&#34;test&#34;</span>]<br/>	}<br/>}<br/>output {<br/>    stdout {}<br/>}<br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: #998;font-style: italic;line-height: 26px;"># 配置Kafka的Client信息</span><br/>vim /etc/logstash/kafka-client-jaas.conf<br/></section></pre><pre data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);display: -webkit-box;border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">KafkaClient {<br/>    org.apache.kafka.common.security.plain.PlainLoginModule required<br/>    username=<span style="color: #d14;line-height: 26px;">&#34;consumer&#34;</span><br/>    password=<span style="color: #d14;line-height: 26px;">&#34;consumer&#34;</span>;<br/>};<br/></section></pre><figure data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><img data-ratio="0.5416666666666666" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=6dd2676f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialQaYRulU8sIiced8iapAvkwl0K4NUZFwxDLjVicDYtJ8JhRWKAIUw2OsNJcK6zAMyhicgLYx2EPiaQfsg%2F640%3Fwx_fmt%3Dpng"/></figure><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">好了，平台安全性就先讲这么多吧！</section><section style="font-size: 15px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">未完待续。。。</section><section data-style-type="5" data-tools="新媒体排版" data-id="2848936"><section data-style-type="5" data-tools="新媒体排版" data-id="2848935"><section style="white-space: normal;text-align: center;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong style="max-width: 100%;color: rgb(62, 62, 62);font-size: 16px;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 1.75em;font-size: 15px;color: rgb(171, 25, 66);box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);font-size: 16px;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 1.75em;font-size: 15px;color: rgb(171, 25, 66);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(63, 63, 63);font-size: 14px;letter-spacing: 0px;text-align: justify;"> </span></span></strong><span style="color: rgb(63, 63, 63);font-size: 14px;letter-spacing: 0px;text-align: justify;"><strong style="text-align: center;max-width: 100%;color: rgb(62, 62, 62);font-size: 16px;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 1.75em;font-size: 15px;color: rgb(171, 25, 66);box-sizing: border-box !important;word-wrap: break-word !important;"><img class="__bg_gif" data-ratio="1" style="box-sizing: border-box !important;word-wrap: break-word !important;visibility: visible !important;width: auto !important;height: auto !important;" data-type="gif" data-w="55" src="https://wechat2rss.xlab.app/img-proxy/?k=7875a89b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_gif%2FrbP97vC6mialQaYRulU8sIiced8iapAvkwlPgfvQ3kBp7HzM7mGg1oq2etjkibqXzZAIOOyS4mW0VeU6iczicibyY9w0g%2F640%3Fwx_fmt%3Dgif"/></span></strong></span></span></strong></section></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 14px;letter-spacing: 3px;color:#000;"><strong>- HISTORY -</strong></span></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483849&amp;idx=1&amp;sn=cdb1bbe88e24156df44b12f531c48456&amp;chksm=fc981509cbef9c1f499f03b9d520c1e48057829fbafa34c7b54674cc61d2ae3b33c526aa80af&amp;scene=21#wechat_redirect" textvalue="《日志分析系列(一)：介绍篇》" data-itemshowtype="0" tab="innerlink" data-linktype="2"><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;letter-spacing: 3px;">《日志分析系列(一)：</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;letter-spacing: 3px;">介绍篇》</span></a></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483869&amp;idx=1&amp;sn=5b43cdc88622a39b9f3eddf930d653cc&amp;chksm=fc98151dcbef9c0b9bab0008ec0e84765cd4bed6a3c9043566d647dd300ffc8739080b3b14fc&amp;scene=21#wechat_redirect" textvalue="《日志分析系列(二)：平台实现篇》" data-itemshowtype="0" tab="innerlink" data-linktype="2"><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">《日志分析系列(二)：</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;"></span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">平台实现</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">篇》</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;"></span></a></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483806&amp;idx=1&amp;sn=dbd9264bc3fece3bcaa92f18c2dd0bd4&amp;chksm=fc98155ecbef9c48529617523d1bdc2e85bc26ea24ef2b340f59218f0b9713357067a098ce33&amp;scene=21#wechat_redirect" textvalue="《日志分析系列(外传一)：Nginx透过代理获取真实客户端IP》" data-itemshowtype="0" tab="innerlink" data-linktype="2"><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">《日志分析系列(外传一)：</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">Nginx透过代理获取真实客户端IP</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">》</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;"></span></a></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483868&amp;idx=1&amp;sn=c66ce6cf610faf3f10b5bf0011d5386d&amp;chksm=fc98151ccbef9c0aa7b2d3608330cc8091fc7a27a264d9a8ffb5baf827e22f870244654dae0c&amp;scene=21#wechat_redirect" textvalue="《日志分析系列(外传二)：Nginx日志统一化》" data-itemshowtype="0" tab="innerlink" data-linktype="2"><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">《日志分析系列(外传二)：</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">Nginx日志统一化</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">》</span></a></section></section><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><br/></section>



<p><a href="https://zhuanlan.zhihu.com/p/102416230">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=cb577fae&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483870%26idx%3D1%26sn%3Dd662fb5ed290f19d1dc9f650f59ef0ae%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 13 Jan 2020 08:00:00 +0800</pubDate>
    </item>
    <item>
      <title>日志分析系列(二):平台实现篇</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483869&amp;idx=1&amp;sn=5b43cdc88622a39b9f3eddf930d653cc</link>
      <description>本系列故事纯属虚构，如有雷同纯属巧合平台实现前的说明小B在给老板汇报了&#34;统一日志分析平台&#34;项目后，老板拍板立</description>
      <content:encoded><![CDATA[<p>
原创 <span>bloodzer0</span> <span>2020-01-06 08:15</span> <span style="display: inline-block;"></span>
</p>

<p>本系列故事纯属虚构，如有雷同纯属巧合平台实现前的说明小B在给老板汇报了"统一日志分析平台"项目后，老板拍板立</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=321cee44&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miam3gxp3NYKg8FN0ogeKMJttjmTVWvicWUnwBQEB3bdGFO2by1tNAkQOlRlT6xHHPVq70IAOGcWFk3A%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section class="xmteditor" style="display:none;" data-tools="新媒体管家" data-label="powered by xmt.cn"><br/></section></section><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section class="xmteditor" style="display:none;" data-tools="新媒体管家" data-label="powered by xmt.cn"><br/></section><section class="xmteditor" style="display:none;" data-tools="新媒体管家" data-label="powered by xmt.cn"><br/></section></section><section class="xmt-style-block" data-style-type="5" data-tools="新媒体排版" data-id="2848981"><section class="KolEditor"><section class="xmt-style-block" data-style-type="5" data-tools="新媒体排版" data-id="2848981"><section class="KolEditor"><section><section><section style="text-align: center;line-height: normal;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="caret-color: rgb(240, 84, 84);color: rgb(240, 84, 84);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 15px;text-align: center;">本系列故事纯属虚构，如有雷同纯属巧合</span><br/></section><section style="color: rgb(240, 84, 84);line-height: normal;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 15px;"></span></section></section><section style="text-align: center;white-space: normal;line-height: normal;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><img class="" data-ratio="0.05555555555555555" data-w="180" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=58a39579&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMdiaNr0OwpmzM4NhqDiaQCfAXn29rSVjqibNP5g9NFiabNR83tdz2F8qEyLQ%2F640%3Fwx_fmt%3Dpng"/></section></section></section></section><section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" style="margin-right: auto;margin-left: auto;caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;border-width: 0px;border-style: none;border-color: initial;width: 574px;opacity: 1;transform: rotateZ(0deg);"><section style="width: 574px;text-align: center;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="margin-top: 10px;display: inline-block;width: auto;"><section style="display: -webkit-flex;justify-content: center;"><section style="margin-top: 8px;margin-right: -30px;width: 45px;"><section style="width: 58px;"><img data-w="70" title="" class="" data-ratio="0.5714285714285714" src="https://wechat2rss.xlab.app/img-proxy/?k=36a6308f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarsp6wbKDYd4qxib2QHqtT18Nic5AmjBMzOcjy8bRauPMsLXiaBuBO1GqlHHg%2F640"/></section></section><section style="padding-right: 16px;padding-left: 16px;line-height: 22px;letter-spacing: 2px;"><p class="title active" style="color: rgb(63, 62, 63);font-size: 16px;min-width: 1px;"><span style="font-size: 22px;">平台实现前的说明</span></p></section><section style="margin-top: -11px;margin-left: -30px;width: 35px;"><section style="width: 30px;"><img style="width: 30px;display: block;vertical-align: top;" class="" data-ratio="0.625" data-w="40" src="https://wechat2rss.xlab.app/img-proxy/?k=99a3bd6d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspeahQl4dC745C0AQblUiaZWq1tVYWXxoEbgtzn7BskoD56sWSiczWsOdQ%2F640"/></section></section></section></section></section></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">小B在给老板汇报了&#34;统一日志分析平台&#34;项目后，老板拍板立即开始做，争取下一次能及时发现攻击并且追踪攻击者。于是小B开始分析了市面上商业与开源的日志分析平台架构，大家都神似如下图：</section><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.6077812828601472" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="951" src="https://wechat2rss.xlab.app/img-proxy/?k=ab24b303&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMdYyxl4f2nI3kF4ALss1riaFU8XOO5BUmO5ZZwGdnWZDVgvt2Us0vLTBg%2F640%3Fwx_fmt%3Dpng"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">知道了架构如何，接下来的关键就是每层之间选择什么样的产品了。关于如何选择，小B推荐了几个方面：</section><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">已有架构：避免基础能力的重复，使用目前IT基础框架中已有的东西。假设运维已经有一套ELK，就没有必要重复搭建，只需要与之结合优化数据源与增加安全分析场景即可。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">技术实力：负责统一日志分析平台人员的技能栈。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">产品自身优劣：不同产品有各自最适用的场景，所以选择合理产品是核心依据。</section></li></ul><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">小B在选择产品时，参考了一些些资料(见参考资料)。</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">在经过一番对比之后，小B最终选择了以下产品来实现统一日志分析平台：</section><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.5628140703517588" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="995" src="https://wechat2rss.xlab.app/img-proxy/?k=46d6f64f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMdicO1GXfsO6S19SKElc71pQ7vyWXOLXmWOsMzdCkwMUKkXo52Ib9bvCQ%2F640%3Fwx_fmt%3Dpng"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">下面就容小B细细道来实现统一日志分析平台的那些心酸历程：(如果大家尝试复现小B的统一日志分析平台，请优先阅读<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">踩坑记录</code>，在文章末尾)</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">小B的统一日志分析平台结构(简易版，实际要复杂的多，这里只是一个Demo环境)：</section><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.6703187250996016" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1004" src="https://wechat2rss.xlab.app/img-proxy/?k=813cc603&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMdTiclb1qvedXajibOPibE1ggj6TvrDbuantciatUbEey4km2240SdGRJqaA%2F640%3Fwx_fmt%3Dpng"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">搭建过程，我就不一一描述了，搭建自己可以查询相关产品的安装文档或者：</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a href="https://bloodzer0.github.io/ossa" target="_blank">https://bloodzer0.github.io/ossa</a></section><section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" style="margin-right: auto;margin-left: auto;caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;border-width: 0px;border-style: none;border-color: initial;width: 574px;opacity: 1;transform: rotateZ(0deg);"><section style="width: 574px;text-align: center;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="margin-top: 10px;display: inline-block;width: auto;"><section style="display: -webkit-flex;justify-content: center;"><section style="margin-top: 8px;margin-right: -30px;width: 45px;"><section style="width: 58px;"><img data-w="70" title="" class="" data-ratio="0.5714285714285714" src="https://wechat2rss.xlab.app/img-proxy/?k=36a6308f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarsp6wbKDYd4qxib2QHqtT18Nic5AmjBMzOcjy8bRauPMsLXiaBuBO1GqlHHg%2F640"/></section></section><section style="padding-right: 16px;padding-left: 16px;line-height: 22px;letter-spacing: 2px;"><p class="title active" style="color: rgb(63, 62, 63);font-size: 16px;min-width: 1px;"><span style="font-size: 22px;">实现日志采集处理与展示</span></p></section><section style="margin-top: -11px;margin-left: -30px;width: 35px;"><section style="width: 30px;"><img style="width: 30px;display: block;vertical-align: top;" class="" data-ratio="0.625" data-w="40" src="https://wechat2rss.xlab.app/img-proxy/?k=99a3bd6d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspeahQl4dC745C0AQblUiaZWq1tVYWXxoEbgtzn7BskoD56sWSiczWsOdQ%2F640"/></section></section></section></section></section></section><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="color: rgb(0, 0, 0);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);font-size: 18px;letter-spacing: -2px;display: inline-block;"><span style="font-size: 20px;"><span style="color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;</span></span></section><section style="margin-left: 10px;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);color: rgb(28, 89, 165);display: inline-block;"><p class="active brush" style="color: rgb(121, 121, 121);min-width: 1em;"><span style="font-size: 20px;">服务器日志</span></p></section></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">首先关注的是服务器上的日志，Q公司所有的服务器都是Linux(Centos7.x)，极大的减少了小B的工作：<br/></section><h3 style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: #333333;">服务器日志采集</span></h3><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">/var/log/audit/audit.log</code>：审计日志，跟用户相关的日志。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">/var/log/cron</code>：记录与系统定时任务相关的日志。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">/var/log/messages</code>：记录系统中主要信息的日志。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">/var/log/secure</code>：记录验证和授权方面信息的日志，如：ssh登录、su切换用户、sudo授权等。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">/var/log/yum.log</code>：记录yum安装软件信息。</section></li></ul><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">关于服务器日志采集filebeat提供了两种采集方法：</section><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">方法一：直接写配置文件采集：<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">vim /etc/filebeat/filebeat.yml</code>。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">方法二：使用filebeat模块来收集，使用模块收集也是我们本次采用的方法。因为使用模块内置了pipeline可以解析服务器日志，并且在Kibana中提供了很多图表，减少我们的工作时间。<strong style="color: rgb(68, 68, 68);">备注：这里有坑，详情请看踩坑0x02</strong></section></li></ul><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 首先在我们的测试服务器上安装filebeat</span><br/>rpm -ivh filebeat-7.4.1-x86_64.rpm<br/><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 修改filebeat配置文件中的ES和Kibana地址，并初始化filebeat</span><br/>vim /etc/filebeat/filebeat.yml<br/></section></pre><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-string" style="color: #d14;line-height: 26px;">setup.kibana:</span><br/><span class="hljs-attr" style="line-height: 26px;">  host:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;10.10.10.9:5601&#34;</span><br/>  <br/><span class="hljs-string" style="color: #d14;line-height: 26px;">output.elasticsearch:</span><br/><span class="hljs-attr" style="line-height: 26px;">  hosts:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">[&#34;10.10.10.9:9200&#34;]</span><br/></section></pre><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 初始化filebeat</span><br/>filebeat setup<br/><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 启动filebeat模块</span><br/>filebeat modules <span class="hljs-built_in" style="color: #0086b3;line-height: 26px;">enable</span> system<br/>filebeat modules <span class="hljs-built_in" style="color: #0086b3;line-height: 26px;">enable</span> auditd<br/><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 初始化filebeat模块的pipelines</span><br/>filebeat setup --pipelines --modules system<br/>filebeat setup --pipelines --modules auditd<br/><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 修改system模块中日志文件路径</span><br/>vim /etc/filebeat/modules.d/system.yml<br/></section></pre><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-attr" style="line-height: 26px;">- module:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">system</span><br/><span class="hljs-attr" style="line-height: 26px;">  syslog:</span><br/><span class="hljs-attr" style="line-height: 26px;">    enabled:</span> <span class="hljs-literal" style="color: #008080;line-height: 26px;">true</span><br/>    <span class="hljs-string" style="color: #d14;line-height: 26px;">var.paths:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">[&#34;/var/log/messages&#34;]</span><br/><span class="hljs-attr" style="line-height: 26px;">  auth:</span><br/><span class="hljs-attr" style="line-height: 26px;">    enabled:</span> <span class="hljs-literal" style="color: #008080;line-height: 26px;">true</span><br/>    <span class="hljs-string" style="color: #d14;line-height: 26px;">var.paths:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">[&#34;/var/log/secure&#34;]</span><br/></section></pre><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 修改audit模块中日志文件路径</span><br/>vim /etc/filebeat/modules.d/auditd.yml<br/></section></pre><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-attr" style="line-height: 26px;">- module:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">auditd</span><br/><span class="hljs-attr" style="line-height: 26px;">  log:</span><br/><span class="hljs-attr" style="line-height: 26px;">    enabled:</span> <span class="hljs-literal" style="color: #008080;line-height: 26px;">true</span><br/>    <span class="hljs-string" style="color: #d14;line-height: 26px;">var.paths:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">[&#34;/var/log/audit/audit.log&#34;]</span><br/></section></pre><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 修改filebeat配置文件中输出 为Kafka</span><br/>vim /etc/filebeat/filebeat.yml<br/></section></pre><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># output.elasticsearch:</span><br/><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;">#   hosts: [&#34;10.10.10.9:9200&#34;]</span><br/><span class="hljs-string" style="color: #d14;line-height: 26px;">output.kafka:</span><br/><span class="hljs-attr" style="line-height: 26px;">  hosts:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">[&#34;10.10.10.9:9092&#34;]</span><br/><span class="hljs-attr" style="line-height: 26px;">  topics:</span><br/>    <span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 这里的含义：当存在@metadata.pipeline字段时(这个字段是使用module默认生成的字段)，topic命名为%{[service.type]}-%{[fileset.name]}</span><br/>    <span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 在这里推荐大家，如果不想使用我这种命名方式，可以使用kafka消费者查看详细信息，从信息中获取字段来命名</span><br/><span class="hljs-attr" style="line-height: 26px;">    - topic:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">&#39;<span class="hljs-template-variable" style="color: #008080;line-height: 26px;">%{[service.type]}</span>-<span class="hljs-template-variable" style="color: #008080;line-height: 26px;">%{[fileset.name]}</span>&#39;</span><br/>      <span class="hljs-string" style="color: #d14;line-height: 26px;">when.has_fields:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">[&#34;@metadata.pipeline&#34;]</span><br/></section></pre><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 测试配置文件</span><br/>filebeat <span class="hljs-built_in" style="color: #0086b3;line-height: 26px;">test</span> config -c /etc/filebeat/filebeat.yml<br/><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 启动filebeat</span><br/>filebeat -e<br/></section></pre><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">一旦filebeat开始工作，我们就可以看到在kafka服务器上新增了三个topic：</section><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.2139240506329114" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="790" src="https://wechat2rss.xlab.app/img-proxy/?k=99e2f03f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMde8IVhAAGGXaibTOJNTWbQQUz1xA3icqjicDjQGKlqjzK5ziaAOBXxAAmSw%2F640%3Fwx_fmt%3Dpng"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">这里我使用kafka消费topic查看日志消息内容，大家使用不同命名格式时也可以从这里获取。甚至可以在每一个topic的名称中包含客户端信息。</section><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.14643237486687966" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1878" src="https://wechat2rss.xlab.app/img-proxy/?k=4d141d1a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMdbcjy1ewoOj8GaBjxHR84WiaW2Gualml40ibfp5LJbZalg8qhAeLnxwag%2F640%3Fwx_fmt%3Dpng"/></figure><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.7155688622754491" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1336" src="https://wechat2rss.xlab.app/img-proxy/?k=77f7b209&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMdWnicCzicoKViaMj7v1U64jLhGfP8jUIXQz03dusUSHicnrsAA6suOAiabYw%2F640%3Fwx_fmt%3Dpng"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">接下来我们需要使用logstash接受kafka的消息，并输出到ES中。需要注意的是，由于我们使用的是filebeat采集并且在ES与Kibana的配置中也是使用filebeat开头的template信息，所以我们输出的index前缀不要轻易修改，可以在中间添加我们需要的信息。</section><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 创建Logstash配置文件</span><br/>vim /etc/logstash/conf.d/system.conf<br/></section></pre><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;">input {<br/>    kafka {<br/>        <span class="hljs-function" style="line-height: 26px;"><span class="hljs-params" style="line-height: 26px;">bootstrap_servers</span> =&gt;</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;10.10.10.9:9092&#34;</span><br/>        topics =&gt; [<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;system-auth&#34;</span>,<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;system-syslog&#34;</span>,<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;auditd-log&#34;</span>]<br/>        codec =&gt; json<br/>    }<br/>}<br/>output {<br/>    <span class="hljs-keyword" style="font-weight: bold;line-height: 26px;">if</span> [<span class="hljs-meta" style="color: #999;font-weight: bold;line-height: 26px;">@metadata</span>][pipeline] and [<span class="hljs-meta" style="color: #999;font-weight: bold;line-height: 26px;">@metadata</span>][topic] == <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;auditd-log&#34;</span> {<br/>        elasticsearch {<br/>            <span class="hljs-function" style="line-height: 26px;"><span class="hljs-params" style="line-height: 26px;">hosts</span> =&gt;</span> [<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;10.10.10.9:9200&#34;</span>]<br/>            index =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;%{[@metadata][beat]}-%{[@metadata][version]}-audit-log-%{+YYYY.MM.dd}&#34;</span><br/>            pipeline =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;%{[@metadata][pipeline]}&#34;</span><br/>        }<br/>    }<br/>    <span class="hljs-keyword" style="font-weight: bold;line-height: 26px;">else</span> <span class="hljs-keyword" style="font-weight: bold;line-height: 26px;">if</span> [<span class="hljs-meta" style="color: #999;font-weight: bold;line-height: 26px;">@metadata</span>][pipeline] and [<span class="hljs-meta" style="color: #999;font-weight: bold;line-height: 26px;">@metadata</span>][topic] == <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;system-syslog&#34;</span> {<br/>        elasticsearch {<br/>            <span class="hljs-function" style="line-height: 26px;"><span class="hljs-params" style="line-height: 26px;">hosts</span> =&gt;</span> [<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;10.10.10.9:9200&#34;</span>]<br/>            index =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;%{[@metadata][beat]}-%{[@metadata][version]}-system-syslog-%{+YYYY.MM.dd}&#34;</span><br/>            pipeline =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;%{[@metadata][pipeline]}&#34;</span><br/>        }<br/>    }<br/>    <br/>    # **********<br/>}<br/></section></pre><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 启动Logstash</span><br/>/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d<br/><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 查看Kibana中的索引信息</span><br/></section></pre><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.4" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1915" src="https://wechat2rss.xlab.app/img-proxy/?k=69b5e0eb&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMdc84kJzdZteS0g8UzP1bkn22Athv2YwlERdCAB8ibJz2djicpTCYJ3BuQ%2F640%3Fwx_fmt%3Dpng"/></figure><h3 style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: #333333;">服务器日志展示</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">当一切完成后，我们可以在Kibana的Dashboard中查看默认配置好的图表：</section><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.49226441631504925" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="2844" src="https://wechat2rss.xlab.app/img-proxy/?k=e766dbbe&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMdEhMvLm61x8fS4TmpBjmbDtgh8nXHk8LhJVXTX7XHAt47DeoJjqdxNQ%2F640%3Fwx_fmt%3Dpng"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong style="color: rgb(68, 68, 68);">总结一下：</strong> 对于服务器日志的收集处理小B觉得，如果你后续还考虑接入入侵检测与防护系统的日志的话，对于服务器日志这块相对可以忽略部分，因为这里能够分析处理的日志内容在入侵检测与防护日志中也能体现。</section><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="color: rgb(0, 0, 0);text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);font-size: 18px;letter-spacing: -2px;display: inline-block;"><span style="font-size: 20px;"><span style="color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;</span></span></section><section style="margin-left: 10px;font-size: 16px;text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);color: rgb(28, 89, 165);display: inline-block;"><p class="active brush" style="color: rgb(121, 121, 121);min-width: 1em;"><span style="font-size: 20px;">Web日志</span></p></section></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Q公司使用的Web服务器是Nginx，所以只需要对日志统一化，就很好处理</section><h3 style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: #333333;">Web日志采集</span></h3><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">方式一：使用Filebeat Module，但是如果自定义了日志格式，需要修改Filebeat的pipeline规则：<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">vim /usr/share/filebeat/module/nginx/access/ingest/default.json</code></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">方式二：自己写Pattern解析，我们这里使用此种方法。</section></li></ul><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 首先修改采集端filebeat的配置</span><br/>vim /etc/filebeat/filebeat.yml<br/></section></pre><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-string" style="color: #d14;line-height: 26px;">filebeat.inputs:</span><br/><span class="hljs-attr" style="line-height: 26px;">- type:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">log</span><br/><span class="hljs-attr" style="line-height: 26px;">  paths:</span><br/><span class="hljs-bullet" style="color: #990073;line-height: 26px;">    -</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">/opt/nginx/logs/access.log</span><br/><span class="hljs-attr" style="line-height: 26px;">  fields:</span><br/><span class="hljs-attr" style="line-height: 26px;">    nginx:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">access</span><br/>  <span class="hljs-string" style="color: #d14;line-height: 26px;">json.keys_under_root:</span> <span class="hljs-literal" style="color: #008080;line-height: 26px;">true</span><br/>  <span class="hljs-string" style="color: #d14;line-height: 26px;">json.overwrite_keys:</span> <span class="hljs-literal" style="color: #008080;line-height: 26px;">true</span><br/><span class="hljs-string" style="color: #d14;line-height: 26px;">output.kafka:</span><br/><span class="hljs-attr" style="line-height: 26px;">  hosts:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">[&#34;10.10.10.9:9092&#34;]</span><br/><span class="hljs-attr" style="line-height: 26px;">  topics:</span><br/><span class="hljs-attr" style="line-height: 26px;">    - topic:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">&#39;<span class="hljs-template-variable" style="color: #008080;line-height: 26px;">%{[service.type]}</span>-<span class="hljs-template-variable" style="color: #008080;line-height: 26px;">%{[fileset.name]}</span>&#39;</span><br/>      <span class="hljs-string" style="color: #d14;line-height: 26px;">when.has_fields:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">[&#34;@metadata.pipeline&#34;]</span><br/><span class="hljs-attr" style="line-height: 26px;">    - topic:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">&#39;nginx-access&#39;</span><br/>      <span class="hljs-string" style="color: #d14;line-height: 26px;">when.has_fields:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">[&#34;fields.nginx&#34;]</span><br/></section></pre><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 修改Logstash配置</span><br/>vim /etc/logstash/conf.d/nginx.conf<br/></section></pre><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;">input {<br/>    kafka {<br/>        <span class="hljs-function" style="line-height: 26px;"><span class="hljs-params" style="line-height: 26px;">bootstrap_servers</span> =&gt;</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;10.10.10.9:9092&#34;</span><br/>        topics =&gt; [<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;nginx-access&#34;</span>]<br/>        codec =&gt; json<br/>    }<br/>}<br/>output {<br/>	<span class="hljs-keyword" style="font-weight: bold;line-height: 26px;">if</span> [fields][nginx] == <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;access&#34;</span> {<br/>        elasticsearch {<br/>            <span class="hljs-function" style="line-height: 26px;"><span class="hljs-params" style="line-height: 26px;">hosts</span> =&gt;</span> [<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;10.10.10.9:9200&#34;</span>]<br/>            index =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;nginx-access-%{+YYYY.MM.dd}&#34;</span><br/>        }<br/>    }<br/>}<br/></section></pre><h3 style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: #333333;">Web日志展示</span></h3><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.45555555555555555" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1440" src="https://wechat2rss.xlab.app/img-proxy/?k=3517b693&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMdicFfVkAv962hutSu77ibFY9icVVjrQHKqWlpchLiaicica3hwPCQrjCPjObA%2F640%3Fwx_fmt%3Dpng"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong style="color: rgb(68, 68, 68);">总结一下：</strong> Web服务的日志很多时候是我们关注的重点，这里只是展示了采集与简单处理，在后续的分析篇中会提到更多关于Web日志的分析技巧。</section><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="color: rgb(0, 0, 0);text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);font-size: 18px;letter-spacing: -2px;display: inline-block;"><span style="font-size: 20px;"><span style="color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;</span></span></section><section style="margin-left: 10px;font-size: 16px;text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);color: rgb(28, 89, 165);display: inline-block;"><p class="active brush" style="color: rgb(121, 121, 121);min-width: 1em;"><span style="font-size: 20px;">堡垒机日志</span></p></section></section><h3 style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: #333333;">堡垒机日志采集</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Q公司使用的堡垒机是开源JumpServer，版本信息是：1.5.4-2，JumpServer的相关信息在MySQL中，需要分析可以将结果从MySQL中获取，对于JumpServer日志分析也有两种方法：</section><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">写定时SQL将结果导出到文件中，在使用filebeat从文件中读取。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">直接使用logstash jdbc input plugin，远程获取，我们这里使用此种方法(此种方法是没有使用到filebeat的)。</section></li></ul><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 配置jumpserver Logstash采集</span><br/>vim /etc/logstash/conf.d/jumpserver.conf<br/></section></pre><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;">input {<br/>  jdbc {<br/>    <span class="hljs-function" style="line-height: 26px;"><span class="hljs-params" style="line-height: 26px;">jdbc_driver_library</span> =&gt;</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;/usr/share/logstash/logstash-core/lib/jars/mysql-connector-java-5.1.36.jar&#34;</span><br/>    jdbc_driver_class =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;com.mysql.jdbc.Driver&#34;</span><br/>    jdbc_paging_enabled =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;true&#34;</span><br/>    jdbc_connection_string =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;jdbc:mysql://10.10.10.6:3306/jumpserver&#34;</span><br/>    jdbc_user =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;root&#34;</span><br/>    jdbc_password =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;root&#34;</span><br/>    schedule =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;*/1 * * * *&#34;</span><br/>    statement =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;select * from terminal_session where date_start &gt;= SUBDATE(now(),interval 481 minute)&#34;</span><br/>    <span class="hljs-keyword" style="font-weight: bold;line-height: 26px;">type</span> =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;terminal_session&#34;</span><br/>  }<br/>  jdbc {<br/>    <span class="hljs-function" style="line-height: 26px;"><span class="hljs-params" style="line-height: 26px;">jdbc_driver_library</span> =&gt;</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;/usr/share/logstash/logstash-core/lib/jars/mysql-connector-java-5.1.36.jar&#34;</span><br/>    jdbc_driver_class =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;com.mysql.jdbc.Driver&#34;</span><br/>    jdbc_paging_enabled =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;true&#34;</span><br/>    jdbc_connection_string =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;jdbc:mysql://10.10.10.6:3306/jumpserver&#34;</span><br/>    jdbc_user =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;root&#34;</span><br/>    jdbc_password =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;root&#34;</span><br/>    schedule =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;*/1 * * * *&#34;</span><br/>    statement =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;select id,user,asset,system_user,input,session,timestamp,org_id from terminal_command where FROM_UNIXTIME(timestamp) &gt;= SUBDATE(now(),interval 1 minute);&#34;</span><br/>    <span class="hljs-keyword" style="font-weight: bold;line-height: 26px;">type</span> =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;terminal_command&#34;</span><br/>  }<br/>}<br/>output {<br/>    <span class="hljs-keyword" style="font-weight: bold;line-height: 26px;">if</span> [<span class="hljs-keyword" style="font-weight: bold;line-height: 26px;">type</span>] == <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;terminal_session&#34;</span> {<br/>        elasticsearch {<br/>            <span class="hljs-function" style="line-height: 26px;"><span class="hljs-params" style="line-height: 26px;">hosts</span> =&gt;</span> [<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;10.10.10.9:9200&#34;</span>]<br/>            index =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;jumpserver-session-%{+YYYY.MM.dd}&#34;</span><br/>        }<br/>    }<br/>    <span class="hljs-keyword" style="font-weight: bold;line-height: 26px;">else</span> <span class="hljs-keyword" style="font-weight: bold;line-height: 26px;">if</span> [<span class="hljs-keyword" style="font-weight: bold;line-height: 26px;">type</span>] == <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;terminal_command&#34;</span> {<br/>        elasticsearch {<br/>            <span class="hljs-function" style="line-height: 26px;"><span class="hljs-params" style="line-height: 26px;">hosts</span> =&gt;</span> [<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;10.10.10.9:9200&#34;</span>]<br/>            index =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;jumpserver-command-%{+YYYY.MM.dd}&#34;</span><br/>        }<br/>    }<br/>}<br/></section></pre><h3 style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: #333333;">堡垒机日志展示</span></h3><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.42927515833919777" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1421" src="https://wechat2rss.xlab.app/img-proxy/?k=8e9990bf&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMd8Ma1GYaqGReaGLwibrRkERN2aYFqll9uDP4eliakwqu7ibot0pjrrAxtQ%2F640%3Fwx_fmt%3Dpng"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong style="color: rgb(68, 68, 68);">总结一下：</strong> 对于堡垒机或者其他网络运维设备的日志，我们更多时候是将日志统一到日志平台中，然后进行展开的深入分析，包括：</section><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">异常的登录时间、地址位置、用户信息；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">异常的操作行为等等；</section></li></ul><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">这些都将在后续的分析中慢慢放出来。</section><section style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="color: rgb(0, 0, 0);text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);font-size: 18px;letter-spacing: -2px;display: inline-block;"><span style="font-size: 20px;"><span style="color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;</span></span></section><section style="margin-left: 10px;font-size: 16px;text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);color: rgb(28, 89, 165);display: inline-block;"><p class="active brush" style="color: rgb(121, 121, 121);min-width: 1em;"><span style="font-size: 20px;">入侵检测系统日志</span></p></section></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">对于入侵检测系统，这里介绍两种开源的系统：Bro(Zeek)与Wazuh，前者在Elastic 7.x版本之后以SIEM形式提供支持，Wazuh自身可以与Elastic集成。所以这里也介绍两种入侵检测系统的日志收集处理展示方式：</section><h3 style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: #333333;">使用Elastic SIEM</span></h3><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">安装Bro网络入侵检测系统</section></li></ul><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 安装依赖</span><br/>yum install cmake.x86_64 gcc.x86_64 gcc-c++.x86_64 flex.x86_64 bison.x86_64 libpcap.x86_64 libpcap-devel.x86_64 openssl-devel.x86_64 python-devel.x86_64 swig.x86_64 zlib-devel.x86_64 -y<br/><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 配置yum源</span><br/>wget <a href="http://download.opensuse.org/repositories/network:bro/CentOS_7/network:bro.repo" target="_blank">http://download.opensuse.org/repositories/network:bro/CentOS_7/network:bro.repo</a> -O /etc/yum.repos.d/network:bro.repo<br/>yum install bro.x86_64 -y<br/><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 配置环境变量</span><br/><span class="hljs-built_in" style="color: #0086b3;line-height: 26px;">echo</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">&#39;export PATH=/opt/bro/bin:$PATH&#39;</span> &gt;&gt; /etc/profile<br/><span class="hljs-built_in" style="color: #0086b3;line-height: 26px;">source</span> /etc/profile<br/></section></pre><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">修改Bro的日志格式</section></li></ul><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;">vim /opt/bro/share/bro/site/local.bro<br/></section></pre><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"># 在文件末尾添加<br/><span class="hljs-meta" style="color: #999;font-weight: bold;line-height: 26px;">@load</span> tuning/json-logs<br/>redef LogAscii::json_timestamps = <span class="hljs-built_in" style="color: #0086b3;line-height: 26px;">JSON</span>::TS_ISO8601;<br/>redef LogAscii::use_json = T;<br/></section></pre><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.3568702290076336" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="2096" src="https://wechat2rss.xlab.app/img-proxy/?k=fbc10336&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMddYgrR0RiajrxhsALUbHvADooKEfW6ZxGVmYhMtDibgNfxKHzNMMib5Fag%2F640%3Fwx_fmt%3Dpng"/></figure><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">启动bro进行监控，启动前请修改配置文件(百度获取)</section></li></ul><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.3876843018213356" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1153" src="https://wechat2rss.xlab.app/img-proxy/?k=755fbbbe&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMdH31caak2hupybia5v0txqNqysCx2Ygqv6OfZ0xuN5micxia6tOmYRwAqA%2F640%3Fwx_fmt%3Dpng"/></figure><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">收集Bro日志到Elastic SIEM</section></li></ul><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 启动zeek模块，执行这里时需要将output.kafka注释，还原output.elasticsearch</span><br/>filebeat setup --pipelines --modules zeek<br/><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># 如果你已经执行初始化就不用重复执行了</span><br/>filebeat -e<br/><span class="hljs-comment" style="color: #998;font-style: italic;line-height: 26px;"># Filebeat的配置文件与收集系统日志一致，只需要修改logstash的配置文件的input中的topic内容</span><br/></section></pre><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;">input {<br/>    kafka {<br/>        <span class="hljs-function" style="line-height: 26px;"><span class="hljs-params" style="line-height: 26px;">bootstrap_servers</span> =&gt;</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;10.10.10.9:9092&#34;</span><br/>        topics =&gt; [<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;system-auth&#34;</span>,<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;system-syslog&#34;</span>,<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;auditd-log&#34;</span>,<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;zeek-connection&#34;</span>,<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;zeek-dns&#34;</span>,<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;zeek-http&#34;</span>,<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;zeek-files&#34;</span>]<br/>        codec =&gt; json<br/>    }<br/>}<br/># output内容不用变换，只需要替换条件即可<br/></section></pre><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.5728083209509658" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1346" src="https://wechat2rss.xlab.app/img-proxy/?k=ddab73e8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMdsK9Yd8X62f9tbXgLdhnqiadxibYyGTKPwW3ZPN4UfUJuBKtYxUVHnI3A%2F640%3Fwx_fmt%3Dpng"/></figure><h3 style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 18px;color: #333333;">使用Wazuh+Elastic</span></h3><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">关于Wazuh安装过程，我这里就不重复补充了，唯一说明一下是：<span style="color:red;">在Filebeat的新版本中(没有具体测试从哪个版本开始)不支持多个output，所以我们这里还是output到kafka再到ES中。</span></section><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">修改filebeat的配置文件：<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">vim /etc/filebeat/filebeat.yml</code></section></li></ul><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-string" style="color: #d14;line-height: 26px;">filebeat.modules:</span><br/><span class="hljs-attr" style="line-height: 26px;">  - module:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">wazuh</span><br/><span class="hljs-attr" style="line-height: 26px;">    alerts:</span><br/><span class="hljs-attr" style="line-height: 26px;">      enabled:</span> <span class="hljs-literal" style="color: #008080;line-height: 26px;">true</span><br/><span class="hljs-attr" style="line-height: 26px;">    archives:</span><br/><span class="hljs-attr" style="line-height: 26px;">      enabled:</span> <span class="hljs-literal" style="color: #008080;line-height: 26px;">false</span><br/><span class="hljs-string" style="color: #d14;line-height: 26px;">setup.template.json.enabled:</span> <span class="hljs-literal" style="color: #008080;line-height: 26px;">true</span><br/><span class="hljs-string" style="color: #d14;line-height: 26px;">setup.template.json.path:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">&#39;/etc/filebeat/wazuh-template.json&#39;</span><br/><span class="hljs-string" style="color: #d14;line-height: 26px;">setup.template.json.name:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">&#39;wazuh&#39;</span><br/><span class="hljs-string" style="color: #d14;line-height: 26px;">setup.template.overwrite:</span> <span class="hljs-literal" style="color: #008080;line-height: 26px;">true</span><br/><span class="hljs-string" style="color: #d14;line-height: 26px;">setup.ilm.enabled:</span> <span class="hljs-literal" style="color: #008080;line-height: 26px;">false</span><br/><span class="hljs-string" style="color: #d14;line-height: 26px;">output.kafka:</span><br/><span class="hljs-attr" style="line-height: 26px;">  hosts:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">[&#34;10.10.10.9:9092&#34;]</span><br/><span class="hljs-attr" style="line-height: 26px;">  topics:</span><br/><span class="hljs-attr" style="line-height: 26px;">    - topic:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">&#39;<span class="hljs-template-variable" style="color: #008080;line-height: 26px;">%{[service.type]}</span>-<span class="hljs-template-variable" style="color: #008080;line-height: 26px;">%{[fileset.name]}</span>&#39;</span><br/>      <span class="hljs-string" style="color: #d14;line-height: 26px;">when.has_fields:</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">[&#34;@metadata.pipeline&#34;]</span><br/></section></pre><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">修改logstash配置文件：<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">vim /etc/logstash/conf.d/wazuh.conf</code></section></li></ul><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;">input {<br/>    kafka {<br/>        <span class="hljs-function" style="line-height: 26px;"><span class="hljs-params" style="line-height: 26px;">bootstrap_servers</span> =&gt;</span> <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;10.10.10.9:9092&#34;</span><br/>        topics =&gt; [<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;wazuh-alert&#34;</span>]<br/>        codec =&gt; json<br/>    }<br/>}<br/>output {<br/>    <span class="hljs-keyword" style="font-weight: bold;line-height: 26px;">if</span> [<span class="hljs-meta" style="color: #999;font-weight: bold;line-height: 26px;">@metadata</span>][pipeline] and [<span class="hljs-meta" style="color: #999;font-weight: bold;line-height: 26px;">@metadata</span>][topic] == <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;auditd-log&#34;</span> {<br/>        elasticsearch {<br/>            <span class="hljs-function" style="line-height: 26px;"><span class="hljs-params" style="line-height: 26px;">hosts</span> =&gt;</span> [<span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;10.10.10.9:9200&#34;</span>]<br/>            index =&gt; <span class="hljs-string" style="color: #d14;line-height: 26px;">&#34;wazuh-alerts-3.x-%{+YYYY.MM.dd}&#34;</span><br/>        }<br/>    }<br/>}<br/></section></pre><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong style="color: rgb(68, 68, 68);">总结一下：</strong> 对于入侵检测与防护系统、WAF、防火墙等安全设备的日志，我们更多是收集日志做展示，需要基础的分析，因为日志自身本就是经过分析的，我们需要做的是对这些日志进行深入挖掘。</section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">在本篇的平台实现就先到这里了，大致体现了几种不同类型的：<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">收集方式 --&gt; 存储 --&gt; 展示</code> 。因为篇幅原因不想写的太冗长影响阅读。后续还会有一些番外传：</section><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">利用大数据处理日志信息；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">基于Elastic的监控报警系统；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">统一日志分析平台的安全性；</section></li></ul><section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" style="margin-right: auto;margin-left: auto;caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;border-width: 0px;border-style: none;border-color: initial;width: 574px;opacity: 1;transform: rotateZ(0deg);"><section style="width: 574px;text-align: center;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="margin-top: 10px;display: inline-block;width: auto;"><section style="display: -webkit-flex;justify-content: center;"><section style="margin-top: 8px;margin-right: -30px;width: 45px;"><section style="width: 58px;"><img data-w="70" title="" class="" data-ratio="0.5714285714285714" src="https://wechat2rss.xlab.app/img-proxy/?k=36a6308f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarsp6wbKDYd4qxib2QHqtT18Nic5AmjBMzOcjy8bRauPMsLXiaBuBO1GqlHHg%2F640"/></section></section><section style="padding-right: 16px;padding-left: 16px;line-height: 22px;letter-spacing: 2px;"><p class="title active" style="color: rgb(63, 62, 63);font-size: 16px;min-width: 1px;"><span style="font-size: 22px;">踩坑记录</span></p></section><section style="margin-top: -11px;margin-left: -30px;width: 35px;"><section style="width: 30px;"><img style="width: 30px;display: block;vertical-align: top;" class="" data-ratio="0.625" data-w="40" src="https://wechat2rss.xlab.app/img-proxy/?k=99a3bd6d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspeahQl4dC745C0AQblUiaZWq1tVYWXxoEbgtzn7BskoD56sWSiczWsOdQ%2F640"/></section></section></section></section></section></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">对于踩坑，最好的帮助就是多搜索，多看看官方的说明文档，所有的问题都会迎刃而解。<br/></section><h2 style="font-weight: bold;font-size: 24px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 20px;font-weight: normal;color: #222222;">0x01 Filebeat output.kafka无法输出数据</span></h2><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">必须在filebeat的客户端机器上配置域名解析：<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">vim /etc/hosts</code></section><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"><span class="hljs-number" style="color: #008080;line-height: 26px;">10.10</span><span class="hljs-number" style="color: #008080;line-height: 26px;">.10</span><span class="hljs-number" style="color: #008080;line-height: 26px;">.9</span>      big_data<br/></section></pre><h2 style="font-weight: bold;font-size: 24px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 20px;font-weight: normal;color: #222222;">0x02 Logstash解析系统日志失败</span></h2><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">如果大家使用Logstash自带的解析规则，在某些情况下会出现解析系统日志失败的情况，原因是因为：<span style="color:red;">系统主机名包含下划线时会解析失败</span>，我们来看一下Logstash中关于主机名部分的解析规则：<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">vim /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-patterns-core-4.1.2/patterns/grok-patterns</code></section><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.08045052292839903" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1243" src="https://wechat2rss.xlab.app/img-proxy/?k=a34c32a0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMd03Bqhg37bIUH2TLQ1GNiaKgEa0Z18iaqzQdP9I1WFm6ykBVQeTpTpTTA%2F640%3Fwx_fmt%3Dpng"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">此时的配置在出现下划线时就不能被正确解析</section><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.6191974822974036" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1271" src="https://wechat2rss.xlab.app/img-proxy/?k=4110d1d1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMdiaS48t3DNbuygloE5BPxeZZUPeJr0b30DVDuZ3ibyjB5UAFTYpzhmNVw%2F640%3Fwx_fmt%3Dpng"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">所以如果我们要使用，需要修改成如下图所示</section><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;"># 将 HOSTNAME \b(?:[<span class="hljs-number" style="color: #008080;line-height: 26px;">0</span><span class="hljs-number" style="color: #008080;line-height: 26px;">-9</span>A-Za-z][<span class="hljs-number" style="color: #008080;line-height: 26px;">0</span><span class="hljs-number" style="color: #008080;line-height: 26px;">-9</span>A-Za-z-]{<span class="hljs-number" style="color: #008080;line-height: 26px;">0</span>,<span class="hljs-number" style="color: #008080;line-height: 26px;">62</span>})(?:\.(?:[<span class="hljs-number" style="color: #008080;line-height: 26px;">0</span><span class="hljs-number" style="color: #008080;line-height: 26px;">-9</span>A-Za-z][<span class="hljs-number" style="color: #008080;line-height: 26px;">0</span><span class="hljs-number" style="color: #008080;line-height: 26px;">-9</span>A-Za-z-]{<span class="hljs-number" style="color: #008080;line-height: 26px;">0</span>,<span class="hljs-number" style="color: #008080;line-height: 26px;">62</span>}))*(\.?|\b) 修改为<br/>HOSTNAME \b(?:[<span class="hljs-number" style="color: #008080;line-height: 26px;">0</span><span class="hljs-number" style="color: #008080;line-height: 26px;">-9</span>A-Za-z][<span class="hljs-number" style="color: #008080;line-height: 26px;">0</span><span class="hljs-number" style="color: #008080;line-height: 26px;">-9</span>A-Za-z_-]{<span class="hljs-number" style="color: #008080;line-height: 26px;">0</span>,<span class="hljs-number" style="color: #008080;line-height: 26px;">62</span>})(?:\.(?:[<span class="hljs-number" style="color: #008080;line-height: 26px;">0</span><span class="hljs-number" style="color: #008080;line-height: 26px;">-9</span>A-Za-z][<span class="hljs-number" style="color: #008080;line-height: 26px;">0</span><span class="hljs-number" style="color: #008080;line-height: 26px;">-9</span>A-Za-z_-]{<span class="hljs-number" style="color: #008080;line-height: 26px;">0</span>,<span class="hljs-number" style="color: #008080;line-height: 26px;">62</span>}))*(\.?|\b) # 注意看两者多了两个下划线<br/></section></pre><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color:red;"><strong style="color: rgb(68, 68, 68);">如果使用Filebeat的模块，也会出现这个问题。</strong></span></section><h2 style="font-weight: bold;font-size: 24px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 20px;font-weight: normal;color: #222222;">0x03 Logstash使用jdbc input</span></h2><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;">/usr/share/logstash/bin/logstash-plugin install logstash-input-jdbc<br/>wget <a href="https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.36/mysql-connector-java-5.1.36.jar" target="_blank">https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.36/mysql-connector-java-5.1.36.jar</a> -O /usr/share/logstash/logstash-core/lib/jars/mysql-connector-java-5.1.36.jar<br/>chown logstash:logstash /usr/share/logstash/logstash-core/lib/jars/mysql-connector-java-5.1.36.jar<br/>chmod 644 /usr/share/logstash/logstash-core/lib/jars/mysql-connector-java-5.1.36.jar<br/></section></pre><h2 style="font-weight: bold;font-size: 24px;margin-top: 6px;margin-bottom: 4px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 20px;font-weight: normal;color: #222222;">0x04 Kibana无法加载Wazuh-API配置页面</span></h2><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">错误图：</section><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.5148443157132513" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="2762" src="https://wechat2rss.xlab.app/img-proxy/?k=59f776bb&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMdLia5EGnTSX6aRCnLesKns9TlXEQzgUtjzajIJcQz082epaGC9Mia9U5Q%2F640%3Fwx_fmt%3Dpng"/></figure><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong style="color: rgb(68, 68, 68);">原因分析：对比了官方的安装文档，如果在安装Kibana的插件时，使用root用户，那么就会报错。是因为使用root用户安装插件导致插件中的版本文件丢失。</strong></section><section style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">解决方案：</section><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><section style="overflow-x: auto;padding: 16px;color: rgb(51, 51, 51);background: rgb(248, 248, 248);border-radius: 0px;font-size: 14px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;display: -webkit-box !important;">sudo -u kibana /usr/share/kibana/bin/kibana-plugin install <a href="https://packages.wazuh.com/wazuhapp/wazuhapp-3.10.2_7.4.1.zip" target="_blank">https://packages.wazuh.com/wazuhapp/wazuhapp-3.10.2_7.4.1.zip</a><span style="font-size: 15px;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;letter-spacing: 0px;"></span></section></pre><section style="color: rgb(240, 84, 84);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;text-align: center;"><strong style="max-width: 100%;color: rgb(62, 62, 62);font-size: 16px;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;line-height: 1.75em;font-size: 15px;color: rgb(171, 25, 66);box-sizing: border-box !important;word-wrap: break-word !important;" class=""><strong style="max-width: 100%;color: rgb(62, 62, 62);font-size: 16px;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 1.75em;color: rgb(63, 63, 63);font-size: 14px;letter-spacing: 0px;text-align: justify;box-sizing: border-box !important;overflow-wrap: break-word !important;"> </span></strong><span style="color: rgb(63, 63, 63);font-size: 14px;letter-spacing: 0px;text-align: justify;"><strong style="text-align: center;max-width: 100%;color: rgb(62, 62, 62);font-size: 16px;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 1.75em;font-size: 15px;color: rgb(171, 25, 66);box-sizing: border-box !important;word-wrap: break-word !important;"><img class="__bg_gif" data-ratio="1" style="box-sizing: border-box !important;overflow-wrap: break-word !important;visibility: visible !important;width: auto !important;" data-type="gif" data-w="55" src="https://wechat2rss.xlab.app/img-proxy/?k=b3c348d4&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_gif%2FrbP97vC6miakOiaicmPOoU7j2xkOkBdePMddibz2bFmcjmIvwS7Ooc9OspLhM1c5YY88fzolLD4iaLCAdiaqvDJHKyfQ%2F640%3Fwx_fmt%3Dgif"/></span></strong></span></span></strong></section></section></section><section class="xmt-style-block" data-style-type="5" data-tools="新媒体排版" data-id="2848936"><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 14px;letter-spacing: 3px;color:#000;"><strong>- 参考资料 -</strong></span></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: rgb(136, 136, 136);text-decoration: underline;line-height: 1.6;font-size: 14px;letter-spacing: 3px;">《Apache流框架Flink、Spark Streaming、Storm对比分析》：<a href="https://bigdata.163yun.com/product/article/5" target="_blank">https://bigdata.163yun.com/product/article/5</a></span></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="color: rgb(136, 136, 136);text-decoration: underline;line-height: 1.6;font-size: 14px;letter-spacing: 3px;">《Difference Between Apache Kafka and Flume》<span style="color: rgb(136, 136, 136);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 14px;letter-spacing: 3px;text-align: center;text-decoration: underline;">：<a href="https://www.educba.com/apache-kafka-vs-flume/" target="_blank">https://www.educba.com/apache-kafka-vs-flume/</a></span></span></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="line-height: 1.6;color: rgb(136, 136, 136);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 14px;letter-spacing: 3px;text-align: center;text-decoration: underline;">《Flume、Logstash、Filebeat调研报告》：<a href="https://www.twblogs.net/a/5d24244bbd9eee1ede06988b/zh-cn" target="_blank">https://www.twblogs.net/a/5d24244bbd9eee1ede06988b/zh-cn</a></span></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="line-height: 1.6;color: rgb(136, 136, 136);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 14px;letter-spacing: 3px;text-align: center;text-decoration: underline;">《Log Monitoring and Analysis: Comparing ELK, Splunk and Graylog》：<a href="https://devops.com/log-monitoring-and-analysis-comparing-elk-splunk-and-graylog/" target="_blank">https://devops.com/log-monitoring-and-analysis-comparing-elk-splunk-and-graylog/</a></span></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="line-height: 1.6;color: rgb(136, 136, 136);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 14px;letter-spacing: 3px;text-align: center;text-decoration: underline;">《System Properties Comparison ElasticSearch vs. HBase vs. Hive》：<a href="https://db-engines.com/en/system/Elasticsearch%3BHBase%3BHive" target="_blank">https://db-engines.com/en/system/Elasticsearch%3BHBase%3BHive</a></span></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="line-height: 1.6;color: rgb(136, 136, 136);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 14px;letter-spacing: 3px;text-align: center;text-decoration: underline;"><span style="color: rgb(136, 136, 136);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 14px;letter-spacing: 3px;text-align: center;text-decoration: underline;">《多种日志收集工具比较》：</span></span></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="line-height: 1.6;color: rgb(136, 136, 136);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 14px;letter-spacing: 3px;text-align: center;text-decoration: underline;"><a href="https://www.cnblogs.com/wzj4858/p/8252730.html" target="_blank">https://www.cnblogs.com/wzj4858/p/8252730.html</a></span></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="line-height: 1.6;color: rgb(136, 136, 136);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 14px;letter-spacing: 3px;text-align: center;text-decoration: underline;"><span style="color: rgb(136, 136, 136);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 14px;letter-spacing: 3px;text-align: center;text-decoration: underline;">《详解日志采集工具--Logstash、Filebeat、Fluentd、Logagent对比》：</span></span></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="line-height: 1.6;color: rgb(136, 136, 136);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 14px;letter-spacing: 3px;text-align: center;text-decoration: underline;"><a href="https://juejin.im/post/5cc121abf265da036b4a683f" target="_blank">https://juejin.im/post/5cc121abf265da036b4a683f</a></span></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><br/></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="font-size: 14px;letter-spacing: 3px;color:#000;"><strong>- HISTORY -</strong></span></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483849&amp;idx=1&amp;sn=cdb1bbe88e24156df44b12f531c48456&amp;chksm=fc981509cbef9c1f499f03b9d520c1e48057829fbafa34c7b54674cc61d2ae3b33c526aa80af&amp;scene=21#wechat_redirect" textvalue="《日志分析系列(一)：方法论》" data-itemshowtype="0" tab="innerlink" data-linktype="2"><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;letter-spacing: 3px;">《日志分析系列(一)：介绍篇》</span></a></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483806&amp;idx=1&amp;sn=dbd9264bc3fece3bcaa92f18c2dd0bd4&amp;chksm=fc98155ecbef9c48529617523d1bdc2e85bc26ea24ef2b340f59218f0b9713357067a098ce33&amp;scene=21#wechat_redirect" textvalue="《日志分析系列(外传一)：Nginx透过代理获取真实客户端IP》" data-itemshowtype="0" tab="innerlink" data-linktype="2"><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">《日志分析系列(外传一)：Nginx透过代理获取真实客户端IP》</span></a></section><section style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483868&amp;idx=1&amp;sn=c66ce6cf610faf3f10b5bf0011d5386d&amp;chksm=fc98151ccbef9c0aa7b2d3608330cc8091fc7a27a264d9a8ffb5baf827e22f870244654dae0c&amp;scene=21#wechat_redirect" textvalue="《日志分析系列(外传二)：Nginx日志统一化》" data-itemshowtype="0" tab="innerlink" data-linktype="2"><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">《日志分析系列(外传二)：Nginx日志统一化》</span></a></section></section>



<p><a href="https://zhuanlan.zhihu.com/p/101154203">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=cdbf37a2&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483869%26idx%3D1%26sn%3D5b43cdc88622a39b9f3eddf930d653cc%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 06 Jan 2020 08:15:00 +0800</pubDate>
    </item>
    <item>
      <title>日志分析系列(外传二):Nginx日志统一化</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483868&amp;idx=1&amp;sn=c66ce6cf610faf3f10b5bf0011d5386d</link>
      <description>本系列中的故事纯属虚构，如有雷同实属巧合</description>
      <content:encoded><![CDATA[<p>
原创 <span>bloodzer0</span> <span>2019-12-30 09:00</span> <span style="display: inline-block;"></span>
</p>

<p>本系列中的故事纯属虚构，如有雷同实属巧合</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=af69239a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miam3gxp3NYKg8FN0ogeKMJttYZKLfiaW2hsMWLAFDBqhbSKqPwpx4VlbyibPJoHC1rHbE7BgJWSPXkFw%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section class="xmteditor" style="display:none;" data-tools="新媒体管家" data-label="powered by xmt.cn" data-mpa-powered-by="yiban.io"></section><section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="font-size: 16px;color: black;padding: 10px;line-height: 1.6;letter-spacing: 0px;word-break: break-word;overflow-wrap: break-word;text-align: left;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;"><section class="xmt-style-block" data-style-type="5" data-tools="新媒体排版" data-id="2848981"><section class="KolEditor" style="border-width: 0px;border-style: none;border-color: initial;padding: 0px;margin-top: 20px;"><section style="border-width: 0px;border-style: none;border-color: initial;"><section style="text-align: center;white-space: normal;"><p style="color:#f05454;" class="active brush"><span style="font-size: 15px;">本系列故事纯属虚构，如有雷同纯属巧合</span></p></section><p style="text-align: center;white-space: normal;"><img class="" data-ratio="0.05555555555555555" data-w="180" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=e0d9a6af&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarsppBO6jHnOiaic1Z3WRe9ox32m4GxytWxF9gZHKwnT8icd66soVibea5Wpgw%2F640%3Fwx_fmt%3Dpng"/></p></section></section></section><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;"><span style="letter-spacing: 0px;">为了完成对Nginx服务器的日志分析，小B对Q公司的Nginx日志做了统一化要求。</span><span style="letter-spacing: 0px;">下面是小B在统一化过程中遇到的一些知识点：</span></p><section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" style="margin-right: auto;margin-left: auto;border-width: 0px;border-style: none;border-color: initial;width: 574px;opacity: 1;transform: rotateZ(0deg);"><section style="width: 574px;text-align: center;"><section style="margin-top: 10px;display: inline-block;width: auto;"><section style="display: -webkit-flex;justify-content: center;"><section style="margin-top: 8px;margin-right: -30px;width: 45px;"><section style="width: 58px;"><img data-w="70" title="" class="" data-ratio="0.5714285714285714" src="https://wechat2rss.xlab.app/img-proxy/?k=36a6308f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarsp6wbKDYd4qxib2QHqtT18Nic5AmjBMzOcjy8bRauPMsLXiaBuBO1GqlHHg%2F640"/></section></section><section style="padding-right: 16px;padding-left: 16px;line-height: 22px;letter-spacing: 2px;"><p class="title active" style="color: rgb(63, 62, 63);font-size: 16px;min-width: 1px;"><span style="font-size: 22px;">Nginx日志与字段解析</span></p></section><section style="margin-top: -11px;margin-left: -30px;width: 35px;"><section style="width: 30px;"><img style="width: 30px;display: block;vertical-align: top;" class="" data-ratio="0.625" data-w="40" src="https://wechat2rss.xlab.app/img-proxy/?k=99a3bd6d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspeahQl4dC745C0AQblUiaZWq1tVYWXxoEbgtzn7BskoD56sWSiczWsOdQ%2F640"/></section></section></section></section></section></section><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">Q公司的Nginx版本信息是：1.17.6，使用编译安装，安装过程如下：</p><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer">yum install zlib-devel.x86_64 zlib.x86_64 openssl.x86_64 openssl-devel.x86_64 pcre-devel.x86_64 -y</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 安装lua支持，后续的response_body需要</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 这里有坑，解决方案见最后</span></span></code><code><span class="code-snippet_outer">wget <a href="http://luajit.org/download/LuaJIT-2.0.5.tar.gz" target="_blank">http://luajit.org/download/LuaJIT-2.0.5.tar.gz</a></span></code><code><span class="code-snippet_outer">tar -xf LuaJIT-2.0.5.tar.gz -C /opt/ &amp;&amp; <span class="code-snippet__built_in">cd</span> /opt/LuaJIT-2.0.5/</span></code><code><span class="code-snippet_outer">make install PREFIX=/usr/<span class="code-snippet__built_in">local</span>/luajit</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__built_in">echo</span> <span class="code-snippet__string">&#39;export LUAJIT_LIB=/usr/local/luajit/lib&#39;</span> &gt;&gt; /etc/profile</span></code><code><span class="code-snippet_outer"><span class="code-snippet__built_in">echo</span> <span class="code-snippet__string">&#39;export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0&#39;</span> &gt;&gt; /etc/profile</span></code><code><span class="code-snippet_outer"><span class="code-snippet__built_in">source</span> /etc/profile</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 下载ngx_devel_kit</span></span></code><code><span class="code-snippet_outer">wget <a href="https://github.com/simpl/ngx_devel_kit/archive/v0.3.1.tar.gz" target="_blank">https://github.com/simpl/ngx_devel_kit/archive/v0.3.1.tar.gz</a></span></code><code><span class="code-snippet_outer">tar -xf v0.3.1.tar.gz -C /opt/</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 下载lua-nginx-module</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 这里有坑，解决方案见最后</span></span></code><code><span class="code-snippet_outer">wget <a href="https://github.com/openresty/lua-nginx-module/archive/v0.10.15.tar.gz" target="_blank">https://github.com/openresty/lua-nginx-module/archive/v0.10.15.tar.gz</a></span></code><code><span class="code-snippet_outer">tar -xf v0.10.15.tar.gz -C /opt/</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 下载nginx</span></span></code><code><span class="code-snippet_outer">wget <a href="https://nginx.org/download/nginx-1.17.6.tar.gz" target="_blank">https://nginx.org/download/nginx-1.17.6.tar.gz</a></span></code><code><span class="code-snippet_outer">tar -xf nginx-1.17.6.tar.gz &amp;&amp; <span class="code-snippet__built_in">cd</span> nginx-1.17.6/</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 安装nginx</span></span></code><code><span class="code-snippet_outer">./configure --prefix=/opt/nginx --with-http_realip_module --with-http_ssl_module --with-pcre --with-ld-opt=-Wl,-rpath,/usr/<span class="code-snippet__built_in">local</span>/luajit/lib --add-module=/opt/lua-nginx-module-0.10.15 --add-module=/opt/ngx_devel_kit-0.3.1</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">make -j2 &amp;&amp; make install</span></code></pre></section><ul data-tool="mdnice编辑器" style="list-style-type: circle;margin-left: -20px;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;text-align: left;">Nginx原始日志格式：<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">vim /opt/nginx/conf/nginx.conf</code></section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">    log_format  main  <span class="code-snippet__string">&#39;$remote_addr - $remote_user [$time_local] &#34;$request&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;$status $body_bytes_sent &#34;$http_referer&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;&#34;$http_user_agent&#34; &#34;$http_x_forwarded_for&#34;&#39;</span>;</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    access_log  logs/access.log  main;</span></code></pre></section><ul data-tool="mdnice编辑器" style="list-style-type: circle;margin-left: -20px;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;text-align: left;">原始Nginx的日志为：<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">tail -n 1 -f /opt/nginx/logs/access.log</code></section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.1 - - [18/Dec/2019:13:27:27 +0800] &#34;GET / HTTP/1.1&#34; 200 612 &#34;-&#34; &#34;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36&#34; &#34;-&#34;</span></code></pre></section><section style="margin-right: auto;margin-left: auto;width: 574px;opacity: 1;transform: rotateZ(0deg);text-align: left;text-indent: 0em;"><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: bold;"></span><span style="color: rgb(51, 51, 51);font-size: 15px;letter-spacing: 0px;"><span style="font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;text-align: left;font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: bold;"></span></span></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;text-align: left;white-space: normal;"><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;  </span><span style="font-size: 20px;color: rgb(121, 121, 121);letter-spacing: 0px;">Nginx日志字段解析</span></figure><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;text-align: left;white-space: normal;"><span style="color: rgb(51, 51, 51);letter-spacing: 0px;text-indent: 0em;font-size: 15px;">首先小B需要弄明白Nginx日志中每个字段的含义：</span></figure><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.8637083993660856" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1262" src="https://wechat2rss.xlab.app/img-proxy/?k=b2c3e83b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspT6RsBtU6R1ubS21lHMKqWDl2seHtPvNlvQKiaekqtXbWKLFqs7QG1Pw%2F640%3Fwx_fmt%3Dpng"/></figure><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;text-align: left;"><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;  </span><span style="font-size: 20px;color: rgb(121, 121, 121);letter-spacing: 0px;">Nginx获取body信息</span></figure><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">在Q公司目前的架构中，使用GET传递参数的方式已经很少了，为了了解攻击者是否在body中嵌入攻击payload以及了解攻击者获取到了什么结果，小B需要采集body的日志信息。</p><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;text-align: left;"><span style="font-size: 18px;color: #333333;">打印request_body</span></h3><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">打印request_body有两种方式：一种是使用nginx的模块；另外一种是使用lua编写脚本，如果需要限制nginx收集request_body的长度，最好使用后者。</p><ul data-tool="mdnice编辑器" style="list-style-type: circle;margin-left: -20px;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;text-align: left;">使用nginx ngx_http_core模块采集request_body</section></li></ul><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">ngx_http_core模块官网地址 <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html" target="_blank">http://nginx.org/en/docs/http/ngx_http_core_module.html</a> 中有一段关于采集request_body的说明，内容如下：</p><blockquote data-tool="mdnice编辑器" style="font-size: 0.9em;overflow: auto;color: rgb(106, 115, 125);padding: 10px 10px 10px 20px;margin-bottom: 20px;margin-top: 20px;border-left-color: rgb(235, 152, 78);background: rgb(253, 245, 231);"><p style="padding-top: 8px;padding-bottom: 8px;font-size: 15px;color: black;line-height: 26px;text-align: left;">The variable’s value is made available in locations processed by the proxy_pass, fastcgi_pass, uwsgi_pass, and scgi_pass directives when the request body was read to a memory buffer.</p></blockquote><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 首先修改配置文件，我这里采集的日志只有request_body字段</span></span></code><code><span class="code-snippet_outer">vim /opt/nginx/conf/nginx.conf</span></code></pre></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">    log_format  main    $request_body;</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    access_log  logs/access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        location / {</span></code><code><span class="code-snippet_outer">            root   /opt/nginx/html;</span></code><code><span class="code-snippet_outer">            # 以下为添加内容</span></code><code><span class="code-snippet_outer">            fastcgi_pass <span class="code-snippet__number">127.0</span><span class="code-snippet__number">.0</span><span class="code-snippet__number">.1</span>:<span class="code-snippet__number">9000</span>;</span></code><code><span class="code-snippet_outer">            fastcgi_index index.php;</span></code><code><span class="code-snippet_outer">            fastcgi_param SCRIPT_FILENAME       $document_root$fastcgi_script_name;</span></code><code><span class="code-snippet_outer">            include fastcgi_params;</span></code><code><span class="code-snippet_outer">        }</span></code></pre></section><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">此时Nginx的日志为：</p><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.20689655172413793" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="870" src="https://wechat2rss.xlab.app/img-proxy/?k=8e0fa534&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspYtcLialB6MDC0vlOH0A7ict9qnPt9CiaaZgRDmBQ2FDDQ9EugCZPYBdHA%2F640%3Fwx_fmt%3Dpng"/></figure><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">使用<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">ngx_http_core</code>模块收集日志有没有办法限制request_body的长度呢？其实是有的。</p><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">在nginx配置文件中的<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">http{}</code>里面添加<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">client_max_body_size 1k;</code>即可。</p><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.5436013590033975" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1766" src="https://wechat2rss.xlab.app/img-proxy/?k=0fa6db21&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspZmjiaDJeBcSb4rUoxywJqyDKq7q3rqcN5QoQ7hj47f0EpVIxMbavACw%2F640%3Fwx_fmt%3Dpng"/></figure><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">但是这个配置是不允许用户上传超过1K大小的body内容，如果用户需要上传图片，业务可能就无法正常运行，所以不推荐使用此种方法。</p><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">我们在这里测试一下<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">ngx_http_core</code>的内容限制：</p><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 我这里使用1024个A来测试，我的配置是否有效</span></span></code><code><span class="code-snippet_outer">curl -XPOST <span class="code-snippet__string">&#34;<a href="http://10.10.10.13/test.php?id=123" target="_blank">http://10.10.10.13/test.php?id=123</a>&#34;</span> -H <span class="code-snippet__string">&#34;X-Forwarded-For: 10.10.10.5&#34;</span> -H <span class="code-snippet__string">&#34;Referer: <a href="http://10.10.10.13" target="_blank">http://10.10.10.13</a>&#34;</span> --data <span class="code-snippet__string">&#34;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&#34;</span></span></code></pre></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.23093371347113328" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="2806" src="https://wechat2rss.xlab.app/img-proxy/?k=0d5bda28&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspJiaGIR2bicAgRksdOecXv0rkBdNiaicDbck46Eo5b0XkOaQsaUNXAic15vg%2F640%3Fwx_fmt%3Dpng"/></figure><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">此时Nginx正常打印出了request_body。</p><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 如果我们超过1024个字节，就会报错，注意1024个A后面有一个1</span></span></code><code><span class="code-snippet_outer">curl -XPOST <span class="code-snippet__string">&#34;<a href="http://10.10.10.13/test.php?id=123" target="_blank">http://10.10.10.13/test.php?id=123</a>&#34;</span> -H <span class="code-snippet__string">&#34;X-Forwarded-For: 10.10.10.5&#34;</span> -H <span class="code-snippet__string">&#34;Referer: <a href="http://10.10.10.13" target="_blank">http://10.10.10.13</a>&#34;</span> --data <span class="code-snippet__string">&#34;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1&#34;</span></span></code></pre></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.2795216741405082" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1338" src="https://wechat2rss.xlab.app/img-proxy/?k=0669f8f9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarsptzuibPOEojv6WjZKJB9ia4uM7wHDEBRgT2icJfYeDn83N1A6qyYKXftuA%2F640%3Fwx_fmt%3Dpng"/></figure><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">此时Nginx无法打印request_body。</p><ul data-tool="mdnice编辑器" style="list-style-type: circle;margin-left: -20px;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;text-align: left;">使用lua编写脚本采集request_body</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 修改nginx的配置文件</span></span></code><code><span class="code-snippet_outer">vim /opt/nginx/conf/nginx.conf</span></code></pre></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    log_format  main    $request_body_head;</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    access_log  logs/access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        location / {</span></code><code><span class="code-snippet_outer">            root   /opt/nginx/html;</span></code><code><span class="code-snippet_outer">            # 以下为添加内容</span></code><code><span class="code-snippet_outer">            <span class="code-snippet__keyword">set</span> $request_body_head      <span class="code-snippet__string">&#34;&#34;</span>;</span></code><code><span class="code-snippet_outer">            content_by_lua_block {</span></code><code><span class="code-snippet_outer">                ngx.req.read_body()</span></code><code><span class="code-snippet_outer">                local   req_body = ngx.req.get_body_data()</span></code><code><span class="code-snippet_outer">                # 这里的<span class="code-snippet__number">1000</span>代表我们截取request_body的长度，不要取的太长，否则容易导致日志过大</span></code><code><span class="code-snippet_outer">                ngx.var.request_body_head =  req_body:sub(<span class="code-snippet__number">1</span>,<span class="code-snippet__number">1000</span>)</span></code><code><span class="code-snippet_outer">            }</span></code><code><span class="code-snippet_outer">        }</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code></pre></section><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">此时Nginx的日志为：</p><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.20689655172413793" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="870" src="https://wechat2rss.xlab.app/img-proxy/?k=8e0fa534&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspYtcLialB6MDC0vlOH0A7ict9qnPt9CiaaZgRDmBQ2FDDQ9EugCZPYBdHA%2F640%3Fwx_fmt%3Dpng"/></figure><h3 data-tool="mdnice编辑器" style="font-weight: bold;font-size: 20px;margin-top: 6px;margin-bottom: 4px;text-align: left;"><span style="font-size: 18px;color: #333333;">打印response_body</span></h3><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">对于response_body我们只有使用lua编写脚本来采集。</p><ul data-tool="mdnice编辑器" style="list-style-type: circle;margin-left: -20px;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;text-align: left;">修改nginx的配置：<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">vim /opt/nginx/conf/nginx.conf</code></section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">    server {</span></code><code><span class="code-snippet_outer">        listen       <span class="code-snippet__number">80</span>;</span></code><code><span class="code-snippet_outer">        server_name  localhost;</span></code><code><span class="code-snippet_outer">        # 以下为添加内容</span></code><code><span class="code-snippet_outer">        lua_need_request_body   on;</span></code><code><span class="code-snippet_outer">        <span class="code-snippet__keyword">set</span> $response_body      <span class="code-snippet__string">&#34;&#34;</span>;</span></code><code><span class="code-snippet_outer">        body_filter_by_lua      <span class="code-snippet__string">&#39;</span></span></code><code><span class="code-snippet_outer">            # 这里的1000就代表截取response_body的长度，不要取的太长，否则容易导致日志过大</span></code><code><span class="code-snippet_outer">            local       response_body = string.sub(ngx.arg[1],1,1000)</span></code><code><span class="code-snippet_outer">            ngx.ctx.buffered =  (ngx.ctx.buffered or &#34;&#34;)        ..      response_body</span></code><code><span class="code-snippet_outer">            if ngx.arg[2] then</span></code><code><span class="code-snippet_outer">                ngx.var.response_body = ngx.ctx.buffered</span></code><code><span class="code-snippet_outer">            end</span></code><code><span class="code-snippet_outer"><span class="code-snippet_outer">            &#39;</span>;</span></code><code><span class="code-snippet_outer">    }</span></code></pre></section><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">此时Nginx的日志为：</p><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.18285714285714286" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="2800" src="https://wechat2rss.xlab.app/img-proxy/?k=ee547ada&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspnRjqvJANNibbdbbqbLUTUkS2G2a1nzvI1rNjahicM59WfJPEZZ40rTdg%2F640%3Fwx_fmt%3Dpng"/></figure><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;"><strong style="color: rgb(68, 68, 68);">request_body与response_body如果在上传文件或者下载文件时，内容会很大，采集全部内容需要考虑对系统、Nginx性能和日志存储等方面的影响。如果采集的body内容太短，也会导致采取不到我们想要的信息，所以根据业务取一个合理阈值。</strong></p><section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" style="margin-right: auto;margin-left: auto;width: 574px;opacity: 1;transform: rotateZ(0deg);text-align: left;"><span style="font-size: 20px;color: rgb(121, 121, 121);letter-spacing: 0px;"></span></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;text-align: left;white-space: normal;"><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;  </span><span style="font-size: 20px;color: rgb(121, 121, 121);letter-spacing: 0px;">nginx--&gt;syslog--&gt;logstash</span></figure><p><span style="color: rgb(51, 51, 51);font-size: 15px;letter-spacing: 0px;">小B在测试中与朋友交流得知，可以将nginx日志直接传输到logstash中而不落盘，但是这种方法传输的日志不可靠，并且会对nginx产生性能影响，可以在测试的时候使用。</span><br/></p><ul data-tool="mdnice编辑器" style="list-style-type: circle;margin-left: -20px;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;text-align: left;">nginx配置文件：<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">vim /opt/nginx/conf/nginx.conf</code></section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">    log_format  logstash  <span class="code-snippet__string">&#39;$remote_addr - $remote_user [$time_local] &#34;$request&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                          <span class="code-snippet__string">&#39;$status $body_bytes_sent &#34;$http_referer&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                          <span class="code-snippet__string">&#39;&#34;$http_user_agent&#34; &#34;$http_x_forwarded_for&#34;&#39;</span>;</span></code><code><span class="code-snippet_outer">    # access_log  logs/access.log  main;</span></code><code><span class="code-snippet_outer">    access_log  syslog:server=<span class="code-snippet__number">127.0</span><span class="code-snippet__number">.0</span><span class="code-snippet__number">.1</span>:<span class="code-snippet__number">514</span>,nohostname,tag=nginx_access logstash;</span></code></pre></section><ul data-tool="mdnice编辑器" style="list-style-type: circle;margin-left: -20px;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;text-align: left;">logstash配置文件：<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">vim /etc/logstash/conf.d/nginx.conf</code></section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">input {</span></code><code><span class="code-snippet_outer">    udp {</span></code><code><span class="code-snippet_outer">        <span class="code-snippet__function"><span class="code-snippet__params">host</span> =&gt;</span> <span class="code-snippet__string">&#34;127.0.0.1&#34;</span></span></code><code><span class="code-snippet_outer">        port =&gt; <span class="code-snippet__number">514</span></span></code><code><span class="code-snippet_outer">    }</span></code><code><span class="code-snippet_outer">}</span></code><code><span class="code-snippet_outer">output {</span></code><code><span class="code-snippet_outer">    stdout {}</span></code><code><span class="code-snippet_outer">}</span></code></pre></section><ul data-tool="mdnice编辑器" style="list-style-type: circle;margin-left: -20px;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;text-align: left;">执行logstash，并查看效果：<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d</code></section></li></ul><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.4306254493170381" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="2782" src="https://wechat2rss.xlab.app/img-proxy/?k=4ec8b8af&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspCLHHMrkIExxFn8fpvAMR4J0r41IkhQExH2MYIQ8KiaUFdlLOl9PK7Pw%2F640%3Fwx_fmt%3Dpng"/></figure><section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" style="margin-right: auto;margin-left: auto;border-width: 0px;border-style: none;border-color: initial;width: 574px;opacity: 1;transform: rotateZ(0deg);"><section style="width: 574px;text-align: center;"><section style="margin-top: 10px;display: inline-block;width: auto;"><section style="display: -webkit-flex;justify-content: center;"><section style="margin-top: 8px;margin-right: -30px;width: 45px;"><section style="width: 58px;"><img data-w="70" title="" class="" data-ratio="0.5714285714285714" src="https://wechat2rss.xlab.app/img-proxy/?k=36a6308f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarsp6wbKDYd4qxib2QHqtT18Nic5AmjBMzOcjy8bRauPMsLXiaBuBO1GqlHHg%2F640"/></section></section><section style="padding-right: 16px;padding-left: 16px;line-height: 22px;letter-spacing: 2px;"><p class="title active" style="color: rgb(63, 62, 63);font-size: 16px;min-width: 1px;"><span style="font-size: 22px;">统一Nginx日志格式</span></p></section><section style="margin-top: -11px;margin-left: -30px;width: 35px;"><section style="width: 30px;"><img style="width: 30px;display: block;vertical-align: top;" class="" data-ratio="0.625" data-w="40" src="https://wechat2rss.xlab.app/img-proxy/?k=99a3bd6d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspeahQl4dC745C0AQblUiaZWq1tVYWXxoEbgtzn7BskoD56sWSiczWsOdQ%2F640"/></section></section></section></section></section></section><p style="text-align: left;"><span style="letter-spacing: 0px;color: rgb(51, 51, 51);font-size: 15px;">在完成了调研之后，小B就开始统一所有的日志字段了，为了方便后续查询分析操</span><span style="letter-spacing: 0px;color: rgb(51, 51, 51);font-size: 15px;">作，小B决定所有的字段采用JSON格式存盘，并且添加了运维、安全、研发都关注的字段。</span><br/></p><ul data-tool="mdnice编辑器" style="list-style-type: circle;margin-left: -20px;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;text-align: left;">修改配置文件：<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">vim /opt/nginx/conf/nginx.conf</code></section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer"># 完整的nginx配置</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">worker_processes  <span class="code-snippet__number">1</span>;</span></code><code><span class="code-snippet_outer">events {</span></code><code><span class="code-snippet_outer">    worker_connections  <span class="code-snippet__number">1024</span>;</span></code><code><span class="code-snippet_outer">}</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">http {</span></code><code><span class="code-snippet_outer">    include       mime.types;</span></code><code><span class="code-snippet_outer">    default_type  application/octet-stream;</span></code><code><span class="code-snippet_outer">    log_format main     <span class="code-snippet__built_in">escape</span>=json <span class="code-snippet__string">&#39;{&#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;timestamp&#34;: $time_local &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;remote_addr&#34;: $remote_addr &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;remote_user&#34;: &#34;$remote_user &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;request_method&#34;: $request_method &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;request_uri&#34;: &#34;$request_uri&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;request_protocol&#34;: &#34;$server_protocol&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;request_length&#34;: $request_length &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;request_time&#34;: $request_time &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;request_body_head&#34;: &#34;$request_body_head&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;response_status&#34;: $status &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;body_bytes_sent&#34;: $body_bytes_sent &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;bytes_sent&#34;: $bytes_sent &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;response_body&#34;: &#34;$response_body&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;http_referer&#34;: &#34;$http_referer&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;http_user_agent&#34;: &#34;$http_user_agent&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;http_x_forwarded_for&#34;: &#34;$http_x_forwarded_for&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;http_host&#34;: &#34;$http_host&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;server_name&#34;: &#34;$server_name&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;upstream_addr&#34;: &#34;$upstream_addr&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;&#34;upstream_status&#34;: $upstream_status&#39;</span></span></code><code><span class="code-snippet_outer">                                        <span class="code-snippet__string">&#39;}&#39;</span>;</span></code><code><span class="code-snippet_outer">                                        </span></code><code><span class="code-snippet_outer">    access_log  logs/access.log  main;</span></code><code><span class="code-snippet_outer">    sendfile        on;</span></code><code><span class="code-snippet_outer">    keepalive_timeout  <span class="code-snippet__number">65</span>;</span></code><code><span class="code-snippet_outer">    </span></code><code><span class="code-snippet_outer">    server {</span></code><code><span class="code-snippet_outer">        listen       <span class="code-snippet__number">80</span>;</span></code><code><span class="code-snippet_outer">        server_name  localhost;</span></code><code><span class="code-snippet_outer">      lua_need_request_body   on;</span></code><code><span class="code-snippet_outer">      <span class="code-snippet__keyword">set</span> $response_body      <span class="code-snippet__string">&#34;&#34;</span>;</span></code><code><span class="code-snippet_outer">      body_filter_by_lua      <span class="code-snippet__string">&#39;</span></span></code><code><span class="code-snippet_outer">          local       response_body = string.sub(ngx.arg[1],1,1000)</span></code><code><span class="code-snippet_outer">          ngx.ctx.buffered =  (ngx.ctx.buffered or &#34;&#34;)        ..      response_body</span></code><code><span class="code-snippet_outer">          if ngx.arg[2] then</span></code><code><span class="code-snippet_outer">            ngx.var.response_body = ngx.ctx.buffered</span></code><code><span class="code-snippet_outer">          end</span></code><code><span class="code-snippet_outer"><span class="code-snippet_outer">      &#39;</span>;</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        location /lua {</span></code><code><span class="code-snippet_outer">          root  html;</span></code><code><span class="code-snippet_outer">          index  index.html;</span></code><code><span class="code-snippet_outer">          <span class="code-snippet__keyword">set</span> $request_body_head      <span class="code-snippet__string">&#34;&#34;</span>;</span></code><code><span class="code-snippet_outer">          content_by_lua_block {</span></code><code><span class="code-snippet_outer">            ngx.req.read_body()</span></code><code><span class="code-snippet_outer">            local   req_body = ngx.req.get_body_data()</span></code><code><span class="code-snippet_outer">            ngx.var.request_body_head =  req_body:sub(<span class="code-snippet__number">1</span>,<span class="code-snippet__number">1000</span>)</span></code><code><span class="code-snippet_outer">          }</span></code><code><span class="code-snippet_outer">        }</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        error_page   <span class="code-snippet__number">500</span> <span class="code-snippet__number">502</span> <span class="code-snippet__number">503</span> <span class="code-snippet__number">504</span>  /<span class="code-snippet__number">50</span>x.html;</span></code><code><span class="code-snippet_outer">        location = <span class="code-snippet__regexp">/50x.html {</span></span></code><code><span class="code-snippet_outer">            root   html;</span></code><code><span class="code-snippet_outer">        }</span></code><code><span class="code-snippet_outer">    }</span></code><code><span class="code-snippet_outer">}</span></code></pre></section><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">此时Nginx的日志为：</p><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.24731951393852752" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="2798" src="https://wechat2rss.xlab.app/img-proxy/?k=f642417f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspZs30PUhfkEwL3EGSclTLsiaBXCeuf2GmicglGzQ3bDWOyenhS3w3l0IA%2F640%3Fwx_fmt%3Dpng"/></figure><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;text-align: left;white-space: normal;"><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;  </span><span style="font-size: 20px;color: rgb(121, 121, 121);letter-spacing: 0px;">小结一下</span></figure><section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" style="margin-right: auto;margin-left: auto;width: 574px;opacity: 1;transform: rotateZ(0deg);text-align: left;"><span style="font-size: 20px;color: rgb(121, 121, 121);letter-spacing: 0px;"></span></section><ul data-tool="mdnice编辑器" style="list-style-type: circle;margin-left: -20px;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;text-align: left;">对于timestamp参数，可以不使用time_local而使用time_iso8601。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;text-align: left;">如果运维对于网络的性能有要求，可以考虑使用<code style="overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 14px;">$tcpinfo_rtt, $tcpinfo_rttvar, $tcpinfo_snd_cwnd, $tcpinfo_rcv_space</code>这些参数可能需要我们给nginx添加其他模块。</section></li></ul><section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" style="margin-right: auto;margin-left: auto;border-width: 0px;border-style: none;border-color: initial;width: 574px;opacity: 1;transform: rotateZ(0deg);"><section style="width: 574px;text-align: center;"><section style="margin-top: 10px;display: inline-block;width: auto;"><section style="display: -webkit-flex;justify-content: center;"><section style="margin-top: 8px;margin-right: -30px;width: 45px;"><section style="width: 58px;"><img data-w="70" title="" class="" data-ratio="0.5714285714285714" src="https://wechat2rss.xlab.app/img-proxy/?k=36a6308f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarsp6wbKDYd4qxib2QHqtT18Nic5AmjBMzOcjy8bRauPMsLXiaBuBO1GqlHHg%2F640"/></section></section><section style="padding-right: 16px;padding-left: 16px;line-height: 22px;letter-spacing: 2px;"><p class="title active" style="color: rgb(63, 62, 63);font-size: 16px;min-width: 1px;"><span style="font-size: 22px;">踩坑记录</span></p></section><section style="margin-top: -11px;margin-left: -30px;width: 35px;"><section style="width: 30px;"><img style="width: 30px;display: block;vertical-align: top;" class="" data-ratio="0.625" data-w="40" src="https://wechat2rss.xlab.app/img-proxy/?k=99a3bd6d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspeahQl4dC745C0AQblUiaZWq1tVYWXxoEbgtzn7BskoD56sWSiczWsOdQ%2F640"/></section></section></section></section></section></section><figure data-tool="mdnice编辑器" style="margin-top: 10px;margin-bottom: 10px;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 16px;text-align: left;white-space: normal;"><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="font-size: 18px;letter-spacing: -2px;color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;  </span><span style="font-size: 20px;color: rgb(121, 121, 121);letter-spacing: 0px;">启动nginx报错</span></figure><ul data-tool="mdnice编辑器" style="list-style-type: circle;margin-left: -20px;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;text-align: left;">由于luajit导致的报错</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer" style="line-height: 26px;">nginx: [alert] detected a LuaJIT version which is not OpenResty&#39;s; many optimizations will be disabled and performance will be compromised (see <a href="https://github.com/openresty/luajit2" target="_blank">https://github.com/openresty/luajit2</a> for OpenResty&#39;s LuaJIT or, even better, consider using the OpenResty releases from <a href="https://openresty.org/en/download.html)" target="_blank">https://openresty.org/en/download.html)</a></span></code></pre></section><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">解决方案：卸载原有的luajit</p><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer">wget <a href="https://github.com/openresty/luajit2/archive/v2.1-20190912.tar.gz" target="_blank">https://github.com/openresty/luajit2/archive/v2.1-20190912.tar.gz</a></span></code><code><span class="code-snippet_outer">tar -xf v2.1-20190912.tar.gz &amp;&amp; <span class="code-snippet__built_in">cd</span> luajit2-2.1-20190912/</span></code><code><span class="code-snippet_outer">make install PREFIX=/usr/<span class="code-snippet__built_in">local</span>/luajit</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__built_in">echo</span> <span class="code-snippet__string">&#39;export LUAJIT_LIB=/usr/local/luajit/lib&#39;</span> &gt;&gt; /etc/profile</span></code><code><span class="code-snippet_outer"><span class="code-snippet__built_in">echo</span> <span class="code-snippet__string">&#39;export LUAJIT_INC=/usr/local/luajit/include/luajit-2.1&#39;</span> &gt;&gt; /etc/profile</span></code><code><span class="code-snippet_outer"><span class="code-snippet__built_in">source</span> /etc/profile</span></code></pre></section><ul data-tool="mdnice编辑器" style="list-style-type: circle;margin-left: -20px;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;text-align: left;">由于lua-nginx-module导致的报错</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer" style="line-height: 26px;">nginx: [error] lua_load_resty_core failed to load the resty.core module from <a href="https://github.com/openresty/lua-resty-core;" target="_blank">https://github.com/openresty/lua-resty-core;</a> ensure you are using an OpenResty release from <a href="https://openresty.org/en/download.html" target="_blank">https://openresty.org/en/download.html</a> (rc: 2, reason: module &#39;resty.core&#39; not found:</span></code></pre></section><p data-tool="mdnice编辑器" style="padding-top: 8px;padding-bottom: 8px;line-height: 24px;font-size: 15px;color: rgb(51, 51, 51);text-align: left;">解决方案：不要使用v0.10.15，使用14就没有问题了</p><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer">wget <a href="https://github.com/openresty/lua-nginx-module/archive/v0.10.14.tar.gz" target="_blank">https://github.com/openresty/lua-nginx-module/archive/v0.10.14.tar.gz</a></span></code><code><span class="code-snippet_outer">tar -xf v0.10.14.tar.gz -C /opt/</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 安装nginx</span></span></code><code><span class="code-snippet_outer">./configure --prefix=/opt/nginx --with-http_realip_module --with-http_ssl_module --with-pcre --with-ld-opt=-Wl,-rpath,/usr/<span class="code-snippet__built_in">local</span>/luajit/lib --add-module=/opt/lua-nginx-module-0.10.14 --add-module=/opt/ngx_devel_kit-0.3.1</span></code><code style="border-radius: 0px;white-space: pre;display: flex;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">make -j2 &amp;&amp; make install</span></code></pre></section><section class="xmt-style-block" data-style-type="5" data-tools="新媒体排版" data-id="2848936"><section class="xmt-style-block" data-style-type="5" data-tools="新媒体排版" data-id="2848935"><p style="white-space: normal;text-align: center;" class=""><strong style="max-width: 100%;color: rgb(62, 62, 62);font-size: 16px;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 1.75em;font-size: 15px;color: rgb(171, 25, 66);box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);font-size: 16px;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 1.75em;font-size: 15px;color: rgb(171, 25, 66);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(63, 63, 63);font-size: 14px;letter-spacing: 0px;text-align: justify;"> </span></span></strong><span style="color: rgb(63, 63, 63);font-size: 14px;letter-spacing: 0px;text-align: justify;"><strong style="text-align: center;max-width: 100%;color: rgb(62, 62, 62);font-size: 16px;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 1.75em;font-size: 15px;color: rgb(171, 25, 66);box-sizing: border-box !important;word-wrap: break-word !important;"><img class="__bg_gif" data-ratio="1" style="box-sizing: border-box !important;word-wrap: break-word !important;visibility: visible !important;width: auto !important;height: auto !important;" data-type="gif" data-w="55" src="https://wechat2rss.xlab.app/img-proxy/?k=950789db&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_gif%2FrbP97vC6miamShOrqGvJBU4cdwnxVarspI7aJIYrCAkzNC5oWUaLBVBIrNxkEsQbLBarS4D50nRESXibYLyK2qGQ%2F640%3Fwx_fmt%3Dgif"/></span></strong></span></span></strong></p></section><p style="white-space: normal;text-align: center;font-size: 15px;letter-spacing: 3px;line-height: 25.6px;background-color: rgb(255, 255, 255);" class=""><span style="font-size: 14px;letter-spacing: 3px;"></span></p><p style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);" class=""><span style="font-size: 14px;letter-spacing: 3px;color:#000;"><strong>- 参考资料 -</strong></span></p><p style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);" class=""><span style="color: rgb(136, 136, 136);text-decoration: underline;line-height: 1.6;font-size: 14px;letter-spacing: 3px;">《Nginx安装Lua支持》：<a href="http://1t.click/b6ru" target="_blank">http://1t.click/b6ru</a><a href="http://mp.weixin.qq.com/s?__biz=MzA5MDk3MjQ0MQ==&amp;mid=2654903349&amp;idx=1&amp;sn=7dfd67ddf7137784383ab9bae2ac7fe4&amp;chksm=8bc9b443bcbe3d55d096bb1a5725726b48cea802a9ab37aa536e64d03aac3feb33803807e4e1&amp;scene=21#wechat_redirect" target="_blank" data_ue_src="http://mp.weixin.qq.com/s?__biz=MzA5MDk3MjQ0MQ==&amp;mid=2654903349&amp;idx=1&amp;sn=7dfd67ddf7137784383ab9bae2ac7fe4&amp;chksm=8bc9b443bcbe3d55d096bb1a5725726b48cea802a9ab37aa536e64d03aac3feb33803807e4e1&amp;scene=21#wechat_redirect" data-linktype="2"></a></span><span style="line-height: 1.6;color: rgb(136, 136, 136);font-size: 14px;letter-spacing: 3px;"><br/></span></p><p style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);" class=""><span style="color: rgb(136, 136, 136);text-decoration: underline;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;letter-spacing: 3px;text-align: center;line-height: 1.6;font-size: 14px;"><a href="http://mp.weixin.qq.com/s?__biz=MzA5MDk3MjQ0MQ==&amp;mid=2654903349&amp;idx=1&amp;sn=7dfd67ddf7137784383ab9bae2ac7fe4&amp;chksm=8bc9b443bcbe3d55d096bb1a5725726b48cea802a9ab37aa536e64d03aac3feb33803807e4e1&amp;scene=21#wechat_redirect" target="_blank" data_ue_src="http://mp.weixin.qq.com/s?__biz=MzA5MDk3MjQ0MQ==&amp;mid=2654903349&amp;idx=1&amp;sn=7dfd67ddf7137784383ab9bae2ac7fe4&amp;chksm=8bc9b443bcbe3d55d096bb1a5725726b48cea802a9ab37aa536e64d03aac3feb33803807e4e1&amp;scene=21#wechat_redirect" style="color: rgb(136, 136, 136);text-decoration: underline;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;letter-spacing: 3px;text-align: center;white-space: normal;line-height: 1.6;font-size: 14px;" data-linktype="2">《Nginx安装lua-nginx-module》</a>：<a href="http://1t.click/b6tw" target="_blank">http://1t.click/b6tw</a></span></p><p style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);" class=""><br/></p><p style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);" class=""><span style="font-size: 14px;letter-spacing: 3px;color:#000;"><strong>- HISTORY -</strong></span></p><p style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);" class=""><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483849&amp;idx=1&amp;sn=cdb1bbe88e24156df44b12f531c48456&amp;chksm=fc981509cbef9c1f499f03b9d520c1e48057829fbafa34c7b54674cc61d2ae3b33c526aa80af&amp;scene=21#wechat_redirect" textvalue="《日志分析系列(一)：介绍篇》" data-itemshowtype="0" tab="innerlink" data-linktype="2"><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;letter-spacing: 3px;" class="">《日志分析系列(一)：</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;letter-spacing: 3px;">介绍篇》</span></a></p><p style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);" class=""><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483806&amp;idx=1&amp;sn=dbd9264bc3fece3bcaa92f18c2dd0bd4&amp;chksm=fc98155ecbef9c48529617523d1bdc2e85bc26ea24ef2b340f59218f0b9713357067a098ce33&amp;scene=21#wechat_redirect" textvalue="《日志分析系列(外传一)：Nginx透过代理获取真实客户端IP》" data-itemshowtype="0" tab="innerlink" data-linktype="2"><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">《日志分析系列(外传一)：</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">Nginx透过代理获取真实客户端IP</span><span style="line-height: 1.6;font-size: 14px;color: rgb(136, 136, 136);text-decoration: underline;">》</span></a></p></section></section>



<p><a href="https://zhuanlan.zhihu.com/p/100080719">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=a3f528c1&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483868%26idx%3D1%26sn%3Dc66ce6cf610faf3f10b5bf0011d5386d%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 30 Dec 2019 09:00:00 +0800</pubDate>
    </item>
    <item>
      <title>日志分析系列(一):介绍篇</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483849&amp;idx=1&amp;sn=cdb1bbe88e24156df44b12f531c48456</link>
      <description>小B是Q公司的安全攻城狮，最近Q公司不太平，出现了好几次的安全攻击事件。可在事后小B却找不到被攻击的真正原因，于是领导下命令给小B，必须做到对攻击事件的检测与溯源，不然就可以卷铺盖回家了。</description>
      <content:encoded><![CDATA[<p>
原创 <span>bloodzer0</span> <span>2019-12-23 09:00</span> <span style="display: inline-block;"></span>
</p>

<p>小B是Q公司的安全攻城狮，最近Q公司不太平，出现了好几次的安全攻击事件。可在事后小B却找不到被攻击的真正原因，于是领导下命令给小B，必须做到对攻击事件的检测与溯源，不然就可以卷铺盖回家了。</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=3914baad&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6mialdTqP8icRhefNibIzMJsEAbPH7mPLXnVALsxQiaib6zHLVEWGoMibvpbCwvXer8dPVemiaicVRgHT5lzeGg%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section class="xmteditor" style="display:none;" data-tools="新媒体管家" data-label="powered by xmt.cn" data-mpa-powered-by="yiban.io"></section><section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="color: black;padding: 10px;line-height: 1.6;letter-spacing: 0px;word-break: break-word;text-align: left;font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;"><section class="xmt-style-block" data-style-type="1" data-tools="新媒体排版" data-id="12978" style="font-size: 16px;"><section class="KolEditor" style="border-width: 0px;border-style: none;border-color: initial;padding: 0px;margin-top: 20px;"><section style="border-width: 0px;border-style: none;border-color: initial;"><section style="text-align: center;white-space: normal;"><p style="color:#f05454;" class="active brush">本系列故事纯属虚构，如有雷同实属巧合</p></section><p style="text-align: center;white-space: normal;"><img class="" data-ratio="0.05555555555555555" data-w="180" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=113e0cb3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialdTqP8icRhefNibIzMJsEAbP1Md5AVwq0R8YdSrpiaCUkCaWjsGHgtnP2hL57Q61t0nFUqsumDV8XsA%2F640%3Fwx_fmt%3Dpng"/></p></section></section></section><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;text-align: left;"><span style="letter-spacing: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">小B是Q公司的安全攻城狮，最近Q公司不太平，出现了好几次的安全攻击事件。</span><span style="letter-spacing: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">可在事后小B却找不到被攻击的真正原因，于是领导下命令给小B，必须做到对攻击事件的检测与溯源，不然就可以卷铺盖回家了。</span></p><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">听到此话的小B冷汗连连，找到最近几次攻击的记录文档，认真剖析未发现真相的原因，总结如下：</span></p><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">系统未记录日志：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">部分系统无日志信息可用。</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">日志信息无备份：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">日志被攻击者删除，或因存储空间不够被删除，无备份日志可用。</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">采集维度不详细：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">日志格式为默认配置，不够详细，不能从中提取太多有效价值信息。</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">采集信息不准确：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">类似IP等用户识别维度信息不准确，不能定位到攻击者。</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">记录结果不统一：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">相同字段在不同的日志中类型不统一，无法进行日志关联。</span></section></li></ul><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">找到了原因，小B就知晓了要想解决这些问题，就必须实现统一日志分析平台。</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">拥有了这个平台，那么在下一次面对攻击时就不会那么两眼一抹黑了。</span></p><section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" style="font-size: 16px;margin-right: auto;margin-left: auto;caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;border-width: 0px;border-style: none;border-color: initial;width: 574px;opacity: 1;transform: rotateZ(0deg);"><section style="width: 574px;text-align: center;"><section style="margin-top: 10px;display: inline-block;width: auto;"><section style="display: -webkit-flex;justify-content: center;"><section style="margin-top: 8px;margin-right: -30px;width: 45px;"><section style="width: 58px;"><img data-w="70" title="" class="" data-ratio="0.5714285714285714" src="https://wechat2rss.xlab.app/img-proxy/?k=8f4c3fc4&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialdTqP8icRhefNibIzMJsEAbPy9TDuOsziaSTWFFn9zrGAgmN6k985jdxEBqnb35CZHaibT76gqpGFyRg%2F640"/></section></section><section style="padding-right: 16px;padding-left: 16px;line-height: 22px;letter-spacing: 2px;"><p class="title active" style="color: rgb(63, 62, 63);font-size: 16px;min-width: 1px;"><span style="font-size: 22px;">小B说目的</span></p></section><section style="margin-top: -11px;margin-left: -30px;width: 35px;"><section style="width: 30px;"><img style="width: 30px;display: block;vertical-align: top;" class="" data-ratio="0.625" data-w="40" src="https://wechat2rss.xlab.app/img-proxy/?k=29d79a58&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialdTqP8icRhefNibIzMJsEAbPsgy4UUYD67CH4Rac9l64Tx55vP52SXkPvzmfM78LXc3pS5XrLN1hvQ%2F640"/></section></section></section></section></section></section><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">建设统一日志分析平台，小B需要先向领导汇报得到领导的支持。</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">首要就是向领导说明搭建统一日志分析平台的目的。</span></p><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">日志分析在企业内部是一项很基础的核心技术，不光运用在安全团队中，还运用在IT研发团队、业务团队中。</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">不同的是目的：</span></p><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">从安全来看：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">安全团队提取日志分析主要是为了<strong style="color: black;">发现未知安全事件、对已知的安全事件进行溯源分析</strong>。</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">还有另外一个很重要的目的是<strong style="color: black;">国家层面的监管合规要求</strong>。</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">从IT研发来看：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">企业内部的非安全技术团队做日志分析主要也是为了发现位置问题、分析已知问题，主要集中在：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">系统监控、APM(APM包含了研发团队关注的所有监控项)。</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">从业务来看：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">业务团队对于日志分析的需求，更多集中在风险控制、运营推广、用户画像、网站画像等方面。</span></section></li></ul><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">日志躺在硬盘中毫无价值，通过日志分析技术能实现日志信息的价值化。</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">日志价值体现程度越高，也能变相反映公司的技术实力。</span></p><section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" style="font-size: 16px;margin-right: auto;margin-left: auto;caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;border-width: 0px;border-style: none;border-color: initial;width: 574px;opacity: 1;transform: rotateZ(0deg);"><section style="width: 574px;text-align: center;"><section style="margin-top: 10px;display: inline-block;width: auto;"><section style="display: -webkit-flex;justify-content: center;"><section style="margin-top: 8px;margin-right: -30px;width: 45px;"><section style="width: 58px;"><img data-w="70" title="" class="" data-ratio="0.5714285714285714" src="https://wechat2rss.xlab.app/img-proxy/?k=8f4c3fc4&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialdTqP8icRhefNibIzMJsEAbPy9TDuOsziaSTWFFn9zrGAgmN6k985jdxEBqnb35CZHaibT76gqpGFyRg%2F640"/></section></section><section style="padding-right: 16px;padding-left: 16px;line-height: 22px;letter-spacing: 2px;"><p class="title active" style="color: rgb(63, 62, 63);font-size: 16px;min-width: 1px;"><span style="font-size: 22px;">日志分析的更新换代</span></p></section><section style="margin-top: -11px;margin-left: -30px;width: 35px;"><section style="width: 30px;"><img style="width: 30px;display: block;vertical-align: top;" class="" data-ratio="0.625" data-w="40" src="https://wechat2rss.xlab.app/img-proxy/?k=29d79a58&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialdTqP8icRhefNibIzMJsEAbPsgy4UUYD67CH4Rac9l64Tx55vP52SXkPvzmfM78LXc3pS5XrLN1hvQ%2F640"/></section></section></section></section></section></section><h1 data-tool="mdnice编辑器" style="font-size: 28px;font-weight: bold;text-align: center;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 22px;font-weight: normal;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"></span></h1><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">日志分析并不是一项新颖的技术了，虽然现在有人给它换了很多新衣。</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">但是对于只有较小安全团队的公司来说，不要追求高大上的地图炮，需要的是实际解决问题的思路或工具，哪怕是一段只有20行的命令脚本都可以。</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">从古至今，小B将日志分析经历划分成了4个时代：</span></p><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong>石器时代：</strong> 这个时代大家在做日志分析的时候更多依靠的是Excel、终端命令(awk、grep、sort、uniq、wc等)。</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">在这里推荐大家阅读 </span><a href="https://mp.weixin.qq.com/s?__biz=MzA3NzE2MjgwMg==&amp;mid=2448904160&amp;idx=1&amp;sn=652e2bc0924230fbefc6fde80f64775f&amp;scene=21#wechat_redirect" style="border-bottom: 1px solid rgb(243, 156, 19);color: rgb(243, 156, 19);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;" data-linktype="2"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Web日志安全分析技巧</span></a><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"> 与 Web日志安全分析浅谈(<a href="https://xz.aliyun.com/t/1121)，其中提到了关于使用命令来进行安全分析的案例。" target="_blank">https://xz.aliyun.com/t/1121)，其中提到了关于使用命令来进行安全分析的案例。</a></span></p><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong>铁器时代：</strong> 这个时代大家在做日志分析的时候更多依靠的是脚本工具(自写工具)、简易交互式工具(logwatch、logparser)等。</span></p><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong>工业时代：</strong> 这个时代大家在做日志分析的时候相比前两个时代已经有了太多的进步了，各种开源、免费、付费的软件可供选择，比如：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">Elastic系列、Splunk、ArcSight等等。</span></p><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong>未来时代：</strong> 这个时代大家在做日志分析的时候我不知道会用到什么，但是从目前来看，</span><code style="padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 15px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">机器学习、人工智能</span></code><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">应该是核心之一。</span></p><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">小B是这么认为的：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">不论我们处在哪个时代，过去的思路与工具都有着不可替代之处。</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">因为那是一个时代经历了优胜劣汰之后留下的优秀产物，本质上新时代的产品也是经历史长河演变而来。</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">(内心OS：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">有小部分的工具或系统是辣鸡的，大家慎用！</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">)</span></p><section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" style="font-size: 16px;margin-right: auto;margin-left: auto;caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;border-width: 0px;border-style: none;border-color: initial;width: 574px;opacity: 1;transform: rotateZ(0deg);"><section style="width: 574px;text-align: center;"><section style="margin-top: 10px;display: inline-block;width: auto;"><section style="display: -webkit-flex;justify-content: center;"><section style="margin-top: 8px;margin-right: -30px;width: 45px;"><section style="width: 58px;"><img data-w="70" title="" class="" data-ratio="0.5714285714285714" src="https://wechat2rss.xlab.app/img-proxy/?k=8f4c3fc4&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialdTqP8icRhefNibIzMJsEAbPy9TDuOsziaSTWFFn9zrGAgmN6k985jdxEBqnb35CZHaibT76gqpGFyRg%2F640"/></section></section><section style="padding-right: 16px;padding-left: 16px;line-height: 22px;letter-spacing: 2px;"><p class="title active" style="color: rgb(63, 62, 63);font-size: 16px;min-width: 1px;"><span style="font-size: 22px;">如何实现统一日志分析平台</span></p></section><section style="margin-top: -11px;margin-left: -30px;width: 35px;"><section style="width: 30px;"><img style="width: 30px;display: block;vertical-align: top;" class="" data-ratio="0.625" data-w="40" src="https://wechat2rss.xlab.app/img-proxy/?k=29d79a58&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialdTqP8icRhefNibIzMJsEAbPsgy4UUYD67CH4Rac9l64Tx55vP52SXkPvzmfM78LXc3pS5XrLN1hvQ%2F640"/></section></section></section></section></section></section><h2 data-tool="mdnice编辑器" style="margin-top: 6px;margin-bottom: 4px;font-weight: bold;font-size: 24px;color: rgb(0, 0, 0);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;text-align: left;white-space: normal;"><span style="font-size: 20px;font-weight: normal;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="caret-color: rgb(51, 51, 51);font-size: 18px;letter-spacing: -2px;display: inline-block;"><span style="font-size: 20px;"><span style="color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;</span></span></section><section style="margin-left: 10px;font-size: 16px;caret-color: rgb(51, 51, 51);color: rgb(28, 89, 165);display: inline-block;"><p class="active brush" style="color: rgb(121, 121, 121);min-width: 1em;"><span style="font-size: 20px;color: rgb(63, 62, 63);">统一日志分析架构</span><span style="font-size: 20px;color: rgb(0, 0, 0);"></span></p></section></span></h2><p style="font-size: 16px;caret-color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;white-space: normal;text-size-adjust: auto;"><span style="letter-spacing: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">实现统一日志分析平台在不同企业中各不相同。</span><span style="letter-spacing: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">主要表现在：</span><span style="letter-spacing: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">平台对企业的适用性、企业自身的技术能力、技术团队对产品的优劣选择不同等。</span><span style="letter-spacing: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">但是核心的架构基本还是如下图所示：</span><br/></p><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"></span></p><figure data-tool="mdnice编辑器" style="font-size: 16px;margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.577807848443843" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="1478" src="https://wechat2rss.xlab.app/img-proxy/?k=d7b6957d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mialdTqP8icRhefNibIzMJsEAbPmLORg9OnlxJia9olhQ0jMzodRG37ct2fsIrHn9jFdsAdM3MEJgAVTaw%2F640%3Fwx_fmt%3Dpng"/></figure><h2 data-tool="mdnice编辑器" style="font-size: 24px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 20px;font-weight: normal;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="color: rgb(0, 0, 0);text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);font-size: 18px;letter-spacing: -2px;display: inline-block;"><span style="font-size: 20px;"><span style="color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;</span></span></section><section style="margin-left: 10px;font-size: 16px;text-align: left;white-space: normal;caret-color: rgb(51, 51, 51);color: rgb(28, 89, 165);display: inline-block;"><p class="active brush" style="color: rgb(121, 121, 121);min-width: 1em;"><span style="font-size: 20px;color: rgb(63, 62, 63);">实现统一日志分析难点</span><span style="font-size: 20px;"></span></p></section></span></h2><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">难度1：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">技术难点</span></section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">复杂的网络环境如何来采集信息？</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">繁杂的日志类型如何定义统一解析规则？</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">TB甚至PB级别的日志如何快速查询？</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">地图炮无用什么才是最好的展示方式？</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">每天被报警打晕，如何自救？</span></section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">难度2：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">人，主要体现在没有良好的沟通<span style="text-decoration: line-through;">撕逼撕不过</span>。</span></section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">推动力度不够：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">老板不重视或伪重视；</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">推动阻力太大：</span><span style="text-decoration: line-through;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">别人是老板，你是工程师</span></section></li></ul></ul><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">小B作为一个安全工程师，理所当然的认为安全是最重要的(其实这是错误的)，但是小B也会灵活变通勾兑IT研发团队、业务团队一起推动，人多力量大。</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">虽然大家的分析目的不一致，但是统一日志分析平台架构是大家都需要的。</span></p><h2 data-tool="mdnice编辑器" style="margin-top: 6px;margin-bottom: 4px;font-weight: bold;color: rgb(0, 0, 0);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;text-align: left;white-space: normal;"><span style="font-weight: normal;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="font-size: 18px;caret-color: rgb(51, 51, 51);letter-spacing: -2px;display: inline-block;"><span style="font-size: 20px;"><span style="color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;</span></span></section><section style="margin-left: 10px;caret-color: rgb(51, 51, 51);color: rgb(28, 89, 165);display: inline-block;"><p class="active brush" style="color: rgb(121, 121, 121);min-width: 1em;"><span style="font-size: 20px;color: rgb(63, 62, 63);">安全场景下的分析思路</span><span style="font-size: 20px;"></span></p></section></span></h2><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">如果硬要给安全场景分类的话，小B会分为：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">已知场景和未知场景。</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">在已知场景中，我们常用的分析手法包括：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">基于正则表达式分析、基于统计聚合分析、基于关联分析；</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">在未知场景中，我们使用的分析方法主要是数据挖掘，从数据中挖掘未知的东西。</span></p><h3 data-tool="mdnice编辑器" style="font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 16px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">基于正则表达式分析</span></h3><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">此类的分析方法主要适用于常见带有特征的攻击场景，比如：</span></p><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">特定Payload场景：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">SQL注入、XSS、Bypass WAF等，可以总结为基于规则库进行分析；</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">特定关键字场景：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">爬虫(特定UA、Cookie等)；</span></section></li></ul><h3 data-tool="mdnice编辑器" style="font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 16px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">基于统计与聚合分析</span></h3><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">此类的分析方法是：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">尽可能在不同维度下进行统计与聚合，根据统计聚合结果挖掘有价值的信息。</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">最常见的就是分析场景就是：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">单位时间内的某个客户端对某个服务端的操作信息。</span></p><h3 data-tool="mdnice编辑器" style="font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 16px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">基于关联分析</span></h3><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">此类的分析方法，需要有一定的基础数据，通过关联分析来举一反三，比如</span></p><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">与外部情报关联分析：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">企业可以购买威胁情报(微步、威胁猎人)来关联内部的日志数据从而发现风险，比如：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">通过购买恶意域名情报，然后通过办公网出口流量与日志分析看是否有访问记录，如果有就可能代表内部有人中了木马或病毒。</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">与内部情报关联分析：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">以前面分析技术得到的结果作为依据标准来进行关联分析发现其他风险，比如：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">找到了一个恶意的用户IP，然后在日志分析系统中查找该IP的其它行为，说不定有意外收获，在IP这个维度要注意IP自身的属性信息。</span></section></li></ul><h3 data-tool="mdnice编辑器" style="font-size: 20px;font-weight: bold;margin-top: 6px;margin-bottom: 4px;"><span style="font-size: 16px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">数据挖掘分析</span></h3><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">异常场景分析：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">通过聚类、分类等数据挖掘方法分析单点异常、上下文异常、集体异常等。</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">未知场景分析：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">通过机器学习算法识别0Day、Bypass技巧等。</span></section></li></ul><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">日志分析的思路：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">思考各种场景，合理利用已有信息与可获取信息从而让信息产生价值。</span></p><h2 data-tool="mdnice编辑器" style="margin-top: 6px;margin-bottom: 4px;font-weight: bold;font-size: 24px;color: rgb(0, 0, 0);font-family: &#34;PingFang SC&#34;, &#34;Microsoft YaHei&#34;, sans-serif;text-align: left;white-space: normal;"><span style="font-size: 20px;font-weight: normal;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><section style="caret-color: rgb(51, 51, 51);font-size: 18px;letter-spacing: -2px;display: inline-block;"><span style="font-size: 20px;"><span style="color: rgb(255, 140, 0);font-weight: bold;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.7;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.5;">&gt;</span><span style="color: rgb(255, 140, 0);font-weight: 700;opacity: 0.3;">&gt;</span></span></section><section style="margin-left: 10px;font-size: 16px;caret-color: rgb(51, 51, 51);color: rgb(28, 89, 165);display: inline-block;"><p class="active brush" style="color: rgb(121, 121, 121);min-width: 1em;"><span style="font-size: 20px;color: rgb(63, 62, 63);">优化日志平台</span><span style="font-size: 20px;"></span></p></section></span></h2><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">统一日志分析平台不是简单的有一套系统，做个大屏biubiubiu就完事了的。</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">搭建日志分析平台是一项集技术、沟通<span style="text-decoration: line-through;">撕逼</span>、运营的老大难项目，50%的人死在了起点、30%的人死在了中途、15%的人死在了成功的前一步，只有5%的人做好了这个平台。</span></p><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">日志分析坑太多，如果领导支持人力与财力，就可以考虑买一套产品再有人来维护是最好的状态！</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">如果领导不支持人力与财力，算了吧！</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">利用运维的东西做一做也挺好。</span></p><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">统一日志分析平台的工作在小B看来可以简单分为2个阶段：</span></p><ol data-tool="mdnice编辑器" style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">平台实现：</span><code style="padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(229, 126, 35);font-size: 15px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">日志规范化 --&gt; 日志采集 --&gt; 日志存储 --&gt; 日志分析 --&gt; 日志展示 --&gt; 告警实现</span></code><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">，在这些部分中，小B认为日志规范化是很重要的一步，因为这个步骤是牵扯到与其他团队的配合最多的一步，尽可能的把要做的工作集中一次性完成(虽然这是不可能的)。</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">平台优化：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">这个阶段是对平台实现中的每一个步骤进行优化。</span></section></li></ol><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">对于平台优化又可以简单细分为(小B能想到的就这么多)：</span></p><ul data-tool="mdnice编辑器" style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">规范优化</span></section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">日志种类优化：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">系统、服务、应用、业务等日志都需要采集；</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">日志字段优化：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">采集尽可能多且有用的信息；</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">日志格式优化：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">从TXT到JSON(从JSON到Protocol Buffer)；</span></section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">采集优化：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">从Rsyslog到Logstash、从Logstash到Flume、Filebeat(主要是对客户端系统性能影响优化)；</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">传输优化：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">从无到有的消息队列、从不可靠传输(UDP)到可靠传输(TCP)、从无加密到加密(SSL)；</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">存储优化：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">从文本存储到数据库存储、从数据库存储到分布式文件系统；</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">分析优化：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">从单一场景到多场景、从经验之谈到数据分析技巧；</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">展示优化：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">从地图炮到直观安全风险展示、从单一到丰富；</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">告警优化：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">从每天报警不断到分级别告警、从单一告警方式到多层次告警；</span></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">架构优化：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">从单机到集群、从单集群到分布式集群；</span></section></li></ul><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><strong>关键是：</strong><strong>持续运营，能力沉淀、数据沉淀</strong></span></p><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">以上就是小B给领导汇报关于统一日志分析平台立项报告中的一些关键点了。</span></p><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">也许是因为开篇吧，十分不好写！</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">日志分析这个话题以小B目前的水平也很难写的深入，大家将就看一下。</span></p><p data-tool="mdnice编辑器" style="font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 24px;"><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;"><span style="caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);font-family: -webkit-standard;font-size: medium;text-align: start;text-size-adjust: auto;">☞</span> 下一篇：</span><span style="font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">小B就要开始实现统一日志分析平台了！</span></p></section><section class="xmt-style-block" data-style-type="2" data-tools="新媒体排版" data-id="8519"><section class="xmt-style-block" data-style-type="7" data-tools="新媒体排版" data-id="9214"><p style="white-space: normal;text-align: center;" class=""><strong style="max-width: 100%;color: rgb(62, 62, 62);font-size: 16px;line-height: 28px;background-color: rgb(255, 255, 255);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 1.75em;font-size: 15px;color: rgb(171, 25, 66);box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max-width: 100%;color: rgb(62, 62, 62);font-size: 16px;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 1.75em;font-size: 15px;color: rgb(171, 25, 66);box-sizing: border-box !important;word-wrap: break-word !important;"><span style="color: rgb(63, 63, 63);font-size: 14px;letter-spacing: 0px;text-align: justify;"> </span></span></strong><span style="color: rgb(63, 63, 63);font-size: 14px;letter-spacing: 0px;text-align: justify;"><strong style="text-align: center;max-width: 100%;color: rgb(62, 62, 62);font-size: 16px;line-height: 28px;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max-width: 100%;line-height: 1.75em;font-size: 15px;color: rgb(171, 25, 66);box-sizing: border-box !important;word-wrap: break-word !important;"><img class="__bg_gif" data-ratio="1" style="box-sizing: border-box !important;word-wrap: break-word !important;visibility: visible !important;width: auto !important;height: auto !important;" data-type="gif" data-w="55" src="https://wechat2rss.xlab.app/img-proxy/?k=c5da83ad&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_gif%2FrbP97vC6mialdTqP8icRhefNibIzMJsEAbPvCJ6WhK3x8jDw08O36kKkQVRyLEIicTyePoVozwtZs7wwsoSyVWZfIw%2F640%3Fwx_fmt%3Dgif"/></span></strong></span></span></strong></p></section><p style="white-space: normal;text-align: center;font-size: 15px;letter-spacing: 3px;line-height: 25.6px;background-color: rgb(255, 255, 255);" class=""><span style="font-size: 14px;letter-spacing: 3px;"></span></p><p style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);" class=""><span style="font-size: 14px;letter-spacing: 3px;color:#000;"><strong>-HISTORY-</strong></span></p><p style="white-space: normal;text-align: center;line-height: 25.6px;font-size: 15px;letter-spacing: 3px;background-color: rgb(255, 255, 255);" class=""><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483806&amp;idx=1&amp;sn=dbd9264bc3fece3bcaa92f18c2dd0bd4&amp;chksm=fc98155ecbef9c48529617523d1bdc2e85bc26ea24ef2b340f59218f0b9713357067a098ce33&amp;scene=21#wechat_redirect" textvalue="《日志分析系列(外传一)：Nginx透过代理获取真实客户端IP》" data-itemshowtype="0" tab="innerlink" data-linktype="2"><span style="color: rgb(136, 136, 136);text-decoration: underline;line-height: 1.6;font-size: 14px;letter-spacing: 3px;">《日志分析系列(外传一)：</span><span style="color: rgb(136, 136, 136);text-decoration: underline;line-height: 1.6;font-size: 14px;letter-spacing: 3px;">Nginx透过代理获取真实客户端IP》</span></a></p></section><p><br/></p>



<p><a href="https://zhuanlan.zhihu.com/p/98809991">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=c7e79a86&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483849%26idx%3D1%26sn%3Dcdb1bbe88e24156df44b12f531c48456%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 23 Dec 2019 09:00:00 +0800</pubDate>
    </item>
    <item>
      <title>日志分析系列(外传一)：Nginx透过代理获取真实客户端IP</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483806&amp;idx=1&amp;sn=dbd9264bc3fece3bcaa92f18c2dd0bd4</link>
      <description></description>
      <content:encoded><![CDATA[<p>
原创 <span>bloodzer0</span> <span>2019-12-16 08:58</span> <span style="display: inline-block;"></span>
</p>

<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=744ed575&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miamicAbbDq3hOx9grGCmiaacFsjhagUgpszXib2m55vS7zs6ibPMaicywZHA3Ngic6Yttds7MSiaPicF4po9zg%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section style="font-size: 16px;color: black;padding: 10px;line-height: 1.6;letter-spacing: 0px;word-break: break-word;overflow-wrap: break-word;text-align: left;font-family: &#34;Microsoft YaHei&#34;"><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;"><strong>本系列中的故事纯属虚构，如有雷同实属巧合</strong></p><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">小B是Q公司的安全攻城狮，为了完成任务小B开始做起了调研(欲知背景如何，且听下回分说)。</p><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">首先小B弄明白了Q公司的应用系统架构是：<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">Client --&gt; CDN --&gt; SLB --&gt; Server</code>。</p><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">发现在应用服务器上Nginx日志中采集的关于定位用户身份信息的IP维度数据不准确。不准确的原因是：因为在应用服务器中Nginx使用<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">XFF</code>与<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">remote_addr</code>字段采集客户IP，XFF字段很好被攻击者伪造，而<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">remote_addr</code>字段一般采集都是直连时的IP，在经过多层代理、网关等设备时，更容易导致后端服务器获取的客户端IP不真实。</p><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">于是乎小B开始研究&#34;Nginx如何获取客户端真实IP&#34;，下文是一些研究总结：</p><h1 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 1.8em;color: #5A90C0;margin: 1em auto;text-align: center;border-bottom: 1px solid #5A90C0;">默认设置获取到不真实的IP</h1><h2 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 24px;color: #5A90C0;padding-left: 10px;margin: 1em auto;border-left: 3px solid #5A90C0;">代理与服务器配置</h2><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx_Server配置：<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">vim /opt/nginx/conf/nginx.conf</code>，服务器不作任何修改</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">    log_format  main  <span class="code-snippet__string">&#39;$remote_addr - $remote_user [$time_local] &#34;$request&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;$status $body_bytes_sent &#34;$http_referer&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;&#34;$http_user_agent&#34; &#34;$http_x_forwarded_for&#34;&#39;</span>;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    access_log  logs/access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    # ************* 省略了中间的配置</span></code><code><span class="code-snippet_outer">    </span></code><code><span class="code-snippet_outer">    server {</span></code><code><span class="code-snippet_outer">        listen       <span class="code-snippet__number">80</span>;</span></code><code><span class="code-snippet_outer">        server_name  localhost;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #charset koi8-r;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #access_log  logs/host.access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        location / {</span></code><code><span class="code-snippet_outer">            root   html;</span></code><code><span class="code-snippet_outer">            index  index.html index.htm;</span></code><code><span class="code-snippet_outer">        }</span></code><code><span class="code-snippet_outer">    }</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_1配置：<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">vim /opt/nginx/conf/nginx.conf</code>，配置代理转发</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">    log_format  main  <span class="code-snippet__string">&#39;$remote_addr - $remote_user [$time_local] &#34;$request&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;$status $body_bytes_sent &#34;$http_referer&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;&#34;$http_user_agent&#34; &#34;$http_x_forwarded_for&#34;&#39;</span>;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    access_log  logs/access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    # ************* 省略了中间的配置</span></code><code><span class="code-snippet_outer">    </span></code><code><span class="code-snippet_outer">    server {</span></code><code><span class="code-snippet_outer">        listen       <span class="code-snippet__number">80</span>;</span></code><code><span class="code-snippet_outer">        server_name  localhost;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #charset koi8-r;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #access_log  logs/host.access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        location / {</span></code><code><span class="code-snippet_outer">            #root   html;</span></code><code><span class="code-snippet_outer">            #index  index.html index.htm;</span></code><code><span class="code-snippet_outer">            # 注意这里的key value之间使用Tab</span></code><code><span class="code-snippet_outer">            proxy_pass  http:<span class="code-snippet__comment">//10.10.10.99;</span></span></code><code><span class="code-snippet_outer">        }</span></code><code><span class="code-snippet_outer">    }</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_2配置：<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">vim /opt/nginx/conf/nginx.conf</code>，配置代理转发</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">    log_format  main  <span class="code-snippet__string">&#39;$remote_addr - $remote_user [$time_local] &#34;$request&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;$status $body_bytes_sent &#34;$http_referer&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;&#34;$http_user_agent&#34; &#34;$http_x_forwarded_for&#34;&#39;</span>;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    access_log  logs/access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    # ************* 省略了中间的配置</span></code><code><span class="code-snippet_outer">    </span></code><code><span class="code-snippet_outer">    server {</span></code><code><span class="code-snippet_outer">        listen       <span class="code-snippet__number">80</span>;</span></code><code><span class="code-snippet_outer">        server_name  localhost;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #charset koi8-r;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #access_log  logs/host.access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        location / {</span></code><code><span class="code-snippet_outer">            #root   html;</span></code><code><span class="code-snippet_outer">            #index  index.html index.htm;</span></code><code><span class="code-snippet_outer">            # 注意这里的key value之间使用Tab</span></code><code><span class="code-snippet_outer">            proxy_pass  http:<span class="code-snippet__comment">//10.10.10.100;</span></span></code><code><span class="code-snippet_outer">        }</span></code><code><span class="code-snippet_outer">    }</span></code></pre></section><h2 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 24px;color: #5A90C0;padding-left: 10px;margin: 1em auto;border-left: 3px solid #5A90C0;">正常访问的日志情况</h2><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时我们的网络架构为：</p><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.34519572953736655" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="843" src="https://wechat2rss.xlab.app/img-proxy/?k=90653cb5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakmiczccbqNf3MaYWllsVtYhamfxIXlltjF7lu97kIVrGhWWFHqQDYnsKshU8Fq3EDkIGQr89IckUg%2F640%3Fwx_fmt%3Dpng"/></figure><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 客户端使用命令访问</span></span></code><code><span class="code-snippet_outer">curl -XGET <span class="code-snippet__string">&#34;<a href="http://10.10.10.98" target="_blank">http://10.10.10.98</a>&#34;</span></span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx_Server日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.99 - - [11/Dec/2019:09:04:42 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;-&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_1日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.1 - - [11/Dec/2019:09:04:43 +0800] &#34;GET / HTTP/1.1&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;-&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_2日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.98 - - [11/Dec/2019:09:04:42 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;-&#34;</span></code></pre></section><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时在Nginx_Server中无法获取客户端真实IP。</p><h2 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 24px;color: #5A90C0;padding-left: 10px;margin: 1em auto;border-left: 3px solid #5A90C0;">伪造XFF的日志情况</h2><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时我们的网络架构为：</p><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.34519572953736655" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="843" src="https://wechat2rss.xlab.app/img-proxy/?k=90653cb5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakmiczccbqNf3MaYWllsVtYhamfxIXlltjF7lu97kIVrGhWWFHqQDYnsKshU8Fq3EDkIGQr89IckUg%2F640%3Fwx_fmt%3Dpng"/></figure><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 客户端访问时使用XFF</span></span></code><code><span class="code-snippet_outer">curl -XGET <span class="code-snippet__string">&#34;<a href="http://10.10.10.98" target="_blank">http://10.10.10.98</a>&#34;</span> -H <span class="code-snippet__string">&#34;X-Forwarded-For: 10.10.10.5&#34;</span></span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx_Server日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.99 - - [11/Dec/2019:09:07:33 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;10.10.10.5&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_1日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.1 - - [11/Dec/2019:09:07:32 +0800] &#34;GET / HTTP/1.1&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;10.10.10.5&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_2日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.98 - - [11/Dec/2019:09:07:32 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;10.10.10.5&#34;</span></code></pre></section><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时在Nginx_Server中无法获取客户端真实IP。</p><h1 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 1.8em;color: #5A90C0;margin: 1em auto;text-align: center;border-bottom: 1px solid #5A90C0;">使用X-Forwarded-For+Nginx readip模块获取</h1><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">使用<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">realip</code>模块可以获取客户端真实IP，该方法也是目前使用最多最有效的方法。</p><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">查看nginx的编译参数：<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">/opt/nginx/sbin/nginx -V</code>(如果是yum安装Nginx，则该模块是默认安装的，我这里是使用编译安装的)</p><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.23106060606060605" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="792" src="https://wechat2rss.xlab.app/img-proxy/?k=b7e4d6af&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakmiczccbqNf3MaYWllsVtYhsicFVThJv8nfVqCk6A0as9ItgBX7iaR2ib4EXeZonC7tPrqlPuLlDHBPQ%2F640%3Fwx_fmt%3Dpng"/></figure><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">set_real_ip_from</code>：表示从何处获取真实IP，只认可自己信赖的IP，可以是网段，也可以设置多个。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">real_ip_header</code>：表示从哪个header属性中获取真实IP。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">real_ip_recursive</code>：递归检索真实IP，如果从X-Forwarded-For中获取，则需要递归检索；如果中X-Real-IP中获取，无需递归。</section></li></ul><h2 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 24px;color: #5A90C0;padding-left: 10px;margin: 1em auto;border-left: 3px solid #5A90C0;">代理与服务器配置</h2><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx_Server配置：<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">vim /opt/nginx/conf/nginx.conf</code>，主要是在Server中新增代理服务器信息。</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">    log_format  main  <span class="code-snippet__string">&#39;$remote_addr - $remote_user [$time_local] &#34;$request&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;$status $body_bytes_sent &#34;$http_referer&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;&#34;$http_user_agent&#34; &#34;$http_x_forwarded_for&#34;&#39;</span>;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    access_log  logs/access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    # ************* 省略了中间的配置</span></code><code><span class="code-snippet_outer">    </span></code><code><span class="code-snippet_outer">    server {</span></code><code><span class="code-snippet_outer">        listen       <span class="code-snippet__number">80</span>;</span></code><code><span class="code-snippet_outer">        server_name  localhost;</span></code><code><span class="code-snippet_outer">        # 注意这里的key value之间使用Tab而不要使用单个空格</span></code><code><span class="code-snippet_outer">        set_real_ip_from        <span class="code-snippet__number">10.10</span><span class="code-snippet__number">.10</span><span class="code-snippet__number">.98</span>;</span></code><code><span class="code-snippet_outer">        set_real_ip_from        <span class="code-snippet__number">10.10</span><span class="code-snippet__number">.10</span><span class="code-snippet__number">.99</span>;</span></code><code><span class="code-snippet_outer">        real_ip_header  X-Forwarded-For;</span></code><code><span class="code-snippet_outer">        real_ip_recursive       on;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #charset koi8-r;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #access_log  logs/host.access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        location / {</span></code><code><span class="code-snippet_outer">            root   html;</span></code><code><span class="code-snippet_outer">            index  index.html index.htm;</span></code><code><span class="code-snippet_outer">        }</span></code><code><span class="code-snippet_outer">    }</span></code></pre></section><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">检查配置文件是否正确：<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">/opt/nginx/sbin/nginx -t</code>，然后重新加载配置文件：<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">/opt/nginx/sbin/nginx -s reload</code></p><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_1配置：<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">vim /opt/nginx/conf/nginx.conf</code>，设置代理并且设置XFF字段信息。</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">    log_format  main  <span class="code-snippet__string">&#39;$remote_addr - $remote_user [$time_local] &#34;$request&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;$status $body_bytes_sent &#34;$http_referer&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;&#34;$http_user_agent&#34; &#34;$http_x_forwarded_for&#34;&#39;</span>;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    access_log  logs/access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    # ************* 省略了中间的配置</span></code><code><span class="code-snippet_outer">    </span></code><code><span class="code-snippet_outer">    server {</span></code><code><span class="code-snippet_outer">        listen       <span class="code-snippet__number">80</span>;</span></code><code><span class="code-snippet_outer">        server_name  localhost;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #charset koi8-r;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #access_log  logs/host.access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        location / {</span></code><code><span class="code-snippet_outer">            #root   html;</span></code><code><span class="code-snippet_outer">            #index  index.html index.htm;</span></code><code><span class="code-snippet_outer">            # 注意这里的key value之间使用Tab</span></code><code><span class="code-snippet_outer">            proxy_pass  http:<span class="code-snippet__comment">//10.10.10.99;</span></span></code><code><span class="code-snippet_outer">            proxy_set_header    Host    $http_host;</span></code><code><span class="code-snippet_outer">            proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;</span></code><code><span class="code-snippet_outer">        }</span></code><code><span class="code-snippet_outer">    }</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_2配置：<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">vim /opt/nginx/conf/nginx.conf</code>，设置代理并且设置XFF字段信息。</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">    log_format  main  <span class="code-snippet__string">&#39;$remote_addr - $remote_user [$time_local] &#34;$request&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;$status $body_bytes_sent &#34;$http_referer&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;&#34;$http_user_agent&#34; &#34;$http_x_forwarded_for&#34;&#39;</span>;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    access_log  logs/access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    # ************* 省略了中间的配置</span></code><code><span class="code-snippet_outer">    </span></code><code><span class="code-snippet_outer">    server {</span></code><code><span class="code-snippet_outer">        listen       <span class="code-snippet__number">80</span>;</span></code><code><span class="code-snippet_outer">        server_name  localhost;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #charset koi8-r;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #access_log  logs/host.access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        location / {</span></code><code><span class="code-snippet_outer">            #root   html;</span></code><code><span class="code-snippet_outer">            #index  index.html index.htm;</span></code><code><span class="code-snippet_outer">            # 注意这里的key value之间使用Tab</span></code><code><span class="code-snippet_outer">            proxy_pass  http:<span class="code-snippet__comment">//10.10.10.100;</span></span></code><code><span class="code-snippet_outer">            proxy_set_header    Host    $http_host;</span></code><code><span class="code-snippet_outer">            proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;</span></code><code><span class="code-snippet_outer">        }</span></code><code><span class="code-snippet_outer">    }</span></code></pre></section><h2 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 24px;color: #5A90C0;padding-left: 10px;margin: 1em auto;border-left: 3px solid #5A90C0;">正常访问的日志情况</h2><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时我们的网络架构为：</p><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.34519572953736655" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="843" src="https://wechat2rss.xlab.app/img-proxy/?k=90653cb5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakmiczccbqNf3MaYWllsVtYhamfxIXlltjF7lu97kIVrGhWWFHqQDYnsKshU8Fq3EDkIGQr89IckUg%2F640%3Fwx_fmt%3Dpng"/></figure><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 客户端使用命令访问</span></span></code><code><span class="code-snippet_outer">curl -XGET <span class="code-snippet__string">&#34;<a href="http://10.10.10.98" target="_blank">http://10.10.10.98</a>&#34;</span></span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx_Server日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.1 - - [09/Dec/2019:09:19:21 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;10.10.10.1, 10.10.10.98&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_1日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.1 - - [09/Dec/2019:09:19:21 +0800] &#34;GET / HTTP/1.1&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;-&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_2日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.98 - - [09/Dec/2019:09:19:21 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;10.10.10.1&#34;</span></code></pre></section><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时在Nginx_Server中remote_addr就是用户的真实IP。</p><h2 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 24px;color: #5A90C0;padding-left: 10px;margin: 1em auto;border-left: 3px solid #5A90C0;">伪造XFF的日志情况</h2><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时我们的网络架构为：</p><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.34519572953736655" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="843" src="https://wechat2rss.xlab.app/img-proxy/?k=90653cb5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakmiczccbqNf3MaYWllsVtYhamfxIXlltjF7lu97kIVrGhWWFHqQDYnsKshU8Fq3EDkIGQr89IckUg%2F640%3Fwx_fmt%3Dpng"/></figure><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 客户端访问时使用XFF</span></span></code><code><span class="code-snippet_outer">curl -XGET <span class="code-snippet__string">&#34;<a href="http://10.10.10.98" target="_blank">http://10.10.10.98</a>&#34;</span> -H <span class="code-snippet__string">&#34;X-Forwarded-For: 10.10.10.5&#34;</span></span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx_Server日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.1 - - [09/Dec/2019:09:20:03 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;10.10.10.5, 10.10.10.1, 10.10.10.98&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_1日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.1 - - [09/Dec/2019:09:20:03 +0800] &#34;GET / HTTP/1.1&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;10.10.10.5&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_2日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.98 - - [09/Dec/2019:09:20:03 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;10.10.10.5, 10.10.10.1&#34;</span></code></pre></section><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时在Nginx_Server中XFF字段依旧代表客户端的真实IP，并且伪造的IP并没有传递到Nginx_Server中。</p><h2 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 24px;color: #5A90C0;padding-left: 10px;margin: 1em auto;border-left: 3px solid #5A90C0;">使用代理的日志情况</h2><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时我们的网络架构为：</p><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.32242990654205606" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="856" src="https://wechat2rss.xlab.app/img-proxy/?k=8d389ed1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakmiczccbqNf3MaYWllsVtYhiaTgfawBIniaMVeZiaqdDYZtDic8DI3oiaKsQK2E8CaeCMosSCmicQTITazQ%2F640%3Fwx_fmt%3Dpng"/></figure><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 客户端使用命令访问，我这里配置的是终端全局代理，所以不用单独指定代理参数</span></span></code><code><span class="code-snippet_outer">curl -XGET <span class="code-snippet__string">&#34;<a href="http://47.x.x.156" target="_blank">http://47.x.x.156</a>&#34;</span></span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx_Server日志</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">43.x.x.74 - - [09/Dec/2019:14:58:02 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;43.x.x.74, 172.16.178.76&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_1日志</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">43.x.x.74 - - [09/Dec/2019:14:58:02 +0800] &#34;GET / HTTP/1.1&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;-&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_2日志</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">172.16.178.76 - - [09/Dec/2019:14:58:02 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;43.x.x.74&#34;</span></code></pre></section><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时在Nginx_Server中XFF字段就是用户的代理IP，并且可以看到单独使用Nginx无法获取客户端的真实IP。</p><h1 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 1.8em;color: #5A90C0;margin: 1em auto;text-align: center;border-bottom: 1px solid #5A90C0;">使用X-Forwarded-For与安全设置获取</h1><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">在第一层代理服务器位置，处理用户传递的XFF信息，忽略用户的XFF值。</p><h2 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 24px;color: #5A90C0;padding-left: 10px;margin: 1em auto;border-left: 3px solid #5A90C0;">代理与服务器配置</h2><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx_Server配置：<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">vim /opt/nginx/conf/nginx.conf</code>，Nginx_Server配置不作任何修改，默认即可。</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">    log_format  main  <span class="code-snippet__string">&#39;$remote_addr - $remote_user [$time_local] &#34;$request&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;$status $body_bytes_sent &#34;$http_referer&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;&#34;$http_user_agent&#34; &#34;$http_x_forwarded_for&#34;&#39;</span>;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    access_log  logs/access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    # ************* 省略了中间的配置</span></code><code><span class="code-snippet_outer">    </span></code><code><span class="code-snippet_outer">    server {</span></code><code><span class="code-snippet_outer">        listen       <span class="code-snippet__number">80</span>;</span></code><code><span class="code-snippet_outer">        server_name  localhost;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #charset koi8-r;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #access_log  logs/host.access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        location / {</span></code><code><span class="code-snippet_outer">            root   html;</span></code><code><span class="code-snippet_outer">            index  index.html index.htm;</span></code><code><span class="code-snippet_outer">        }</span></code><code><span class="code-snippet_outer">    }</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_1配置：<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">vim /opt/nginx/conf/nginx.conf</code>，定义XFF为remote_addr。</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">    log_format  main  <span class="code-snippet__string">&#39;$remote_addr - $remote_user [$time_local] &#34;$request&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;$status $body_bytes_sent &#34;$http_referer&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;&#34;$http_user_agent&#34; &#34;$http_x_forwarded_for&#34;&#39;</span>;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    access_log  logs/access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    # ************* 省略了中间的配置</span></code><code><span class="code-snippet_outer">    </span></code><code><span class="code-snippet_outer">    server {</span></code><code><span class="code-snippet_outer">        listen       <span class="code-snippet__number">80</span>;</span></code><code><span class="code-snippet_outer">        server_name  localhost;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #charset koi8-r;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #access_log  logs/host.access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        location / {</span></code><code><span class="code-snippet_outer">            #root   html;</span></code><code><span class="code-snippet_outer">            #index  index.html index.htm;</span></code><code><span class="code-snippet_outer">            # 注意这里的key value之间使用Tab</span></code><code><span class="code-snippet_outer">            proxy_pass  http:<span class="code-snippet__comment">//10.10.10.99;</span></span></code><code><span class="code-snippet_outer">            proxy_set_header    X-Forwarded-For $remote_addr;</span></code><code><span class="code-snippet_outer">        }</span></code><code><span class="code-snippet_outer">    }</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_2配置：<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">vim /opt/nginx/conf/nginx.conf</code>，只做代理转发。</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">    log_format  main  <span class="code-snippet__string">&#39;$remote_addr - $remote_user [$time_local] &#34;$request&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;$status $body_bytes_sent &#34;$http_referer&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;&#34;$http_user_agent&#34; &#34;$http_x_forwarded_for&#34;&#39;</span>;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    access_log  logs/access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    # ************* 省略了中间的配置</span></code><code><span class="code-snippet_outer">    </span></code><code><span class="code-snippet_outer">    server {</span></code><code><span class="code-snippet_outer">        listen       <span class="code-snippet__number">80</span>;</span></code><code><span class="code-snippet_outer">        server_name  localhost;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #charset koi8-r;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #access_log  logs/host.access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        location / {</span></code><code><span class="code-snippet_outer">            #root   html;</span></code><code><span class="code-snippet_outer">            #index  index.html index.htm;</span></code><code><span class="code-snippet_outer">            # 注意这里的key value之间使用Tab</span></code><code><span class="code-snippet_outer">            proxy_pass  http:<span class="code-snippet__comment">//10.10.10.100;</span></span></code><code><span class="code-snippet_outer">        }</span></code><code><span class="code-snippet_outer">    }</span></code></pre></section><h2 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 24px;color: #5A90C0;padding-left: 10px;margin: 1em auto;border-left: 3px solid #5A90C0;">正常访问的日志情况</h2><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时我们的网络架构为：</p><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.34519572953736655" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="843" src="https://wechat2rss.xlab.app/img-proxy/?k=90653cb5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakmiczccbqNf3MaYWllsVtYhamfxIXlltjF7lu97kIVrGhWWFHqQDYnsKshU8Fq3EDkIGQr89IckUg%2F640%3Fwx_fmt%3Dpng"/></figure><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 客户端使用命令访问</span></span></code><code><span class="code-snippet_outer">curl -XGET <span class="code-snippet__string">&#34;<a href="http://10.10.10.98" target="_blank">http://10.10.10.98</a>&#34;</span></span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx_Server日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.99 - - [09/Dec/2019:09:37:39 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;10.10.10.1&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_1日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.1 - - [09/Dec/2019:09:37:39 +0800] &#34;GET / HTTP/1.1&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;-&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_2日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.98 - - [09/Dec/2019:09:37:39 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;10.10.10.1&#34;</span></code></pre></section><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时在Nginx_Server中XFF字段就代表用户的真实IP。</p><h2 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 24px;color: #5A90C0;padding-left: 10px;margin: 1em auto;border-left: 3px solid #5A90C0;">伪造XFF的日志情况</h2><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时我们的网络架构为：</p><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.34519572953736655" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="843" src="https://wechat2rss.xlab.app/img-proxy/?k=90653cb5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakmiczccbqNf3MaYWllsVtYhamfxIXlltjF7lu97kIVrGhWWFHqQDYnsKshU8Fq3EDkIGQr89IckUg%2F640%3Fwx_fmt%3Dpng"/></figure><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 客户端访问时使用XFF</span></span></code><code><span class="code-snippet_outer">curl -XGET <span class="code-snippet__string">&#34;<a href="http://10.10.10.98" target="_blank">http://10.10.10.98</a>&#34;</span> -H <span class="code-snippet__string">&#34;X-Forwarded-For: 10.10.10.5&#34;</span></span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx_Server日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.99 - - [09/Dec/2019:09:41:53 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;10.10.10.1&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_1日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.1 - - [09/Dec/2019:09:41:53 +0800] &#34;GET / HTTP/1.1&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;10.10.10.5&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_2日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.98 - - [09/Dec/2019:09:41:53 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;10.10.10.1&#34;</span></code></pre></section><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时在Nginx_Server中XFF字段依旧代表客户端的真实IP，并且伪造的IP并没有传递到Nginx_Server中。</p><h2 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 24px;color: #5A90C0;padding-left: 10px;margin: 1em auto;border-left: 3px solid #5A90C0;">使用代理的日志情况</h2><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时我们的网络架构为：</p><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.32242990654205606" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="856" src="https://wechat2rss.xlab.app/img-proxy/?k=8d389ed1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakmiczccbqNf3MaYWllsVtYhiaTgfawBIniaMVeZiaqdDYZtDic8DI3oiaKsQK2E8CaeCMosSCmicQTITazQ%2F640%3Fwx_fmt%3Dpng"/></figure><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 客户端使用命令访问，我这里配置的是终端全局代理，所以不用单独指定代理参数</span></span></code><code><span class="code-snippet_outer">curl -XGET <span class="code-snippet__string">&#34;<a href="http://47.x.x.156" target="_blank">http://47.x.x.156</a>&#34;</span></span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx_Server日志</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">172.16.178.77 - - [09/Dec/2019:15:07:45 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;43.x.x.74&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_1日志</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">43.x.x.74 - - [09/Dec/2019:15:07:44 +0800] &#34;GET / HTTP/1.1&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;-&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_2日志</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">172.16.178.76 - - [09/Dec/2019:15:07:44 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;43.x.x.74&#34;</span></code></pre></section><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时在Nginx_Server中XFF字段就是用户的代理IP，并且可以看到单独使用Nginx无法获取客户端的真实IP。</p><h1 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 1.8em;color: #5A90C0;margin: 1em auto;text-align: center;border-bottom: 1px solid #5A90C0;">使用X-Real-IP</h1><h2 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 24px;color: #5A90C0;padding-left: 10px;margin: 1em auto;border-left: 3px solid #5A90C0;">代理与服务器配置</h2><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx_Server配置：<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">vim /opt/nginx/conf/nginx.conf</code>，将日志中的remote_addr替换为http_x_real_ip。</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">  # 注意日志配置的第一个字段，将remote_addr修改为http_x_real_ip</span></code><code><span class="code-snippet_outer">  log_format  main  <span class="code-snippet__string">&#39;$http_x_real_ip - $remote_user [$time_local] &#34;$request&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;$status $body_bytes_sent &#34;$http_referer&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;&#34;$http_user_agent&#34; &#34;$http_x_forwarded_for&#34;&#39;</span>;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    access_log  logs/access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    # ************* 省略了中间的配置</span></code><code><span class="code-snippet_outer">    </span></code><code><span class="code-snippet_outer">    server {</span></code><code><span class="code-snippet_outer">        listen       <span class="code-snippet__number">80</span>;</span></code><code><span class="code-snippet_outer">        server_name  localhost;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #charset koi8-r;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #access_log  logs/host.access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        location / {</span></code><code><span class="code-snippet_outer">            root   html;</span></code><code><span class="code-snippet_outer">            index  index.html index.htm;</span></code><code><span class="code-snippet_outer">        }</span></code><code><span class="code-snippet_outer">    }</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_1配置：<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">vim /opt/nginx/conf/nginx.conf</code>，设置代理与x-real-ip字段。</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">    log_format  main  <span class="code-snippet__string">&#39;$remote_addr - $remote_user [$time_local] &#34;$request&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;$status $body_bytes_sent &#34;$http_referer&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;&#34;$http_user_agent&#34; &#34;$http_x_forwarded_for&#34;&#39;</span>;</span></code><code><span class="code-snippet_outer">    access_log  logs/access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    # ************* 省略了中间的配置</span></code><code><span class="code-snippet_outer">    </span></code><code><span class="code-snippet_outer">    server {</span></code><code><span class="code-snippet_outer">        listen       <span class="code-snippet__number">80</span>;</span></code><code><span class="code-snippet_outer">        server_name  localhost;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #charset koi8-r;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #access_log  logs/host.access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        location / {</span></code><code><span class="code-snippet_outer">            #root   html;</span></code><code><span class="code-snippet_outer">            #index  index.html index.htm;</span></code><code><span class="code-snippet_outer">            # 注意这里的key value之间使用Tab</span></code><code><span class="code-snippet_outer">            proxy_pass  http:<span class="code-snippet__comment">//10.10.10.99;</span></span></code><code><span class="code-snippet_outer">            proxy_set_header    X-Real-IP       $remote_addr;</span></code><code><span class="code-snippet_outer">        }</span></code><code><span class="code-snippet_outer">    }</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_2配置：<code style="font-size: 14px;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin-right: 2px;margin-left: 2px;background-color: rgba(27, 31, 35, 0.05);font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: rgb(90, 144, 192);">vim /opt/nginx/conf/nginx.conf</code>，只做代理转发。</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="typescript"><code><span class="code-snippet_outer">    log_format  main  <span class="code-snippet__string">&#39;$remote_addr - $remote_user [$time_local] &#34;$request&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;$status $body_bytes_sent &#34;$http_referer&#34; &#39;</span></span></code><code><span class="code-snippet_outer">                      <span class="code-snippet__string">&#39;&#34;$http_user_agent&#34; &#34;$http_x_forwarded_for&#34;&#39;</span>;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    access_log  logs/access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">    # ************* 省略了中间的配置</span></code><code><span class="code-snippet_outer">    </span></code><code><span class="code-snippet_outer">    server {</span></code><code><span class="code-snippet_outer">        listen       <span class="code-snippet__number">80</span>;</span></code><code><span class="code-snippet_outer">        server_name  localhost;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #charset koi8-r;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        #access_log  logs/host.access.log  main;</span></code><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer"><br/></span></code><code><span class="code-snippet_outer">        location / {</span></code><code><span class="code-snippet_outer">            #root   html;</span></code><code><span class="code-snippet_outer">            #index  index.html index.htm;</span></code><code><span class="code-snippet_outer">            # 注意这里的key value之间使用Tab</span></code><code><span class="code-snippet_outer">            proxy_pass  http:<span class="code-snippet__comment">//10.10.10.100;</span></span></code><code><span class="code-snippet_outer">        }</span></code><code><span class="code-snippet_outer">    }</span></code></pre></section><h2 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 24px;color: #5A90C0;padding-left: 10px;margin: 1em auto;border-left: 3px solid #5A90C0;">正常访问的日志情况</h2><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时我们的网络架构为：</p><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.34519572953736655" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="843" src="https://wechat2rss.xlab.app/img-proxy/?k=90653cb5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakmiczccbqNf3MaYWllsVtYhamfxIXlltjF7lu97kIVrGhWWFHqQDYnsKshU8Fq3EDkIGQr89IckUg%2F640%3Fwx_fmt%3Dpng"/></figure><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 客户端使用命令访问</span></span></code><code><span class="code-snippet_outer">curl -XGET <span class="code-snippet__string">&#34;<a href="http://10.10.10.98" target="_blank">http://10.10.10.98</a>&#34;</span></span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx_Server日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.1 - - [09/Dec/2019:09:55:16 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;-&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_1日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.1 - - [09/Dec/2019:09:55:16 +0800] &#34;GET / HTTP/1.1&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;-&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_2日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.98 - - [09/Dec/2019:09:55:16 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;-&#34;</span></code></pre></section><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时在Nginx_Server中第一个字段就代表客户端的真实IP。</p><h2 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 24px;color: #5A90C0;padding-left: 10px;margin: 1em auto;border-left: 3px solid #5A90C0;">伪造XFF的日志情况</h2><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时我们的网络架构为：</p><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.34519572953736655" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="843" src="https://wechat2rss.xlab.app/img-proxy/?k=90653cb5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakmiczccbqNf3MaYWllsVtYhamfxIXlltjF7lu97kIVrGhWWFHqQDYnsKshU8Fq3EDkIGQr89IckUg%2F640%3Fwx_fmt%3Dpng"/></figure><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 客户端访问时使用XFF</span></span></code><code><span class="code-snippet_outer">curl -XGET <span class="code-snippet__string">&#34;<a href="http://10.10.10.98" target="_blank">http://10.10.10.98</a>&#34;</span> -H <span class="code-snippet__string">&#34;X-Forwarded-For: 10.10.10.5&#34;</span></span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx_Server日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.1 - - [09/Dec/2019:10:00:38 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;10.10.10.5&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_1日志</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.1 - - [09/Dec/2019:10:00:38 +0800] &#34;GET / HTTP/1.1&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;10.10.10.5&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_2日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">10.10.10.98 - - [09/Dec/2019:10:00:38 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;10.10.10.5&#34;</span></code></pre></section><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时在Nginx_Server中第一个字段依旧代表客户端真实IP，伪造的IP在XFF字段中。</p><h2 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 24px;color: #5A90C0;padding-left: 10px;margin: 1em auto;border-left: 3px solid #5A90C0;">使用代理的日志情况</h2><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时我们的网络架构为：</p><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.32242990654205606" style="display: block;margin-right: auto;margin-left: auto;width: 100%;" data-type="png" data-w="856" src="https://wechat2rss.xlab.app/img-proxy/?k=8d389ed1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakmiczccbqNf3MaYWllsVtYhiaTgfawBIniaMVeZiaqdDYZtDic8DI3oiaKsQK2E8CaeCMosSCmicQTITazQ%2F640%3Fwx_fmt%3Dpng"/></figure><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 客户端使用命令访问，我这里配置的是终端全局代理，所以不用单独指定代理参数</span></span></code><code><span class="code-snippet_outer">curl -XGET <span class="code-snippet__string">&#34;<a href="http://47.x.x.156" target="_blank">http://47.x.x.156</a>&#34;</span></span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx_Server日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">43.x.x.74 - - [09/Dec/2019:15:16:05 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;-&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_1日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">43.x.x.74 - - [09/Dec/2019:15:16:05 +0800] &#34;GET / HTTP/1.1&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;-&#34;</span></code></pre></section><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Proxy_2日志：</section></li></ul><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="tex"><code style="border-radius: 0px;white-space: pre;font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;display: -webkit-box !important;"><span class="code-snippet_outer" style="line-height: 26px;">172.16.178.76 - - [09/Dec/2019:15:16:05 +0800] &#34;GET / HTTP/1.0&#34; 200 612 &#34;-&#34; &#34;curl/7.64.1&#34; &#34;-&#34;</span></code></pre></section><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">此时在Nginx_Server中第一个字段依旧代表客户端真实IP。</p><h1 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 1.8em;color: #5A90C0;margin: 1em auto;text-align: center;border-bottom: 1px solid #5A90C0;">云厂商如何获取客户端真实IP</h1><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">阿里云 如何获取客户端真实IP(<a href="https://help.aliyun.com/document_detail/54007.html)" target="_blank">https://help.aliyun.com/document_detail/54007.html)</a></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">使用知道创宇云安全后如何获取访客真实IP(<a href="http://help.yunaq.com/faq/67/index.html)" target="_blank">http://help.yunaq.com/faq/67/index.html)</a></section></li></ul><h1 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 1.8em;color: #5A90C0;margin: 1em auto;text-align: center;border-bottom: 1px solid #5A90C0;">总结一下</h1><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">关于服务端获取客户端的真实IP可以实际场景实际分析吧！本文中提到的也只是一种很初级的网络架构。本文的适用范围相对也比较狭窄。</p><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">如果是复杂的网络结构，可以在每一层的产品上对对应厂商进行沟通：是否可以透传用户的真实IP，然后通过每一层的配置将真实IP传递到服务端使用合理的字段进行存储。</p><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">当然了安全本质就是不可信，传递的IP数据是否真实与客户端伪造技术、各层级之间相关配置都息息相关。IP维度也只是后端分析识别的一个维度而已，我们在尽可能保证这个维度的准确度时，不用太过钻牛角尖(除非是精准度要求非常高的场景)。对于中小型的企业，能结合IP、Location、Username、UA、Browser Banner、OS Banner等维度来做一些简单的关联分析即可。</p><p style="padding-top: 8px;padding-bottom: 8px;line-height: 26px;text-align: justify;">以上就是小B做日志分析的前期调研第一篇，小B后续还会写一写关于日志分析的其他文章。(WeChat：Lzero2012)</p><h1 style="margin-top: 40px;margin-bottom: 20px;font-weight: bold;font-size: 1.8em;color: #5A90C0;margin: 1em auto;text-align: center;border-bottom: 1px solid #5A90C0;">参考资料</h1><ul style="" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx多级反向代理下的IP透传(<a href="https://www.cnblogs.com/tea-melon/p/10977516.html)" target="_blank">https://www.cnblogs.com/tea-melon/p/10977516.html)</a></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Nginx之X-Forwarded-For中首个IP一定真实吗？(<a href="https://juejin.im/entry/5bbb6e90f265da0a89304a43)" target="_blank">https://juejin.im/entry/5bbb6e90f265da0a89304a43)</a></section></li></ul></section><p><br/></p>



<p><a href="https://zhuanlan.zhihu.com/p/97550896">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=5e1435d7&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483806%26idx%3D1%26sn%3Ddbd9264bc3fece3bcaa92f18c2dd0bd4%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 16 Dec 2019 08:58:00 +0800</pubDate>
    </item>
    <item>
      <title>攻防视角下的信息收集</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483798&amp;idx=1&amp;sn=b3ff98d502c18a6bd7942ff0862e5cc2</link>
      <description>信息收集是指通过各种方式获取所需的信息。信息收集是信息得以利用的第一步，也是关键的一步。---百度百科</description>
      <content:encoded><![CDATA[<p>
原创 <span>bloodzer0</span> <span>2019-12-09 08:47</span> <span style="display: inline-block;"></span>
</p>

<p>信息收集是指通过各种方式获取所需的信息。信息收集是信息得以利用的第一步，也是关键的一步。---百度百科</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=fa054d2b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6mianBTRVAibiaRfvGW6JkibbLzCLNyJmkzbNjo0o4Rfogx4tV5UUn8ic4hqMd49NGG5ua6rgCFjPutTs6Zg%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section style="font-size: 16px;color: black;padding: 10px;line-height: 1.6;letter-spacing: 0px;word-break: break-word;overflow-wrap: break-word;text-align: left;font-family: &#34;Microsoft Yahei&#34;"><blockquote style="font-size: 0.9em;overflow: auto;color: rgb(106, 115, 125);padding: 10px 10px 10px 20px;margin-bottom: 20px;border-left-color: rgb(255, 177, 27);background: rgb(255, 245, 227);margin-top: -10px;"><p style="font-size: 16px;line-height: 26px;color: rgb(89, 89, 89);">信息收集是指通过各种方式获取所需的信息。信息收集是信息得以利用的第一步，也是关键的一步。---百度百科</p><p style="font-size: 16px;line-height: 26px;color: rgb(89, 89, 89);">信息收集是指黑客为了更加有效地实施渗透攻击而在攻击前或攻击过程中对目标的所有探测活动。</p></blockquote><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);"><strong style="color: black;">背景：</strong> 不论曾经作为白帽子、安全服务工程师还是现在作为甲方安全工程师，都明白信息收集这项工作的重要性。目前网络上关于信息收集的文章数不胜数，那么为什么还要老生常谈？主要是目前网络上的文章更多是站在白帽子或者攻击者的视角下进行展开讨论，但甲方做信息收集的话题没有被提及，本文抛砖引玉，希望更多大佬提出意见。其实是对自己曾经做过的信息收集内容进行一个总结。</p><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">本文通过两个角度来讨论信息收集：攻击方、防守方，它们二者之间在信息收集方向的关系如下图：</p><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="0.5024" style="margin-right: auto;margin-left: auto;width: 100%;border-radius: 5px;display: block;margin-bottom: 15px;" data-type="png" data-w="1250" src="https://wechat2rss.xlab.app/img-proxy/?k=40a82f6d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6mianBTRVAibiaRfvGW6JkibbLzCLAf6LMgM55QpsJrmY0aoNRq8Sbc2Cib0TaLHoUMCic1VXic4XY6oV77lHw%2F640%3Fwx_fmt%3Dpng"/></figure><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">不论是攻击方还是防守方做信息收集工作主要是四种方法：</p><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">社会工程：</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Google Hacking(不一定是Google)；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">社交软件(微信、QQ、朋友圈等等)；</section></li></ul></ul><pre class="custom" style="margin-top: 10px;margin-bottom: 10px;"><code class="hljs" style="overflow-x: auto;padding: 16px;color: #abb2bf;background: #282c34;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;border-radius: 0px;font-size: 12px;-webkit-overflow-scrolling: touch;display: -webkit-box !important;">site:example.com<br/>site:example.com 登录<br/>site:example.com login<br/></code></pre><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">花式工具：各种扫描器与漏洞利用工具、爬虫；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">奇葩技巧：这个主意是靠经验的积累与多看看大佬的文章；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">手工：坚持+耐心</section></li></ul><h1 style="margin-top: 40px;font-weight: bold;font-size: 2em;line-height: 1.1em;padding-top: 16px;padding-bottom: 10px;margin-bottom: 4px;border-bottom: 1px solid rgb(201, 152, 51);text-align: center;"><span style="color: rgb(81, 81, 81);">攻击方视角下的信息收集</span></h1><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">网络上关于攻击方做信息收集的工具、方法都有了很不错的文章，大家搜索&#34;信息收集&#34;关键字就可以获取。攻击方做信息收集讨论两个问题：为什么做信息收集？收集什么与如何收集？</p><h2 style="font-weight: bold;font-size: 24px;line-height: 1.5em;margin-top: 0.5em;margin-bottom: 15px;"><span style="display: inline-block;background-image: linear-gradient(rgb(255, 255, 255) 60%, rgb(255, 177, 27) 100%);background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;color: rgb(81, 81, 81);padding: 2px 13px;margin-right: 3px;height: 50%;">为什么做信息收集？</span></h2><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">要明白的是知己知彼百战百胜，攻击方做信息收集就是一个知彼的过程。做好了这项工作更有利于我们去开展后续的工作。</p><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">举个例子：我们要在SRC平台进行漏洞挖掘，首先我们要做的就是明确SRC平台收录的漏洞范围，其次就是收集收录范围内的可攻击目标(&#34;万物&#34;皆可被攻击)，最后才是对这些目标进行分析漏洞挖掘或渗透的工作。</p><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">其实攻击方在各个阶段做信息收集工作的意义都是为了获取攻击面。在做信息收集之前，你掌握的信息是一个攻击点，通过信息收集你掌握了多个攻击点，这些攻击点有可利用的也有不可利用的，然后通过将这些攻击点连接起来汇成一个攻击面。当我们拥有一个攻击面时就能利用自己掌握的攻击方法找到攻击面中的薄弱点进行攻击，如果我们拥有的攻击面越宽广，那么我们攻击成功的概率也就越高。</p><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);"><strong style="color: black;">对于信息收集结果来说分为：直接可用、间接可用、未来可用三个状态。</strong></p><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">直接可用：结果可以直接进行利用，比如：数据库配置文件泄露等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">间接可用：结果不能直接进行利用，但是可以间接的产生产生效果，比如：后台登录地址；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">未来可用：结果当前时间不能进行可用，但是未来某个时间点可用，比如：新系统上线公告(别疑惑，如果你知道某个系统下周一上线，万一他们没有做安全测试就上线了呢！你的机会就来了)；</section></li></ul><h2 style="font-weight: bold;font-size: 24px;line-height: 1.5em;margin-top: 0.5em;margin-bottom: 15px;"><span style="display: inline-block;background-image: linear-gradient(rgb(255, 255, 255) 60%, rgb(255, 177, 27) 100%);background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;color: rgb(81, 81, 81);padding: 2px 13px;margin-right: 3px;height: 50%;">收集什么与如何收集？</span></h2><h3 style="font-weight: bold;font-size: 20px;line-height: 1.4;padding-top: 10px;margin-top: 10px;margin-bottom: 5px;"><span style="color: rgb(81, 81, 81);font-size: 1em;padding-left: 20px;border-left: 3px solid rgb(249, 191, 69);">企业信息</span></h3><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">企业组织架构：获取攻击入口。</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">企业组成：集团、下属单位等信息；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">部门划分</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">人员信息：姓名、手机号、工号、邮箱(邮箱命名格式：bloodzer0@example.com、blood.zer0@example.com、zer0.blood@example.com)、身份证号、工作职能、所属部门、内部OA默认密码等信息；</section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">企业的供应商或合作商：方便钓鱼或社工时使用。</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">软硬件供应商等信息；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">供应商对接人员信息；</section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">企业备案信息：ICP信息查看、天眼查获取等。</section></li></ul><h3 style="font-weight: bold;font-size: 20px;line-height: 1.4;padding-top: 10px;margin-top: 10px;margin-bottom: 5px;"><span style="color: rgb(81, 81, 81);font-size: 1em;padding-left: 20px;border-left: 3px solid rgb(249, 191, 69);">IT信息</span></h3><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">收集IT信息主要是为了扩大攻击面。</p><h4 style="font-weight: bold;line-height: 1.5em;margin-top: 0.5em;margin-bottom: 4px;font-size: 18px;">域名信息</h4><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">主域名</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">在sitemap、about或SRC的公告上查找企业主域名或业务信息，比如：<a href="https://www.pingan.com/homepage/sitemap.shtml等；" target="_blank">https://www.pingan.com/homepage/sitemap.shtml等；</a></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">通过HTTPS的证书查看主域名信息；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">通过whois反向查询主域名信息，包括：注册人反查、联系电话反查、联系邮箱反查等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">通过图片、JS、CSS等文件或URL跳转地址获取主域名信息；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">通过反编译APP查看代码获取主域名与子域名信息，推荐工具：ApkIDE；</section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">子域名</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">域名信息查询：nslookup、dig等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">DNS区域传输漏洞：<code style="font-size: 14px;word-wrap: break-word;border-radius: 4px;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: #9b6e23;background-color: #fff5e3;padding: 3px;margin: 3px;">dig @dns-server domain -T axfr</code>；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">域名暴力破解：subDomainBrute、Layer等等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">搜索引擎：<code style="font-size: 14px;word-wrap: break-word;border-radius: 4px;font-family: Operator Mono, Consolas, Monaco, Menlo, monospace;word-break: break-all;color: #9b6e23;background-color: #fff5e3;padding: 3px;margin: 3px;">site: example.com</code>，如果是搜索国内的域名多用Bing与Baidu有的时候比Google效果更好；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);"><a href="https://www.shodan.io/、https://fofa.so/等类似站点；" target="_blank">https://www.shodan.io/、https://fofa.so/等类似站点；</a></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">其他：crossdomain.xml、爬虫(慎用爬虫)；</section></li></ul></ul><h4 style="font-weight: bold;line-height: 1.5em;margin-top: 0.5em;margin-bottom: 4px;font-size: 18px;">网络信息</h4><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">IP及IP网段：服务器真实IP、是否有C段IP或B段IP；如果没有CDN或F5等类似设备的情况下，可以直接ping获取服务器真实IP，如果有CDN或F5等类似设备的情况下，可以通过以下方法获取，但是结果不一定准确：</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">超级ping、多地ping：<a href="https://ping.chinaz.com/，" target="_blank">https://ping.chinaz.com/，</a> 判断是否有CDN也可以通过此种方式。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">通过二级域名：只要不是所有的二级域名都处于CDN的接入中，可以通过二级域名来获取真实IP；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">nslookup：找一些国外偏僻的DNS解析服务器进行DNS查询，大部分CDN只针对国内市场。</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">traceroute</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">透过F5获取服务器真实IP](<a href="http://www.lewisec.com/2017/06/13/Get_the_real_IP_through_F5/)；" target="_blank">http://www.lewisec.com/2017/06/13/Get_the_real_IP_through_F5/)；</a></section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">收集常用的CDN IP、云SLB IP、云弹性IP等IP集合；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">XSS漏洞、DDoS、邮件订阅等；</section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">网络架构</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">应用系统访问架构(Client --&gt; [CDN] --&gt; [SLB] --&gt; Server)等信息；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">网络设备：路由器、交换机、防火墙等网络与网络安全设备信息；</section></li></ul></ul><h4 style="font-weight: bold;line-height: 1.5em;margin-top: 0.5em;margin-bottom: 4px;font-size: 18px;">服务器信息</h4><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">服务器操作系统</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">操作系统类型与版本信息：操作系统识别工具；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">操作系统补丁信息：服务器安全扫描工具；</section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">服务器开放端口及服务</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">端口信息：端口扫描工具</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">服务版本信息：服务识别工具；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">服务是否存在未授权访问：未授权访问扫描；</section></li></ul></ul><h4 style="font-weight: bold;line-height: 1.5em;margin-top: 0.5em;margin-bottom: 4px;font-size: 18px;">应用信息</h4><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">Web应用</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">CMS信息：CMS识别工具；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">中间件、Web容器、Web服务器指纹：默认文件或路径、报错信息、HTTP Response信息、Chrome Wappalyzer插件等其他指纹识别工具；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">WAF判断：是否有WAF，WAF指纹识别(wafw00f、sqlmap的waf脚本、nmap的http-waf-detect和http-waf-fingerprint脚本)；</section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">移动应用：APP、H5、公众号、小程序：关键字搜索</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">其他应用信息</section></li></ul><h3 style="font-weight: bold;font-size: 20px;line-height: 1.4;padding-top: 10px;margin-top: 10px;margin-bottom: 5px;"><span style="color: rgb(81, 81, 81);font-size: 1em;padding-left: 20px;border-left: 3px solid rgb(249, 191, 69);">敏感信息</span></h3><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">收集敏感信息更多是找到比较精准的攻击入口或直接利用信息收集结果。</p><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">代码信息</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">GitHub、码云等代码托管平台；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">代码备份文件(以前存在打包备份的代码文件存放在网站目录下)；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">代码文件：网站对代码脚本未执行解析导致可以直接下载；</section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">敏感文件</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">测试文件：robots.txt、test.php、info.php等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">配置文件：数据库配置文件等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">PDF或图片：很多PDF或图片中包含敏感信息，比如：PDF文件中包含保单完整信息；图片中包含身份证信息等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">前端代码：HTML源代码、JS代码中泄露敏感信息；</section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">敏感目录</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">仓库托管默认文件夹：.git、.svn、.bzr等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">管理后台目录：目录扫描工具；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">接口目录与地址；</section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">文档信息</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">合同、产品或项目文档、人力资源文档、战略规划文档等；</section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">账号密码信息</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">内部运维开发系统账号密码，比如：Zabbix、Jenkins、GitLab等平台的账号密码；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">使用的第三方系统账号密码，比如：堡垒机、防火墙等其他网络设备与网络安全设备账号密码；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">默认密码信息：比如：OA、邮箱、通讯工具等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">云平台Token：阿里云、亚马逊云、七牛云等；</section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">其他信息</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">敏感数据：某些企业内部没有大文件共享平台时，会使用网盘、U盘等类似工具共享敏感数据；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">历史漏洞信息：乌云镜像、历史漏洞中暴露出来的信息；</section></li></ul></ul><h1 style="margin-top: 40px;font-weight: bold;font-size: 2em;line-height: 1.1em;padding-top: 16px;padding-bottom: 10px;margin-bottom: 4px;border-bottom: 1px solid rgb(201, 152, 51);text-align: center;"><span style="color: rgb(81, 81, 81);">防守方视角下的信息收集</span></h1><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">防守方做信息收集也讨论两个问题：为什么做信息收集？收集什么与怎么收集？</p><h2 style="font-weight: bold;font-size: 24px;line-height: 1.5em;margin-top: 0.5em;margin-bottom: 15px;"><span style="display: inline-block;background-image: linear-gradient(rgb(255, 255, 255) 60%, rgb(255, 177, 27) 100%);background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;color: rgb(81, 81, 81);padding: 2px 13px;margin-right: 3px;height: 50%;">为什么要做信息收集</span></h2><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">要明白的是知己知彼百战百胜，防守方做信息收集就是一个知己的过程。做这项工作的目的主要是为了安全摸底，了解企业安全现状与探知未知风险。</p><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">例1：了解服务器端口开放信息、补丁信息等，是为了了解服务器所面临的安全风险，方便我们后续推进安全措施。</p><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">例2：收集情报信息，是为了了解企业正在面对或即将面对的风险，根据情报作出安全响应动作。</p><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">防守方在做信息收集的过程就是在不断摸清安全风险，然后通过安全方案来解决风险。当防守方得到的信息收集结果越丰富，对自身安全状况了解也就越清晰，通过对抗的思路防守者也就明白应该如何最优的去解决这些安全风险。</p><h2 style="font-weight: bold;font-size: 24px;line-height: 1.5em;margin-top: 0.5em;margin-bottom: 15px;"><span style="display: inline-block;background-image: linear-gradient(rgb(255, 255, 255) 60%, rgb(255, 177, 27) 100%);background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;color: rgb(81, 81, 81);padding: 2px 13px;margin-right: 3px;height: 50%;">收集什么与如何收集？</span></h2><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">如开篇中的图片，防守方信息收集的内容是包含攻击方的信息收集内容的。所以攻击方收集的内容防守方也必须收集，而且信息准确度要求更高。</p><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">对于防守方做信息收集主要有两个途径：</p><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">黑盒收集：主要就是攻击方做信息收集的方法；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">白盒收集：利用内部平台和已知信息做收集；</section></li></ul><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">对于防守方做信息收集内容主要包括两个大的方向：管理类与技术类。</p><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">在本文中主要从技术角度出发，分析容易出现安全风险的项：</p><h3 style="font-weight: bold;font-size: 20px;line-height: 1.4;padding-top: 10px;margin-top: 10px;margin-bottom: 5px;"><span style="color: rgb(81, 81, 81);font-size: 1em;padding-left: 20px;border-left: 3px solid rgb(249, 191, 69);">IT资产</span></h3><h4 style="font-weight: bold;line-height: 1.5em;margin-top: 0.5em;margin-bottom: 4px;font-size: 18px;">域名资产</h4><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">关注内容：</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">域名基础信息：注册邮箱、注册联系人、注册时间、过期时间(防止出现域名过期被抢注)；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">域名是否使用HTTPS(监管要求以及防止网络嗅探攻击)；</section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">收集方式：</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">黑盒收集；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">从域名注册商直接查看；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">从Nginx或其他Web服务器、网关配置文件中查看；</section></li></ul></ul><h4 style="font-weight: bold;line-height: 1.5em;margin-top: 0.5em;margin-bottom: 4px;font-size: 18px;">服务器资产</h4><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">关注内容</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">操作系统：类型及详细的版本信息、操作系统补丁信息等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">服务信息：系统运行服务、服务版本信息与配置信息、服务绑定端口信息等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">运行状态：CPU、网络IO、磁盘IO等信息；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">细粒度信息：软件库版本信息等；</section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">收集方式：</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">黑盒收集；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">手工Excel整理；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">云管理平台查看或自动获取(可以使用API进行自动获取)；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">利用入侵检测系统等获取服务器信息；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">利用运维监控系统收集服务器信息；</section></li></ul></ul><h4 style="font-weight: bold;line-height: 1.5em;margin-top: 0.5em;margin-bottom: 4px;font-size: 18px;">网络资产</h4><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">关注内容：</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">网络架构：IP与网段信息、网络划分信息(生产、测试、办公、DMZ)</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">网络访问控制信息；</section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">收集方式：</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">内部网络拓扑图；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">查看防火墙规则；</section></li></ul></ul><h4 style="font-weight: bold;line-height: 1.5em;margin-top: 0.5em;margin-bottom: 4px;font-size: 18px;">设备资产</h4><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">关注内容：网络设备、安全设备、IDC机房等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">收集方式：采购合同、实施方案、网络拓扑图等；</section></li></ul><h4 style="font-weight: bold;line-height: 1.5em;margin-top: 0.5em;margin-bottom: 4px;font-size: 18px;">应用资产</h4><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">关注内容：应用系统、APP、小程序、H5等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">收集方式：</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">黑盒收集；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">查看版本管理系统、发版邮件、持续集成系统等获取；</section></li></ul></ul><h4 style="font-weight: bold;line-height: 1.5em;margin-top: 0.5em;margin-bottom: 4px;font-size: 18px;">代码资产</h4><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">关注内容：代码引入的第三方包、代码依赖的组件等</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">收集方式：代码白盒审计与扫描等；</section></li></ul><h4 style="font-weight: bold;line-height: 1.5em;margin-top: 0.5em;margin-bottom: 4px;font-size: 18px;">账号资产</h4><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">关注内容：特权帐号owner；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">收集方式：人工调研、登录系统查看等；</section></li></ul><h3 style="font-weight: bold;font-size: 20px;line-height: 1.4;padding-top: 10px;margin-top: 10px;margin-bottom: 5px;"><span style="color: rgb(81, 81, 81);font-size: 1em;padding-left: 20px;border-left: 3px solid rgb(249, 191, 69);">数据信息</span></h3><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">关注内容：数据采集方式及内容、数据传输方式、数据存储与使用、数据销毁等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">收集方式：人工调研数据流、查看数据安全产品等；</section></li></ul><h3 style="font-weight: bold;font-size: 20px;line-height: 1.4;padding-top: 10px;margin-top: 10px;margin-bottom: 5px;"><span style="color: rgb(81, 81, 81);font-size: 1em;padding-left: 20px;border-left: 3px solid rgb(249, 191, 69);">情报信息</span></h3><ul style="list-style-type: circle;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">漏洞情报</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">关注内容：各渠道提交的相关漏洞、爆发的新漏洞等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">收集方式：SRC、漏洞平台、应急响应服务、朋友圈、exploitdb、CNVD等；</section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">威胁情报</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">关注内容：羊毛党、恶意攻击(恶意APP、恶意链接)等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">收集方式：社交群聊(聊天机器人)、查看相关论坛贴吧、爬虫等；</section></li></ul><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">事件情报</section></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">关注内容：针对性的攻击事件，比如：蠕虫、病毒、DDoS、勒索等；</section></li><li><section style="margin-top: 5px;margin-bottom: 5px;line-height: 26px;color: rgb(1, 1, 1);">收集方式：事件报告等；</section></li></ul></ul><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);"><strong style="color: black;">汇总来说防守方做信息收集应该关注企业的所有信息，信息收集也要做所有安全关注而未知的项(security should focus on all aspects)。</strong></p><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">但是目前以自己的能力能想到的就这么多，欢迎大家留言补充。</p><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);">附带一张管理视角的信息收集：</p><figure style="margin-top: 10px;margin-bottom: 10px;"><img class="" data-ratio="1.679245283018868" style="margin-right: auto;margin-left: auto;width: 100%;border-radius: 5px;display: block;margin-bottom: 15px;" data-type="jpeg" data-w="636" src="https://wechat2rss.xlab.app/img-proxy/?k=c0f6ba01&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6mianBTRVAibiaRfvGW6JkibbLzCLOzr6Hicx0icxgPkfEZgX4Qdq4hCf2wneiavG4hNicIvqoXWMYvOKqYYpxw%2F640%3Fwx_fmt%3Djpeg"/></figure><p style="margin-bottom: 20px;line-height: 1.8em;color: rgb(58, 58, 58);"><strong style="color: black;">信息收集，一直在谈，却一直未做好的话题。</strong> 未完待续，后期将还有一篇信息收集新说(欢迎加我沟通：Lzero2012)~~~</p></section><p><br/></p>



<p><a href="https://zhuanlan.zhihu.com/p/96049220">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=5c86f928&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483798%26idx%3D1%26sn%3Db3ff98d502c18a6bd7942ff0862e5cc2%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 09 Dec 2019 08:47:00 +0800</pubDate>
    </item>
    <item>
      <title>利用SSH隧道构建多级tunnel</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU2NzY5MDY3MQ==&amp;mid=2247483785&amp;idx=1&amp;sn=a881c0c3d142f7e05aeaf4120bf41444</link>
      <description>01简介隧道是把一种网络协议封装进另外一种网络协议进行传输的技术。SSH构建隧道有三种方式: 本地转发、远程</description>
      <content:encoded><![CDATA[<p>
原创 <span>枫</span> <span>2019-12-02 08:52</span> <span style="display: inline-block;"></span>
</p>

<p>01简介隧道是把一种网络协议封装进另外一种网络协议进行传输的技术。SSH构建隧道有三种方式: 本地转发、远程</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=7f3d17c2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FrbP97vC6miakK0sTVMhNxWYpPvJUjlQJFdx2ficXeO858upibwKibRyhzJQ83mPXEwuyBvB4q9X5icQwldCY9RoTbYg%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" data-color="rgb(48,112,171)" style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);margin-right: auto;margin-left: auto;width: 769px;opacity: 1;transform: rotateZ(0deg);"><section style="padding-right: 0.3em;padding-left: 0.3em;display: inline-block;vertical-align: top;border-top-width: 1px;border-top-style: solid;border-top-color: rgb(48, 112, 171);border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: rgb(48, 112, 171);border-right-width: 1px;border-right-style: solid;border-right-color: rgb(48, 112, 171);font-size: 1.2em;text-align: center;color: rgb(48, 112, 171);box-sizing: border-box;"><p class="count active" style="min-width: 1em;font-size: 1em;"><span style="font-size: 20px;">01</span></p></section><section style="padding-right: 0.3em;padding-left: 0.3em;display: inline-block;vertical-align: top;margin-left: -1px;border-top-width: 1px;border-top-style: solid;border-top-color: rgb(48, 112, 171);border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: rgb(48, 112, 171);border-left-width: 1px;border-left-style: solid;border-left-color: rgb(48, 112, 171);font-size: 1.2em;color: rgb(48, 112, 171);box-sizing: border-box;"><p class="brush active" style="min-width: 1em;font-size: 1em;"><span style="font-size: 20px;">简介</span></p></section></section><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><br/></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">隧道是把一种网络协议封装进另外一种网络协议进行传输的技术。SSH构建隧道有三种方式: 本地转发、远程转发、动态转发。本次只使用到第一、三种方式来构建多级跳板。</span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;"><br/></span></p><section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" data-color="rgb(48,112,171)" style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);margin-right: auto;margin-left: auto;width: 769px;opacity: 1;transform: rotateZ(0deg);"><section style="padding-right: 0.3em;padding-left: 0.3em;display: inline-block;vertical-align: top;border-top-width: 1px;border-top-style: solid;border-top-color: rgb(48, 112, 171);border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: rgb(48, 112, 171);border-right-width: 1px;border-right-style: solid;border-right-color: rgb(48, 112, 171);font-size: 1.2em;text-align: center;color: rgb(48, 112, 171);box-sizing: border-box;"><p class="count active" style="min-width: 1em;font-size: 1em;"><span style="font-size: 20px;">02</span></p></section><section style="padding-right: 0.3em;padding-left: 0.3em;display: inline-block;vertical-align: top;margin-left: -1px;border-top-width: 1px;border-top-style: solid;border-top-color: rgb(48, 112, 171);border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: rgb(48, 112, 171);border-left-width: 1px;border-left-style: solid;border-left-color: rgb(48, 112, 171);font-size: 1.2em;color: rgb(48, 112, 171);box-sizing: border-box;"><p class="brush active" style="min-width: 1em;font-size: 1em;"><span style="font-size: 20px;">原理</span></p></section></section><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><br/></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">本地转发: 将本地的端口与远程机器上的端口构建映射关系。其原理是本地机器上分配一个端口进行侦</span><span style="color: rgb(51, 51, 51);">听，一旦该端口有了连接，就将数据经过通道转发给远端机器上的端口。其格式为:</span></p><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="css"><code><span class="code-snippet_outer"><span class="code-snippet__selector-tag">ssh</span> <span class="code-snippet__selector-tag">-C</span> <span class="code-snippet__selector-tag">-f</span> <span class="code-snippet__selector-tag">-N</span> <span class="code-snippet__selector-tag">-L</span> <span class="code-snippet__selector-tag">listen_port</span><span class="code-snippet__selector-pseudo">:DST_Host</span><span class="code-snippet__selector-pseudo">:DST_port</span> <span class="code-snippet__selector-tag">user</span>@<span class="code-snippet__keyword">Tunnel_Host</span> -p Tunnel_Host_sshport</span></code></pre></section><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><br/></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="font-size: 16px;"><span style="font-weight: 600;color: rgb(51, 51, 51);">动态转发: </span><span style="color: rgb(51, 51, 51);">对于本地转发，存在两个一一对应的端口，分别位于SSH的客户端和服务端; 动态转发的目标端口则是不固定的，其原理是在本地机器上分配了一个端口进行侦听，一旦该端口有了连接，转发出去的数据由发起的请求来决定交给远端机器的哪个端口。其格式为:</span></span></p><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="nginx"><code><span class="code-snippet_outer"><span class="code-snippet__attribute">ssh</span> -C -f -N -D listen_port user<span class="code-snippet__variable">@Tunnel_Host</span> -p Tunnel_Host_sshport</span></code></pre></section><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><br/></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">参数说明:</span></p><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer"><span class="code-snippet__comment"># -N 不打开远程shell，处于等待状态，只是搭好了隧道，不ssh连接远端。用于转发端口(PS:无 ssh登陆日志)</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># -f 后台执行</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># -C 数据压缩传输</span></span></code></pre></section><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;"></span><br/></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">利用ssh构建多级跳板，就是先用本地转发将远端机器的ssh端口与本地端口做映射，然后再通过本地端口继续与其他远端机器的ssh端口构建映射，直至最后一跳时采用任意动态端口转发(建立socks服务器)。</span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><br/></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">最后本地使用socks代理工具进行配置，就可以根据需要让应用按照之前构建的隧道进行通信。</span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;"><br/></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">示例:两级跳板，系统为linux，实验环境:</span></p><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="css"><code><span class="code-snippet_outer"># <span class="code-snippet__selector-tag">Client</span> <span class="code-snippet__selector-tag">A</span><span class="code-snippet__selector-pseudo">:Windows</span> <span class="code-snippet__selector-tag">Localhost</span></span></code><code><span class="code-snippet_outer"># <span class="code-snippet__selector-tag">Tunnel</span> <span class="code-snippet__selector-tag">B</span><span class="code-snippet__selector-pseudo">:Linux</span> <span class="code-snippet__selector-tag">ssh</span> 192<span class="code-snippet__selector-class">.168</span><span class="code-snippet__selector-class">.1</span><span class="code-snippet__selector-class">.39</span><span class="code-snippet__selector-pseudo">:22</span> </span></code><code><span class="code-snippet_outer"># <span class="code-snippet__selector-tag">Tunnel</span> <span class="code-snippet__selector-tag">C</span><span class="code-snippet__selector-pseudo">:Linux</span> <span class="code-snippet__selector-tag">ssh</span> 192<span class="code-snippet__selector-class">.168</span><span class="code-snippet__selector-class">.1</span><span class="code-snippet__selector-class">.42</span><span class="code-snippet__selector-pseudo">:55</span></span></code></pre></section><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="font-size: 16px;color: rgb(51, 51, 51);"><img class="" data-ratio="0.41927710843373495" data-w="830" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=599b5ada&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakK0sTVMhNxWYpPvJUjlQJFqrCJKE4yyufc7njhQVzN6jPfMuvM8LBcgo0vNCLSl66DicJLku7IkVg%2F640%3Fwx_fmt%3Dpng"/></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><br/></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="font-size: 16px;color: rgb(51, 51, 51);">第一层转发: </span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="font-size: 16px;color: rgb(51, 51, 51);">A(localhost:12345)-&gt;B(192.168.1.39:22)-&gt;C(192.168.1.42:55) </span></p><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="css"><code><span class="code-snippet_outer"><span class="code-snippet__selector-tag">ssh</span> <span class="code-snippet__selector-tag">-Nf</span> <span class="code-snippet__selector-tag">-C</span> <span class="code-snippet__selector-tag">-L</span> 12345<span class="code-snippet__selector-pseudo">:192.168.1.42</span><span class="code-snippet__selector-pseudo">:55</span> <span class="code-snippet__selector-tag">rootB</span>@<span class="code-snippet__keyword">192</span>.<span class="code-snippet__keyword">168</span>.<span class="code-snippet__keyword">1</span>.<span class="code-snippet__keyword">39</span> -p <span class="code-snippet__number">22</span></span></code></pre></section><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;"><br/></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">这一步是做了本地12345端口到远程C的55端口映射，A与B之间的通信是SSH加密通信。</span><span style="color: rgb(51, 51, 51);font-size: 16px;"> </span><br/><span style="font-size: 16px;color: rgb(51, 51, 51);"></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><br/></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">第二层转发: </span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">ssh(localhost:9833) -&gt; tunnel2(localhost:12345)<br/></span></p><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="css"><code><span class="code-snippet_outer"><span class="code-snippet__selector-tag">ssh</span> <span class="code-snippet__selector-tag">-Nf</span> <span class="code-snippet__selector-tag">-C</span> <span class="code-snippet__selector-tag">-D</span> <span class="code-snippet__selector-tag">localhost</span><span class="code-snippet__selector-pseudo">:9833</span> <span class="code-snippet__selector-tag">rootC</span>@<span class="code-snippet__keyword">localhost</span> -p <span class="code-snippet__number">12345</span></span></code></pre></section><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="font-size: 16px;color: rgb(51, 51, 51);"><br/></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="font-size: 16px;color: rgb(51, 51, 51);">这一步只绑定本地端口(9833)，虽然是与本地的12345通信，但实质是通过tunnel1与C建立了动态转发关系。此时C充当Socks代理服务器的⻆色。</span></p><section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" data-color="rgb(51,88,121)" style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);width: 769px;margin-right: auto;margin-left: auto;opacity: 1;transform: rotateZ(0deg);"><section style="margin-top: 10px;margin-bottom: 10px;"><section style="border-width: 1px;border-top-style: solid;border-color: rgb(51, 88, 121);border-left-style: solid;border-right-style: solid;width: 769px;height: 25px;box-sizing: border-box;"></section><section style="margin: -10px 15px;"><section style="letter-spacing: 2px;"><p class="brush active" style="font-size: 14px;color: rgb(51, 88, 121);min-width: 1px;"><span style="font-size: 10pt;color: rgb(51, 51, 51);">Ref: </span></p><p class="brush active" style="font-size: 14px;color: rgb(51, 88, 121);min-width: 1px;"><span style="font-size: 10pt;color: rgb(65, 131, 196);"><a href="http://linux.51yip.com/search/ssh" target="_blank">http://linux.51yip.com/search/ssh</a> <a href="https://blog.csdn.net/king_cpp_py/article/details/79560606" target="_blank">https://blog.csdn.net/king_cpp_py/article/details/79560606</a></span></p></section></section><section style="border-width: 1px;border-bottom-style: solid;border-color: rgb(51, 88, 121);border-left-style: solid;border-right-style: solid;width: 769px;height: 25px;box-sizing: border-box;"></section></section></section><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><br/></p><section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" data-color="rgb(48,112,171)" style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);margin-right: auto;margin-left: auto;width: 769px;opacity: 1;transform: rotateZ(0deg);"><section style="padding-right: 0.3em;padding-left: 0.3em;display: inline-block;vertical-align: top;border-top-width: 1px;border-top-style: solid;border-top-color: rgb(48, 112, 171);border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: rgb(48, 112, 171);border-right-width: 1px;border-right-style: solid;border-right-color: rgb(48, 112, 171);font-size: 1.2em;text-align: center;color: rgb(48, 112, 171);box-sizing: border-box;"><p class="count active" style="min-width: 1em;font-size: 1em;"><span style="font-size: 20px;">03</span></p></section><section style="padding-right: 0.3em;padding-left: 0.3em;display: inline-block;vertical-align: top;margin-left: -1px;border-top-width: 1px;border-top-style: solid;border-top-color: rgb(48, 112, 171);border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: rgb(48, 112, 171);border-left-width: 1px;border-left-style: solid;border-left-color: rgb(48, 112, 171);font-size: 1.2em;color: rgb(48, 112, 171);box-sizing: border-box;"><p class="brush active" style="min-width: 1em;font-size: 1em;"><span style="font-size: 20px;">服务器配置</span></p></section></section><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;"></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">修改SSH端口: 在/etc/ssh/sshd_config修改Port为想要的端口，检查AllowTcpForwarding的值是否为Yes(允许远程主机本地端口转发)，如果需要绑定到0.0.0.0机器上，则检查GatewayPorts的值是否为Yes。然后执行</span></p><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="nginx"><code><span class="code-snippet_outer"><span class="code-snippet__attribute">service</span> sshd restart</span></code></pre></section><p><br/></p><p>SSH IP访问限制:</p><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer">sudo vi /etc/hosts.allow</span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 尾部添加(根据情况参照下列格式)</span></span></code></pre></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="makefile"><code><span class="code-snippet_outer"><span class="code-snippet__section">sshd:192.168.0.1</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__section">sshd:192.168.0.1/24</span></span></code><code><span class="code-snippet_outer"><span class="code-snippet__section">sshd:192.168.1.*</span></span></code></pre></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span class="code-snippet_outer">sudo vi /etc/hosts.deny</span></code><code><span class="code-snippet_outer"><span class="code-snippet__comment"># 尾部添加</span></span></code></pre></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="apache"><code><span class="code-snippet_outer"><span class="code-snippet__attribute">sshd</span>:<span class="code-snippet__literal">ALL</span></span></code></pre></section><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;"></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">在这两个文件中的配置是立即生效，本机测试需要在新窗口中进行。</span><br/></p><section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" data-color="rgb(51,88,121)" style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);width: 769px;margin-right: auto;margin-left: auto;opacity: 1;transform: rotateZ(0deg);"><section style="margin-top: 10px;margin-bottom: 10px;"><section style="border-width: 1px;border-top-style: solid;border-color: rgb(51, 88, 121);border-left-style: solid;border-right-style: solid;width: 769px;height: 25px;box-sizing: border-box;"></section><section style="margin: -10px 15px;"><section style="letter-spacing: 2px;"><p><span style="font-size: 10pt;color: rgb(51, 51, 51);">Ref: </span></p><p><span style="font-size: 10pt;color: rgb(65, 131, 196);"><a href="https://blog.csdn.net/god12" target="_blank">https://blog.csdn.net/god12</a></span></p><p><span style="font-size: 10pt;color: rgb(65, 131, 196);">3209/article/details/17683939</span></p></section></section><section style="border-width: 1px;border-bottom-style: solid;border-color: rgb(51, 88, 121);border-left-style: solid;border-right-style: solid;width: 769px;height: 25px;box-sizing: border-box;"></section></section></section><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><br/></p><section class="RankEditor" data-width="100%" data-opacity="1" data-rotate="0" data-color="rgb(48,112,171)" style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);margin-right: auto;margin-left: auto;width: 769px;opacity: 1;transform: rotateZ(0deg);"><section style="padding-right: 0.3em;padding-left: 0.3em;display: inline-block;vertical-align: top;border-top-width: 1px;border-top-style: solid;border-top-color: rgb(48, 112, 171);border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: rgb(48, 112, 171);border-right-width: 1px;border-right-style: solid;border-right-color: rgb(48, 112, 171);font-size: 1.2em;text-align: center;color: rgb(48, 112, 171);box-sizing: border-box;"><p class="count active" style="min-width: 1em;font-size: 1em;"><span style="font-size: 20px;">04</span></p></section><section style="padding-right: 0.3em;padding-left: 0.3em;display: inline-block;vertical-align: top;margin-left: -1px;border-top-width: 1px;border-top-style: solid;border-top-color: rgb(48, 112, 171);border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: rgb(48, 112, 171);border-left-width: 1px;border-left-style: solid;border-left-color: rgb(48, 112, 171);font-size: 1.2em;color: rgb(48, 112, 171);box-sizing: border-box;"><p class="brush active" style="min-width: 1em;font-size: 1em;"><span style="font-size: 20px;">使用工具配置</span></p></section></section><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><br/></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><strong><span style="font-size: 18px;"><span style="font-weight: 600;color: rgb(51, 51, 51);">1.使用</span><span style="font-weight: 700;color: rgb(51, 51, 51);">mobaxterm</span><span style="font-weight: 600;color: rgb(51, 51, 51);">配置</span><span style="font-weight: 700;color: rgb(51, 51, 51);">tunnel</span></span></strong></p><p style="text-align: start;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="font-size: 18px;"><span style="font-weight: 600;color: rgb(51, 51, 51);"></span></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">打开mobaxterm，在tools中的network中选择MobaSSHTunnel，在弹出的对话框中选择New SSH tunnel</span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;"><img class="" data-ratio="0.41244239631336405" data-w="868" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=24ae441a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakK0sTVMhNxWYpPvJUjlQJFphL7OFG6mh5SBrv7up53icrdNiaOMp8Lzs78570bj1OfoSkoAgS2V6Pw%2F640%3Fwx_fmt%3Dpng"/></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">在端口转发配置窗口中选择Local port forwarding，按照提示填写信息</span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;"><img class="" data-ratio="0.6936936936936937" data-w="666" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=f2150293&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakK0sTVMhNxWYpPvJUjlQJFkklpjUwoBmYJ0dgib1icia1zFmHodzOl5rUHnzVVQ57HaCOlWGutmS2icA%2F640%3Fwx_fmt%3Dpng"/>点击save保存回到MobaSSHTunnel对话框，再次添加新的tunnel，选择Dynamic port forwarding </span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;"><img class="" data-ratio="0.7036144578313253" data-w="830" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=6a327a14&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakK0sTVMhNxWYpPvJUjlQJFOYia8NDRpgUKbrhRmjLI9zPUicDYB6ls98dKibH4KjLMSXqS9MFuI0Fhw%2F640%3Fwx_fmt%3Dpng"/></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">示例配置结果如下:</span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;"><img class="" data-ratio="0.4" data-w="830" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=5d545c32&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakK0sTVMhNxWYpPvJUjlQJFwphDzoJOjq9B69o1MOCuvIT7tmQvUT68ZDTwtjZz2DrcUicthhkIQaA%2F640%3Fwx_fmt%3Dpng"/></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">依次启用tunnel，提示输入相对应的密码，确认保存密码</span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;"><img class="" data-ratio="0.4189189189189189" data-w="444" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=161255af&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakK0sTVMhNxWYpPvJUjlQJFfcSicoXoLDwpMCrSW4KV653j3uNBeTuSbq8Cm9R5ZEj0yS1TBbRR1JA%2F640%3Fwx_fmt%3Dpng"/></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">在所有tunnel通道启用完后，点击各tunnel尾部的闪电标识符，启用Autoreconnect，确保断线自动重连。(使用autossh也能实现连接断开之</span><span style="color: rgb(51, 51, 51);font-size: 16px;">后自动重连功能)</span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;"><br/></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="color: rgb(51, 51, 51);font-size: 16px;">☞注意:Mobaxterm免费版只能使用两个tunnel，xshell不限。</span><span style="font-size: 16px;"><span style="font-size: 10pt;font-weight: 600;color: rgb(51, 51, 51);"> </span></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="font-size: 16px;"><span style="font-size: 10pt;font-weight: 600;color: rgb(51, 51, 51);"></span></span></p><p style="text-align: start;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="font-size: 18px;"><span style="font-weight: 600;color: rgb(51, 51, 51);">2.本机使用</span><span style="font-weight: 700;color: rgb(51, 51, 51);">proxifier</span><span style="font-weight: 600;color: rgb(51, 51, 51);">代理</span></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="font-size: 16px;"><span style="color: rgb(51, 51, 51);">打开proxifier，选择Profile -&gt; Proxy Server -&gt; add，根据实际填写对应的端口信息(此处应为9833) </span></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="font-size: 16px;"><span style="color: rgb(51, 51, 51);"><img class="" data-ratio="1.3063829787234043" data-w="470" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=6d7144b4&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FrbP97vC6miakK0sTVMhNxWYpPvJUjlQJFwQtsvO132VzroR3rgTPsS0ibuUTwPNia7wk4n5icYlIZ7EWs8VvVoQr8Q%2F640%3Fwx_fmt%3Dpng"/></span></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><span style="font-size: 16px;"><span style="color: rgb(51, 51, 51);">然后保存，弹出规则变更提示框，点击是即可。之后可以用其为各类应用进行socks代理，最终通过C访</span><span style="color: rgb(51, 51, 51);">问目标。 </span></span></p><p style="text-align: start;white-space: normal;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);"><br/></p><p><br/></p>



<p><a href="https://zhuanlan.zhihu.com/p/94624842">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=fe738a9c&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU2NzY5MDY3MQ%3D%3D%26mid%3D2247483785%26idx%3D1%26sn%3Da881c0c3d142f7e05aeaf4120bf41444%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 02 Dec 2019 08:52:00 +0800</pubDate>
    </item>
  </channel>
</rss>