Skip to content

The agent that grows with you

docs(email): authserv_id is required for authenticated-sender mode

kshitijk4poor4b4362520be5
diff --git a/plugins/platforms/email/plugin.yaml b/plugins/platforms/email/plugin.yaml
index 5cf233df5c6..ec4af9fa3ad 100644
--- a/plugins/platforms/email/plugin.yaml
+++ b/plugins/platforms/email/plugin.yaml
@@ -38,6 +38,6 @@ optional_env:
prompt: "Home address"
password: false
- name: EMAIL_AUTHSERV_ID
- description: "Exact authserv-id stamped by the receiving MTA (required with an allowlist unless sender auth is disabled)"
+ description: "Exact authserv-id on your mail server's topmost Authentication-Results header, e.g. mx.google.com (required unless EMAIL_TRUST_FROM_HEADER=true)"
prompt: "Receiving MTA authserv-id"
password: false
diff --git a/website/docs/reference/environment-variables.md b/website/docs/reference/environment-variables.md
index 0fa0f320a3f..691c06571d4 100644
--- a/website/docs/reference/environment-variables.md
+++ b/website/docs/reference/environment-variables.md
@@ -437,7 +437,7 @@ These are set automatically by the Docker terminal backend when `proxy.enabled:
| `EMAIL_SMTP_HOST` | SMTP hostname for the email adapter |
| `EMAIL_SMTP_PORT` | SMTP port |
| `EMAIL_ALLOWED_USERS` | Comma-separated email addresses allowed to message the bot |
-| `EMAIL_AUTHSERV_ID` | Exact authserv-id that stamps the receiving MTA's topmost `Authentication-Results`; required with an allowlist unless authenticated-sender verification is disabled |
+| `EMAIL_AUTHSERV_ID` | Exact authserv-id on the receiving server's topmost `Authentication-Results` header; required unless sender authentication is disabled (`EMAIL_TRUST_FROM_HEADER=true`) |
| `EMAIL_HOME_ADDRESS` | Default recipient for proactive email delivery |
| `EMAIL_HOME_ADDRESS_NAME` | Display name for the email home target |
| `EMAIL_POLL_INTERVAL` | Email polling interval in seconds |
diff --git a/website/docs/user-guide/messaging/email.md b/website/docs/user-guide/messaging/email.md
index 0858d448919..37b3cced272 100644
--- a/website/docs/user-guide/messaging/email.md
+++ b/website/docs/user-guide/messaging/email.md
@@ -98,9 +98,9 @@ EMAIL_SMTP_HOST=smtp.gmail.com
# Security (recommended)
-# Exact authserv-id on the receiving MTA's topmost Authentication-Results header.
-# With an allowlist, leave sender authentication enabled only after confirming
-# that MTA strips inbound headers claiming this id before adding its own stamp.
+# Required: exact authserv-id on your receiving server's topmost
+# Authentication-Results header (Gmail: mx.google.com).
+# That server must strip inbound headers claiming this id before adding its own.
EMAIL_AUTHSERV_ID=mx.google.com
# Optional
@@ -181,9 +181,9 @@ Email access is stricter by default than chat-style platforms:
Allowlist entries match whole addresses. A bare entry such as `alice` (a chat username in `GATEWAY_ALLOWED_USERS`, say) never admits `alice@` at any domain, and mail from such an address is dropped rather than paired or declined.
-Hermes acts on a message only when the `Authentication-Results` header stamped by your receiving server authenticates its `From:` domain (DMARC, or aligned SPF/DKIM). This applies with open access (`EMAIL_ALLOW_ALL_USERS` / `GATEWAY_ALLOW_ALL_USERS`) too: open access admits any sender, but each conversation and every reply is keyed on `From:`, so a forged `From:` would put the attacker's text into that address's session and make Hermes mail it. Pairing codes and declines likewise need an authenticated `From:`, so neither is mailed to a forged address. If your mail server does not stamp that header, set `platforms.email.require_authenticated_sender: false` (or `EMAIL_TRUST_FROM_HEADER=true`) to accept the risk; otherwise mail from an admitted sender that carries no such header is dropped with a `Dropping sender with unauthenticated From` warning in the gateway log. The same warning, pointing at `platforms.email.authserv_id` (`EMAIL_AUTHSERV_ID`) instead, fires when the topmost `Authentication-Results` header (the one your server prepends; lower ones are never consulted) does not name exactly the pinned `authserv_id`. `authserv_id` must equal the exact host your server writes; if that host varies per message, leave `authserv_id` unset. Mail from an address listed in `EMAIL_ALLOWED_USERS` / `GATEWAY_ALLOWED_USERS` that fails authentication otherwise (for example a sender whose DKIM is broken, or a forwarder that breaks alignment) is dropped with the same warning and its verdict, with no opt-out hint. Other senders' failing mail, such as forged `From:` under open access, is dropped quietly, logged at debug level only.
+Hermes acts on a message only when the `Authentication-Results` header stamped by your receiving server authenticates its `From:` domain (DMARC, or aligned SPF/DKIM). This applies with open access (`EMAIL_ALLOW_ALL_USERS` / `GATEWAY_ALLOW_ALL_USERS`) too: open access admits any sender, but each conversation and every reply is keyed on `From:`, so a forged `From:` would put the attacker's text into that address's session and make Hermes mail it. Pairing codes and declines likewise need an authenticated `From:`, so neither is mailed to a forged address. If your mail server does not stamp that header, set `platforms.email.require_authenticated_sender: false` (or `EMAIL_TRUST_FROM_HEADER=true`) to accept the risk; otherwise mail from an admitted sender that carries no such header is dropped with a `Dropping sender with unauthenticated From` warning in the gateway log. The same warning, pointing at `platforms.email.authserv_id` (`EMAIL_AUTHSERV_ID`) instead, fires when the topmost `Authentication-Results` header (the one your server prepends; lower ones are never consulted) does not name exactly the pinned `authserv_id`. `authserv_id` must equal exactly the authserv-id your server writes before the first `;` of that header. Mail from an address listed in `EMAIL_ALLOWED_USERS` / `GATEWAY_ALLOWED_USERS` that fails authentication otherwise (for example a sender whose DKIM is broken, or a forwarder that breaks alignment) is dropped with the same warning and its verdict, with no opt-out hint. Other senders' failing mail, such as forged `From:` under open access, is dropped quietly, logged at debug level only.
-When `EMAIL_ALLOWED_USERS` grants access, sender authentication is enabled by default. Set `EMAIL_AUTHSERV_ID` to the exact id stamped on the **topmost** `Authentication-Results` header by your receiving MTA. Hermes fails closed without that pin, or when the top header does not match it. Confirm that your MTA strips inbound `Authentication-Results` headers claiming its id before it prepends its own; a copied id alone does not prove provenance. If your provider cannot meet this requirement, you may explicitly accept the risk with `platforms.email.require_authenticated_sender: false` or `EMAIL_TRUST_FROM_HEADER=true`.
+**The `authserv_id` pin is required while sender authentication is on.** Without `platforms.email.authserv_id` (`EMAIL_AUTHSERV_ID`), Hermes cannot tell your server's `Authentication-Results` header from one the sender wrote (a self-hosted MTA that adds none of its own leaves the sender's on top), so it trusts none: every message that needs an authenticated `From:` is dropped, and the gateway log says so once, with the fix. To find the value, open a message your server delivered ("show original" / raw source) and copy the token before the first `;` of the **topmost** `Authentication-Results` header, for example `mx.google.com` for Gmail. If that token seems to change between messages, it is a per-relay hostname rather than an authserv-id: RFC 8601 defines the authserv-id as a stable name for the administrative domain, so configure your MTA to stamp one (for example `AuthservID` in OpenDKIM / OpenDMARC) and pin that. A matching id is a pin, not proof of provenance: confirm your MTA strips inbound `Authentication-Results` headers claiming its id before it prepends its own. If you cannot pin a stable id, opt out explicitly with `platforms.email.require_authenticated_sender: false` (or `EMAIL_TRUST_FROM_HEADER=true`) and accept that `From:` is then trusted as written.
:::warning
**Use a dedicated inbox and configure `EMAIL_ALLOWED_USERS` for normal operation.** Email pairing is opt-in because shared inboxes often contain unrelated unread messages, and Hermes should not reply to those contacts by default.
@@ -197,7 +197,7 @@ When `EMAIL_ALLOWED_USERS` grants access, sender authentication is enabled by de
|---------|----------|
| **"IMAP connection failed"** at startup | Verify `EMAIL_IMAP_HOST` and `EMAIL_IMAP_PORT`. Ensure IMAP is enabled on the account. For Gmail, enable it in Settings → Forwarding and POP/IMAP. |
| **"SMTP connection failed"** at startup | Verify `EMAIL_SMTP_HOST` and `EMAIL_SMTP_PORT`. Check that your password is correct (use App Password for Gmail). |
-| **Messages not received** | Check `EMAIL_ALLOWED_USERS` includes the sender's email. With an allowlist, set `EMAIL_AUTHSERV_ID` to the exact receiving-MTA stamp and verify it is the topmost `Authentication-Results` header. Check spam folder — some providers flag automated replies. |
+| **Messages not received** | Check `EMAIL_ALLOWED_USERS` includes the sender's email. If the gateway log shows `authserv-id is not configured`, set `EMAIL_AUTHSERV_ID` to the exact id on the topmost `Authentication-Results` header your server writes. Check spam folder — some providers flag automated replies. |
| **"Authentication failed"** | For Gmail, you must use an App Password, not your regular password. Ensure 2FA is enabled first. |
| **Duplicate replies** | Ensure only one gateway instance is running. Check `hermes gateway status`. |
| **Slow response** | The default poll interval is 15 seconds. Reduce with `EMAIL_POLL_INTERVAL=5` for faster response (but more IMAP connections). |
@@ -213,7 +213,7 @@ When `EMAIL_ALLOWED_USERS` grants access, sender authentication is enabled by de
- Use **App Passwords** instead of your main password (required for Gmail with 2FA)
- Set `EMAIL_ALLOWED_USERS` to restrict who can interact with the agent
-- With an allowlist, set `EMAIL_AUTHSERV_ID` to the exact id of the receiving MTA's topmost `Authentication-Results` stamp, and verify that MTA strips inbound headers claiming that id
+- Set `EMAIL_AUTHSERV_ID` to the exact id of the receiving MTA's topmost `Authentication-Results` stamp, and verify that MTA strips inbound headers claiming that id
- The password is stored in `~/.hermes/.env` — protect this file (`chmod 600`)
- IMAP uses SSL (port 993) and SMTP uses STARTTLS (port 587) by default — connections are encrypted
@@ -231,6 +231,6 @@ When `EMAIL_ALLOWED_USERS` grants access, sender authentication is enabled by de
| `EMAIL_SMTP_PORT` | No | `587` | SMTP server port |
| `EMAIL_POLL_INTERVAL` | No | `15` | Seconds between inbox checks |
| `EMAIL_ALLOWED_USERS` | No | — | Comma-separated allowed sender addresses |
-| `EMAIL_AUTHSERV_ID` | No | — | Exact authserv-id on the receiving MTA's topmost `Authentication-Results`; required when using an allowlist unless sender authentication is disabled |
+| `EMAIL_AUTHSERV_ID` | Yes, unless sender authentication is off | — | Exact authserv-id on your receiving server's topmost `Authentication-Results` header; without it every message needing an authenticated `From:` is dropped |
| `EMAIL_HOME_ADDRESS` | No | — | Default delivery target for cron jobs |
| `EMAIL_ALLOW_ALL_USERS` | No | `false` | Allow all senders (not recommended) |
diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/environment-variables.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/environment-variables.md
index ed9afa70a80..2b254e95b5b 100644
--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/environment-variables.md
+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/environment-variables.md
@@ -322,7 +322,7 @@ description: "Hermes Agent 使用的所有环境变量完整参考"
| `EMAIL_SMTP_HOST` | 邮件适配器的 SMTP 主机名 |
| `EMAIL_SMTP_PORT` | SMTP 端口 |
| `EMAIL_ALLOWED_USERS` | 允许向 bot 发送消息的逗号分隔邮箱地址 |
-| `EMAIL_AUTHSERV_ID` | 接收 MTA 在最上层 `Authentication-Results` 中写入的精确 authserv-id;使用白名单时必须设置,除非已禁用发件人认证校验 |
+| `EMAIL_AUTHSERV_ID` | 接收服务器在最上层 `Authentication-Results` 中写入的精确 authserv-id;除非已禁用发件人认证(`EMAIL_TRUST_FROM_HEADER=true`),否则必须设置 |
| `EMAIL_HOME_ADDRESS` | 主动邮件投递的默认收件人 |
| `EMAIL_HOME_ADDRESS_NAME` | 邮件主目标的显示名称 |
| `EMAIL_POLL_INTERVAL` | 邮件轮询间隔(秒) |
diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/messaging/email.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/messaging/email.md
index c4a13105c0a..c3273533d9b 100644
--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/messaging/email.md
+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/messaging/email.md
@@ -66,8 +66,8 @@ EMAIL_SMTP_HOST=smtp.gmail.com
# 安全设置(推荐)
-# 接收 MTA 在最上层 Authentication-Results 中写入的精确 authserv-id。
-# 使用白名单时,请先确认该 MTA 会移除伪造此 id 的入站头部,再写入自己的结果。
+# 必填:接收服务器在最上层 Authentication-Results 中写入的精确 authserv-id(Gmail 为 mx.google.com)。
+# 该服务器须先移除声称此 id 的入站头部,再写入自己的结果。
EMAIL_AUTHSERV_ID=mx.google.com
# 可选
@@ -144,7 +144,7 @@ platforms:
2. **未设置白名单** → 未知发件人会收到配对码
3. **`EMAIL_ALLOW_ALL_USERS=true`** → 接受任意发件人(请谨慎使用)
-当 `EMAIL_ALLOWED_USERS` 授予访问权限时,发件人认证默认开启。请将 `EMAIL_AUTHSERV_ID` 设置为接收 MTA 在**最上层** `Authentication-Results` 头中写入的精确 id。未设置该 pin 或顶部头部不匹配时,Hermes 会拒绝邮件。还须确认 MTA 会先移除声称该 id 的入站 `Authentication-Results` 头,再添加自己的头部,因为仅复制 id 不能证明头部来自该 MTA。若服务商无法满足此要求,可显式设置 `platforms.email.require_authenticated_sender: false` 或 `EMAIL_TRUST_FROM_HEADER=true` 来接受风险。
+**发件人认证开启时(默认),必须设置 `authserv_id` pin。** 未设置 `platforms.email.authserv_id`(`EMAIL_AUTHSERV_ID`)时,Hermes 无法区分你的服务器写入的 `Authentication-Results` 头与发件人伪造的头(自建 MTA 若不写入自己的结果,发件人的头就会位于最上层),因此不信任任何头部:所有需要已认证 `From:` 的邮件都会被丢弃,gateway 日志会给出一次带修复方法的警告。获取方法:打开一封服务器投递的邮件原文,复制**最上层** `Authentication-Results` 头中第一个 `;` 之前的标识,例如 Gmail 为 `mx.google.com`。若该标识随邮件变化,说明它是逐跳的主机名而非 authserv-id:RFC 8601 规定 authserv-id 是管理域的稳定名称,请让 MTA 写入固定值(例如 OpenDKIM / OpenDMARC 的 `AuthservID`)并 pin 该值。id 匹配只是 pin,并不证明来源:还须确认 MTA 会先移除声称该 id 的入站 `Authentication-Results` 头,再添加自己的头部。若无法 pin 稳定的 id,可显式设置 `platforms.email.require_authenticated_sender: false`(或 `EMAIL_TRUST_FROM_HEADER=true`)接受风险,此时 `From:` 将按原样被信任。
:::warning
**请务必配置 `EMAIL_ALLOWED_USERS`。** 若不配置,任何知道 Agent 邮箱地址的人都可以发送命令。Agent 默认具有终端访问权限。
@@ -158,7 +158,7 @@ platforms:
|---------|----------|
| 启动时出现 **"IMAP connection failed"** | 检查 `EMAIL_IMAP_HOST` 和 `EMAIL_IMAP_PORT`。确保账户已启用 IMAP。对于 Gmail,在设置 → 转发和 POP/IMAP 中启用。 |
| 启动时出现 **"SMTP connection failed"** | 检查 `EMAIL_SMTP_HOST` 和 `EMAIL_SMTP_PORT`。确认密码正确(Gmail 请使用应用专用密码)。 |
-| **未收到邮件** | 检查 `EMAIL_ALLOWED_USERS` 是否包含发件人邮箱。使用白名单时,将 `EMAIL_AUTHSERV_ID` 设为接收 MTA 写入的精确 id,并确认它位于最上层 `Authentication-Results` 头。检查垃圾邮件文件夹——部分服务商会将自动回复标记为垃圾邮件。 |
+| **未收到邮件** | 检查 `EMAIL_ALLOWED_USERS` 是否包含发件人邮箱。若 gateway 日志出现 `authserv-id is not configured`,请将 `EMAIL_AUTHSERV_ID` 设为服务器写入的最上层 `Authentication-Results` 头中的精确 id。检查垃圾邮件文件夹——部分服务商会将自动回复标记为垃圾邮件。 |
| **"Authentication failed"** | 对于 Gmail,必须使用应用专用密码,而非常规密码。请先确保已启用双重验证。 |
| **重复回复** | 确保只有一个 gateway 实例在运行。检查 `hermes gateway status`。 |
| **响应缓慢** | 默认轮询间隔为 15 秒。设置 `EMAIL_POLL_INTERVAL=5` 可加快响应速度(但会增加 IMAP 连接次数)。 |
@@ -174,7 +174,7 @@ platforms:
- 使用**应用专用密码**代替主密码(Gmail 开启双重验证后必须如此)
- 设置 `EMAIL_ALLOWED_USERS` 以限制可与 Agent 交互的用户
-- 使用白名单时,将 `EMAIL_AUTHSERV_ID` 设为接收 MTA 最上层 `Authentication-Results` 头的精确 id,并确认该 MTA 会移除伪造此 id 的入站头部
+- 将 `EMAIL_AUTHSERV_ID` 设为接收 MTA 最上层 `Authentication-Results` 头的精确 id,并确认该 MTA 会移除伪造此 id 的入站头部
- 密码存储在 `~/.hermes/.env` 中——请保护此文件(`chmod 600`)
- IMAP 默认使用 SSL(端口 993),SMTP 默认使用 STARTTLS(端口 587)——连接已加密
@@ -192,6 +192,6 @@ platforms:
| `EMAIL_SMTP_PORT` | 否 | `587` | SMTP 服务器端口 |
| `EMAIL_POLL_INTERVAL` | 否 | `15` | 收件箱检查间隔(秒) |
| `EMAIL_ALLOWED_USERS` | 否 | — | 允许的发件人地址,逗号分隔 |
-| `EMAIL_AUTHSERV_ID` | 否 | — | 接收 MTA 最上层 `Authentication-Results` 中的精确 authserv-id;使用白名单时必须设置,除非已禁用发件人认证校验 |
+| `EMAIL_AUTHSERV_ID` | 是(除非关闭发件人认证) | — | 接收服务器最上层 `Authentication-Results` 头中的精确 authserv-id;未设置时所有需要已认证 `From:` 的邮件都会被丢弃 |
| `EMAIL_HOME_ADDRESS` | 否 | — | cron 任务的默认投递目标 |
| `EMAIL_ALLOW_ALL_USERS` | 否 | `false` | 允许所有发件人(不推荐) |
\ No newline at end of file