免費開始
第 17b 章 合規、儲存與維運 管理:#pArchiveSources

nextxch Archive:將 Microsoft 365、Exchange、Google Workspace 與 IMAP 納入 GoBD 封存

nextxch Archive 將未在 nextxch 上執行的系統郵件納入 GoBD 封存。管理後台的「合規 > 封存來源」下方提供四種來源類型:SMTP 日誌(來自 Microsoft 365 與 Exchange 的日誌報告、來自 Google Workspace 的複本規則、來自任意 MTA 的密件抄送複本)、IMAP(任意伺服器,唯讀)、透過 Microsoft Graph 連線的 Microsoft 365,以及透過 Gmail API 連線的 Google Workspace。來源中的每一個信箱都會成為已封存信箱,無需登入且不產生郵件流量;搜尋、法律保留、證據匯出與還原在其上的運作方式與您自己的信箱相同。

營運提示與架構說明

建議組合:使用 SMTP 日誌從截止日期起進行完整持續擷取(使用者在郵件被擷取前無法刪除任何內容),再加上 API 來源一次性或以長間隔擷取現有郵件與資料夾檢視。兩者寫入相同的封存庫;得益於 SHA-256,擷取兩次的郵件僅會儲存一次。授權:其他系統的已封存信箱屬於獨立授權項目,您自己的 nextxch 信箱不計入其中。每個層級皆免費提供 10 個已封存信箱,更多數量需搭配 Business 授權(€2.40 起低至 €1.20 / 年)。

1. 快速入門:為 Microsoft 365 建立日志來源

新來源建立後處於停用狀態。請先測試連線,然後啟用該來源。如果只指定了網域,伺服器會產生帶安全權杖的日誌位址;其 MX 必須指向 nextxch。

參考 / 設定
# 1. Admin > Compliance > Archive sources > New source, kind "SMTP journal"
#    Domains of the old environment: company.com · journal domain: archive.company.com
#    -> journal address e.g. journal-k3x9q2m7v1c8b4n6z5ta@archive.company.com (copy it)
# 2. Protection: IP ranges of the Exchange Online servers, TLS required, allowed envelope senders
# 3. Microsoft Purview: Solutions > Data lifecycle management > Exchange (legacy) > Journal rules
#    or Exchange Online PowerShell:
Set-TransportConfig -JournalingReportNdrTo journal-ndr@archive.company.com
New-JournalRule -Name "nextxch Archive" -JournalEmailAddress journal-k3x9q2m7v1c8b4n6z5ta@archive.company.com -Scope Global -Enabled $true
Get-JournalRule | Format-Table Name,Enabled,JournalEmailAddress,Scope
# 4. Send a test message: the source shows the original with all envelope recipients (including Bcc)

2. 來自 Exchange 地端部署與 Google Workspace 的日誌

Exchange 本地部署:使用相同日誌位址的日誌規則(進階日誌,需備有 Exchange Enterprise CAL)或按信箱資料庫向該位址進行標準日誌記錄;在混合式環境中,亦須在本地 Exchange 伺服器上建立該規則。Google Workspace:路由規則會將日誌位址新增為額外收件人;無需 Google Vault。啟用 "Comprehensive mail storage" 後,來自 SMTP 中繼與 Google 服務的郵件亦會存入信箱。任何其他 MTA 皆會將密件抄送副本傳送至日誌位址。

參考 / 設定
# Exchange Server (Exchange Management Shell)
New-JournalRule -Name "nextxch Archive" -JournalEmailAddress journal-k3x9q2m7v1c8b4n6z5ta@archive.company.com -Scope Global -Enabled $true

# Google Admin console: Menu > Apps > Google Workspace > Gmail > Routing > Configure
#   Messages to affect: inbound, outbound, internal inbound, internal outbound
#   Action: Modify message > Add more recipients > Advanced > journal address
#   Optional: do not deliver spam to this recipient, suppress bounces from this recipient
# Journal source in nextxch: format bcc or auto, IP ranges of Google's outbound servers, TLS required

3. IMAP:任意伺服器,唯讀

資料夾僅以 EXAMINE 開啟,並透過 BODY.PEEK[] 擷取內容,來源端的標記永遠不會改變。每個資料夾的游標(UIDVALIDITY、最後一個 UID、搭配 CONDSTORE 的 HIGHESTMODSEQ)在每封郵件後更新,中斷會確切從該處恢復。TLS 為強制性(隱式或 STARTTLS),可選擇性地固定憑證(SHA-256);使用密碼或 XOAUTH2 登入,支援單一帳號或帳號清單。預設會跳過垃圾桶與垃圾郵件。

參考 / 設定
{
  "host": "imap.oldhoster.com",
  "tls": "implicit",
  "auth": "password",
  "mode": "single",
  "username": "accounting@company.com",
  "address": "accounting@company.com",
  "excludeFolders": ["Drafts"],
  "since": "2016-01-01",
  "maxConnections": 2
}
# Secret: password (or oauthToken with xoauth2), in list mode accounts/<id>/password

4. 透過 Microsoft Graph 接入 Microsoft 365:在 Entra ID 中註冊應用程式

該來源透過按資料夾的增量查詢讀取現有郵件和新郵件,不使用 EWS(Microsoft 將在 Exchange Online 中停用 EWS)。Microsoft Graph 中需經管理員同意的應用程式權限:Mail.Read 和 User.Read.All,僅在使用使用者篩選器 "group" 時需要 GroupMember.Read.All。使用憑證(推薦)或客戶端密碼登入,雲端環境支援 global、usgov、usgovdod 和 china。遵守 Graph 限流(429 和 Retry-After),執行會從最後一個完整處理的頁面繼續。在來源端刪除的郵件仍保留在封存中。選配地,Exchange Online RBAC for Applications 可將存取權限限制在一個群組內。

參考 / 設定
# Entra admin center > App registrations > New registration "nextxch Archive" (single tenant)
# API permissions > Microsoft Graph > Application permissions:
#   Mail.Read, User.Read.All (+ GroupMember.Read.All with group filter) > Grant admin consent
# Certificates & secrets: upload a certificate (.cer) or create a client secret
{
  "tenantId": "company.onmicrosoft.com",
  "clientId": "11111111-2222-3333-4444-555555555555",
  "credentialType": "certificate",
  "cloud": "global",
  "userFilter": { "mode": "group", "groupId": "99999999-0000-0000-0000-000000000009" },
  "sinceUtc": "2019-01-01T00:00:00Z"
}
# Secrets: certificatePfx (Base64) + certificatePassword or clientSecret (the value, not the ID)

5. 透過 Gmail API 接入 Google Workspace:服務帳號與全域委派

在客戶自己的 Google Cloud 專案中創建服務帳號(Gmail 配額按專案計算),並啟用 Gmail API 和 Admin SDK API。在管理控制台中,為其數字客戶端 ID 授權全域委派,作用域為 gmail.readonly 和 admin.directory.user.readonly,使用 "group" 篩選器時另需 admin.directory.group.member.readonly。透過 messages.list 和 messages.get (raw) 進行初始導入,然後進行歷史同步;如果歷史記錄已expired,導入會重新開始,已封存的郵件計為重複。每個用戶和專案的配額預算可調整。

參考 / 設定
# Admin console: Security > Access and data control > API controls > Domain-wide delegation
#   client ID (numeric) + scopes:
#   https://www.googleapis.com/auth/gmail.readonly,
#   https://www.googleapis.com/auth/admin.directory.user.readonly
{
  "adminSubject": "admin@company.com",
  "domain": "company.com",
  "userFilter": "orgUnit",
  "orgUnitPath": "/Sales",
  "sinceUtc": "2018-01-01T00:00:00Z",
  "quotaUnitsPerUserMinute": 4800
}
# Secret: serviceAccountKey (JSON key file of the service account)

6. 儲存空間、WORM 保留與法律保留

每個已封存信箱在 GoBD 封存庫中都有專屬的僅封存儲存區。每封郵件包含:跨所有信箱進行內容去重的 SHA-256 內容位址、按信箱以 SHA-256 與 Message-ID 進行的重複檢查、針對 blob 與郵件的來源端 WORM 保留與法律保留、作為防竄改證據的雜湊鏈,以及全文檢索索引。每次執行的歷史記錄會統計已儲存、重複和拒絕的郵件數。

參考 / 設定
Retention      RetentionDays 0..36500 (0 = no WORM retention)
Mode           Normal | Governance | Compliance (default)
Legal hold     per source, also applies to already archived messages
Storage        local or S3 with Object Lock (like the rest of the GoBD archive)
Status         per mailbox: last run, next run, stored, duplicates, rejected, errors

7. 搜尋、匯出、還原

已封存信箱可在合規性搜尋中作為獨立的範圍選擇(支援複合詞拆分的德語搜尋、附件 OCR、ZUGFeRD 欄位),並且在列表中各自帶有搜尋、證據匯出和還原按鈕。證據匯出提供包含原始 .eml 檔案和 Ed25519 簽名清單的 ZIP(參見第 17a 章)。還原會複製到 nextxch 信箱中,封存保持不變。目前尚不支援還原回 Microsoft 365、Google 或 IMAP 伺服器,可透過匯出實現。搜尋在所有版本中提供,證據匯出和還原作業自 Business 起提供。

參考 / 設定
# Search in an archived mailbox
curl -s "https://mail.company.com/api/compliance/search?archivedMailboxId=<id>&q=invoice&limit=100" -H "X-Api-Key: $KEY"

# Evidence export of an archived mailbox (202, status under GET /api/compliance/exports/{id})
curl -X POST https://mail.company.com/api/compliance/exports -H "X-Api-Key: $KEY" -H "Content-Type: application/json" \
  -d '{"scope":"mailbox","archivedMailboxId":"<id>","caseReference":"case 4711"}'

# Restore into a nextxch mailbox
curl -X POST https://mail.company.com/api/compliance/restore/jobs -H "X-Api-Key: $KEY" -H "Content-Type: application/json" \
  -d '{"source":"archive","account":"archived:<id>","target":"account","targetAccount":"successor@company.com"}'

8. 管理 API:/api/admin/archive-sources

TenantAdmin 在自己的租戶內,ServerAdmin 在所有範圍內;ComplianceAuditor 可讀取(用於選擇要搜尋與匯出的已封存信箱),但絕不變更任何內容。Kind 為 Journal、Imap、Microsoft365 或 Google。超出授權配額啟用信箱會遭到拒絕,並顯示包含目前授權行的訊息。日透過 SMTP 接收日誌來源,不會為其執行執行(409 JOURNAL_IS_PUSHED)。

參考 / 設定
GET    /api/admin/archive-sources                          sources, licence line, available kinds with fields
GET    /api/admin/archive-sources/license                  used, allowed, free, remaining
POST   /api/admin/archive-sources                          create a source
GET    /api/admin/archive-sources/{id}                     source, mailboxes, names of the secrets
PUT    /api/admin/archive-sources/{id}                     change (settings, retention, legal hold, schedule)
DELETE /api/admin/archive-sources/{id}                     delete
POST   /api/admin/archive-sources/{id}/test                connection test
POST   /api/admin/archive-sources/{id}/discover            discover mailboxes
GET    /api/admin/archive-sources/{id}/mailboxes           archived mailboxes
PUT    /api/admin/archive-sources/{id}/mailboxes/{mbxId}   {"enabled": true} within the licence line
POST   /api/admin/archive-sources/{id}/run                 fetch now, optionally {"mailboxId": "..."}
GET    /api/admin/archive-sources/{id}/runs                history (mailboxId, limit)

curl -X POST https://mail.company.com/api/admin/archive-sources -H "X-Api-Key: $KEY" -H "Content-Type: application/json" -d '{
  "kind": "Journal", "name": "Microsoft 365 journal", "journalDomain": "archive.company.com",
  "settings": { "domains": ["company.com"], "allowedSenderNetworks": ["203.0.113.0/24"], "requireTls": true },
  "retentionDays": 3650, "lockMode": "Compliance" }'

設定、預設值與最佳實務

設定 / 位置 說明 預設值 生產環境最佳實務
Journal: Domains (domains) 只有這些網域及其子網域的信封位址才會成為已封存信箱(在啟用自動探索時首次出現即成為已封存信箱)。沒有符合位址的郵件會進入該來源的 "journal without assignment" 儲存區,該儲存區不計入授權。 leer · automatische Erkennung an 請輸入舊環境的所有網域,否則指派中將會遺漏信箱。
Journal: Schutz (allowedSenderNetworks, requireTls, allowedEnvelopeSenders) 允許傳送伺服器的 IP 位址或 CIDR 範圍、僅限透過 TLS 接收(STARTTLS 或隱式)以及允許的信封寄件者(位址、*@domain 或 domain)。日誌位址需要 IP 清單或在其本機部分包含安全權杖(至少 16 個字元,由伺服器產生)。 keine IP-Liste · TLS aus · alle Absender 設定服務商的 IP 範圍並要求 TLS;同時保留權杖。
Journal: Format (format) auto 透過 X-MS-Journal-Report 識別日記報告;envelope 強制按 Exchange 或 Microsoft 365 報告解析,bcc 將每封郵件視為副本(Google 副本規則、其他 MTA)。 auto 除非 MTA 傳送帶有自身標頭的密件副本,否則請保持 auto。
Aufbewahrung (RetentionDays, LockMode) 按來源設定以天數為單位的 WORM 保留期(0 到 36,500,0 = 無 WORM 保留),模式為 Normal、Governance 或 Compliance。適用於每封已歸檔郵件的 Blob 與郵件本身。 Compliance 請選擇商業信函與會計憑證的法定期限;Compliance 在到期前無法解除。
Legal Hold (LegalHold) 鎖定該來源的所有郵件以防刪除,即使超過保留期也同樣有效。啟用後,保留也會套用到已封存的郵件;每次變更都會記錄在稽核記錄中。 aus 因訴訟或稽核而啟用,僅在法務部門批准後才解除。
Zeitplan und Erkennung (ScheduleMinutes, AutoDiscover) API 來源(IMAP、Microsoft 365、Google)的擷取間隔從 5 分鐘到 7 天;在叢集中只有領導者會進行擷取。日誌來源透過 SMTP 接收,沒有排程。 60 min 對於大型租戶的初始匯入,請手動啟動執行,並按信箱檢視歷史記錄。
Geheimnisse (Secrets) 密碼、用戶端密碼、憑證和服務帳戶金鑰均加密儲存在伺服器金鑰環中。它們為唯寫:API 回應只包含其名稱,從不包含值,也從不出現在記錄檔中。 verschlüsselt 請注意用戶端密碼與憑證的到期時間;連線測試會回報已過期的密碼。