# 内部IP地址172.17.0.1提供垃圾邮件？

**URL:** <https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891>\
**Category:** Support\
**Created:** [2025年九月24日 14:43 UTC](https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891 "2025-09-24T14:43:18Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thanatermesis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thanatermesis/32/119521_2.png) [@Thanatermesis](https://meta.discourse.org/u/Thanatermesis)\
**Post date:** [2025年九月24日 14:43 UTC](https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891/1 "2025-09-24T14:43:18Z")

</div>

_短篇故事：我最近在我的 discourse 安装中遇到了大量的垃圾邮件，原因是我更改了一个“电子邮件确认”的文本模板，该模板似乎是错误的（来自旧的安装？），因为 URL 中包含类似 url/authorize\_email/ 的内容。最后，我不得不应用一个 5 天前的完整论坛恢复……_

现在我正在查看日志，看看是否还有更多的垃圾邮件机器人攻击，但我注意到了一些奇怪的事情……大多数垃圾邮件机器人似乎都来自本地 IP：

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/b/2/4b2d8d73d76e7b3c29023110b412bedee8ddf79a.png)

所以我不确定我的安装是否有问题。

比如，这个 172.16.0… 设置是否正确？

 ![image](https://global.discourse-cdn.com/meta/original/4X/e/2/f/e2f7900e9a897c1e184168fb36e07790968742d2.png)

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2025年九月24日 14:47 UTC](https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891/2 "2025-09-24T14:47:04Z")

</div>

您正在使用反向代理（可能是类似 nginx-proxy 的东西）。

您需要在 `app.yml` 中添加类似以下内容：

```plaintext
after_bundle_exec:
  - replace:
    filename: /etc/nginx/conf.d/discourse.conf
    from: "types {"
    to: |
      set_real_ip_from 172.16.0.0/12;
      set_real_ip_from 10.0.0.0/8;
      real_ip_recursive on;
      real_ip_header X-Forwarded-For;
      types {

```

---

<div class="post-metadata">

**Author:** ![Thanatermesis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thanatermesis/32/119521_2.png) [@Thanatermesis](https://meta.discourse.org/u/Thanatermesis)\
**Post date:** [2025年九月24日 16:43 UTC](https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891/3 "2025-09-24T16:43:12Z")

</div>

正如我们在第一个屏幕截图中看到的，似乎只有一些（看起来像是来自垃圾邮件机器人）

看起来我没有使用反向代理，Discourse 只是从一个 Docker 实例提供服务。

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2025年九月24日 16:55 UTC](https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891/4 "2025-09-24T16:55:58Z")

</div>

> [@Thanatermesis](#):
>
> 正如我们在第一个截图中看到的，似乎只有一些（看起来像是垃圾邮件机器人）

抱歉。一旦我看到 `172.17.x.x` 地址，我就假设你有一个反向代理。

> [@Thanatermesis](#):
>
> 看起来我没有使用反向代理，Discourse 只是从一个 Docker 实例提供服务，但该服务器上没有运行其他“主机”nginx 进程。

所以这是一个标准的安装？

如果你只有一个主机并且没有负载均衡器/反向代理，那么我不知道任何人会拥有这样的 IP 地址。也许有什么东西在转发流量？这些是私有地址，所以它们似乎来自你的本地网络。这表明垃圾邮件机器人存在于你的网络中。（[Guide to Private IP Address Classes and Ranges - Ipstack](https://ipstack.com/classes-of-private-ip-address#:~:text=Range%3A%20172.16.%5Cu0026text=Class%20B%20private%20IP%20addresses,ample%20for%20medium%2Dsized%20networks%E3%80%82%EF%BC%89)

如果你没有合法的用户（例如，你局域网中的人们）从该 IP 地址范围访问 Discourse，你可以放心地阻止它。我建议联系你的网络管理员，让他们知道这些攻击来自这些内部地址。

---

<div class="post-metadata">

**Author:** ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)\
**Post date:** [2025年九月24日 17:31 UTC](https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891/5 "2025-09-24T17:31:01Z")

</div>

那是 Docker IP，对吧？

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2025年九月24日 17:36 UTC](https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891/6 "2025-09-24T17:36:02Z")

</div>

我就是在那里看到的，但我认为那个范围还有其他用途。

或者也许垃圾邮件机器人是该机器上的一个 Docker 容器。 🤷

---

<div class="post-metadata">

**Author:** ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)\
**Post date:** [2025年九月24日 18:01 UTC](https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891/7 "2025-09-24T18:01:58Z")

</div>

嗯，我一无所知，对我来说，docker 世界是一个巨大的谜团，但我在想是否可以通过 SSH 或其他方式获取容器 IP？

---

<div class="post-metadata">

**Author:** ![Thanatermesis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thanatermesis/32/119521_2.png) [@Thanatermesis](https://meta.discourse.org/u/Thanatermesis)\
**Post date:** [2025年九月24日 19:46 UTC](https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891/8 "2025-09-24T19:46:47Z")

</div>

> [@pfaffman](#):
>
> 这是[标准安装](https://meta.discourse.org/t/142537?silent=true)吗？

是的，我多年前就这么做了，但我记得是这个。基本上：vultr 上有一个专用的小型主机（就像 DO 上的那些 dropplets），仅用于此目的，安装在 docker 上，主机/vps 的其余部分不用于任何其他用途。

> [@pfaffman](#):
>
> 那么我不知道任何人怎么会有这样的 IP 地址。也许有什么东西在转发流量？

是的，这就是我在想的，一些错误的配置，或者，因为似乎是来自垃圾邮件机器人，周围发生了一些奇怪的事情

> [@pfaffman](#):
>
> 或者垃圾邮件机器人是该机器上的一个 docker 容器。 🤷

该机器上没有其他 docker。

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2025年九月24日 19:54 UTC](https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891/9 "2025-09-24T19:54:24Z")

</div>

你这么多年没有更新你的操作系统吗？主机有没有可能被黑了？这些 IP 地址看起来都来自同一台机器。

---

<div class="post-metadata">

**Author:** ![Thanatermesis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thanatermesis/32/119521_2.png) [@Thanatermesis](https://meta.discourse.org/u/Thanatermesis)\
**Post date:** [2025年九月25日 14:50 UTC](https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891/10 "2025-09-25T14:50:25Z")

</div>

我计划在 2-3 个月内重新安装

> [@pfaffman](#):
>
> 主机可能被黑了吗？

看起来不像，但很难知道，另一方面，垃圾邮件机器人并不庞大（但几天前它们很庞大，不知何故，在我将确认电子邮件链接从“authorize\_email”更改为“confirm-new-email”后 2 小时，我收到了大量垃圾邮件，这似乎是一个旧模板的内容，但在恢复的备份中，我仍然有旧的方法来避免另一次攻击）

---

<div class="post-metadata">

**Author:** ![Thanatermesis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thanatermesis/32/119521_2.png) [@Thanatermesis](https://meta.discourse.org/u/Thanatermesis)\
**Post date:** [2025年九月25日 15:21 UTC](https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891/11 "2025-09-25T15:21:02Z")

</div>

奇怪的是，这个电子邮件模板似乎在我的设置中重复了，所以我为此问题创建了另一个帖子主题：

> [@Duplicated email templates with wrong contents](https://meta.discourse.org/t/duplicated-email-templates-with-wrong-contents/384028):
>
> Is normal that I have duplicated templates in the email settings? This bug was found because the confirmation link of adding a second email allways returned a 404, then we found that many entries in the templates of email were wrong, so duplicated subjects with similar bodies, they seem to be old contents not replaced? On the email confirmation issue, I have one that uses a wrong (old?) link and another one that is the correct one, why I have 2 with the same name and why I cannot delete the wr…

---

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [2025年十月6日 20:23 UTC](https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891/12 "2025-10-06T20:23:13Z")

</div>

您是否已经弄清楚了足够的信息来解决您的问题？我们可以关闭这个主题吗？

---

<div class="post-metadata">

**Author:** ![Thanatermesis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thanatermesis/32/119521_2.png) [@Thanatermesis](https://meta.discourse.org/u/Thanatermesis)\
**Post date:** [2025年十月6日 20:51 UTC](https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891/13 "2025-10-06T20:51:15Z")

</div>

不，我还在等待知道为什么我会有这么多重复的“电子邮件模板”并且内容错误（看起来像是旧版本的残留），以及为什么我无法删除它们，正如我在上一篇文章中所提到的。

---

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [2025年十月6日 21:18 UTC](https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891/14 "2025-10-06T21:18:29Z")

</div>

您在这里描述的问题不太可能是由电子邮件模板引起的。在我看来，这与您的服务器有关，在全新安装上重新安装将为您解决此问题。

似乎没有太多可以帮助您的地方了，因此我将关闭此主题。我还回答了您关于电子邮件模板的问题。如果您遇到新问题，请开启新主题。

---

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [2025年十月6日 21:18 UTC](https://meta.discourse.org/t/spam-providing-from-internal-ip-addresses-as-172-17-0-1/383891/15 "2025-10-06T21:18:33Z")

</div>


