Chapter 09b Mail Transport & Defense Admin: #pBackupMx

Microsoft 365 Fallback, Smart Backup MX & M365 Continuity: 5-Step Setup, Entra Graph Sync, ARC-Seal & Emergency Webmail

nextxch augments existing Microsoft 365 and Exchange Online environments with a sovereign continuity shield on your own infrastructure - without touching Outlook, iPhone, or Android clients, and immediately available in three operating modes (free up to 10 mailboxes in Free; above 10 mailboxes, Stage A & Mode C in Business and Stage B with the optional +€99 / year per-server add-on): (1) Smart Backup-MX (Stage A, MX 20 store-and-forward during EOP outages such as EX1550543 on Nov 12/13, 2026), (2) First-MX Sovereignty Gateway (Mode C, permanent MX 10 with sovereign SpamGuard / 8-engine AV filtering and optional GoBD WORM archiving ahead of the US cloud), or (3) M365 Continuity (Stage B with a rolling 30-day Exchange journal shadow mailbox, crisis login readiness, 1-click emergency Webmail, and idempotent SentItems write-back). Valid recipients including shared mailboxes (accountEnabled = false) are verified in O(1) in-memory (< 100 ns, 0 SQL I/O); nextxch preserves the original envelope without SRS, seals inbound authentication results via RFC 8617 ARC-Seal, and paces recovery via AIMD Smart Recovery Drain.

Operational Tip & Architecture Note

Critical rule for clean SPF/DKIM/DMARC behind a secondary MX: never enable SRS envelope rewriting for Microsoft 365 backup domains. Instead, combine the three Step 3 building blocks: (1) Partner Inbound Connector locked to BOTH nextxch's TLS certificate subject AND source IP (preventing cross-tenant spoofing on multi-tenant hosts), (2) Microsoft Defender Enhanced Filtering (Set-InboundConnector -EFSkipLastIP $true), and (3) Trusted ARC Sealer (Set-ArcConfig -ArcTrustedSealers). Always configure at least one alert target outside the protected M365 domain itself (external email, signed webhook, or SMS).

The Admin Fallback Page at a Glance (/admin/#/backup-mx)

Open Live in Admin Demo ->

All screenshots are captured directly from the live Admin Cockpit (automatically matching Light/Dark mode and clickable for full 2880x1800 Retina inspection).

/admin/#/backup-mx
Crisis Dashboard & Protected Microsoft 365 DomainsCrisis Dashboard & Protected Microsoft 365 Domains
Admin Cockpit · Overview

Crisis Dashboard & Protected Microsoft 365 Domains

Displays live circuit health across all protected tenants under Domains -> Microsoft 365 Fallback (Stage A Smart Backup-MX during paced AIMD recovery, Mode C MX 10 Gateway, and Stage B M365 Continuity), the in-memory O(1) recipient cache, and 1-click actions for Graph sync, self-test, and NIS2 proof.

/admin/#/backup-mx · 72h & Queue
72-Hour Telemetry & AES-256-GCM Transit Queue Inspector72-Hour Telemetry & AES-256-GCM Transit Queue Inspector
72h Chart & VIP Queue

72-Hour Telemetry & AES-256-GCM Transit Queue Inspector

Hourly inbound, buffered, and blocked telemetry paired with the encrypted transit queue inspector, VIP priority lane badges, and per-message Strict-PKIX TLS diagnostics.

/admin/#/backup-mx · Stufe B
Shadow Mailbox, Emergency Switch & Crisis Login ReadinessShadow Mailbox, Emergency Switch & Crisis Login Readiness
Stage B · M365 Continuity

Shadow Mailbox, Emergency Switch & Crisis Login Readiness

1-click standby/emergency toggle, Exchange Online journal PowerShell rule, pre-published nxfallback DKIM record, and Entra-independent Crisis Login Readiness score.

The Guided 5-Step Setup Wizard in the Admin Cockpit

Clicking "+ Protect domain (5-step wizard)" or "Setup Wizard / Edit" guides administrators step by step through all five configuration stages:

/admin/#/backup-mx · Assistent (1/5)
Domain, Operating Mode (MX 20 / MX 10 / Stage B) & EOP Target HopDomain, Operating Mode (MX 20 / MX 10 / Stage B) & EOP Target Hop
Step 1 / 5

Domain, Operating Mode (MX 20 / MX 10 / Stage B) & EOP Target Hop

Automatic MX discovery against the SSRF-hardened EOP allowlist, selection between Smart Backup-MX, Sovereignty Gateway, or M365 Continuity, VIP priority mailboxes, and _nextxch-verify ownership proof.

/admin/#/backup-mx · Assistent (2/5)
Recipient Sync via Microsoft Graph (Zero Mail.Read) or CSVRecipient Sync via Microsoft Graph (Zero Mail.Read) or CSV
Step 2 / 5

Recipient Sync via Microsoft Graph (Zero Mail.Read) or CSV

Least-privilege Application permissions (User.Read.All, GroupMember.Read.All, Domain.Read.All) via X.509 certificate or secret, automatically capturing shared mailboxes with accountEnabled = false.

/admin/#/backup-mx · Assistent (3/5)
Exchange Online Connector, Enhanced Filtering & Trusted ARC SealerExchange Online Connector, Enhanced Filtering & Trusted ARC Sealer
Step 3 / 5

Exchange Online Connector, Enhanced Filtering & Trusted ARC Sealer

Pre-populated ExchangeOnlineManagement PowerShell script binding your TLS certificate subject and outbound IP, enabling EFSkipLastIP, and registering nextxch as a Trusted ARC Sealer.

/admin/#/backup-mx · Assistent (4/5)
1-Click Dress Rehearsal & Sealed NIS2 Report (BSIG Sec. 30)1-Click Dress Rehearsal & Sealed NIS2 Report (BSIG Sec. 30)
Step 4 / 5

1-Click Dress Rehearsal & Sealed NIS2 Report (BSIG Sec. 30)

Verifies Strict-PKIX STARTTLS (TLS 1.3), EOP certificate SANs, and 250 2.6.0 connector acceptance against a live recipient before changing DNS, then exports the SHA-256-sealed NIS2 audit report.

/admin/#/backup-mx · Assistent (5/5)
Activate DNS MX Record & Out-of-Band Outage AlertsActivate DNS MX Record & Out-of-Band Outage Alerts
Step 5 / 5

Activate DNS MX Record & Out-of-Band Outage Alerts

Copy-ready MX 20 / MX 10 record with live DNS verification, external alert recipients outside the protected M365 domain, HMAC-SHA256 signed webhook, and Port 25 activation.

1. The 5-step workflow & DNS records (MX 20 Backup-MX vs. MX 10 Gateway)

Under Domains > Microsoft 365 Fallback, the guided wizard takes ~15 minutes from domain ownership verification and Graph sync to Exchange Online PowerShell lockdown and the 1-click dress rehearsal. Port 25 accepts mail for a backup domain only after ownership is proven via _nextxch-verify TXT or verified inside the authenticated Microsoft Graph tenant.

Reference / Configuration
# Guided flow in the Admin Cockpit (Domains > Microsoft 365 Fallback):
# Step 1: Pick domain (company.com) & mode:
#         backup_mx = MX 20 | gateway_first_mx = MX 10 | continuity = Stage B (Shadow Mailbox + Emergency Webmail)
#         Target hop is auto-detected and validated against the SSRF-safe EOP allowlist:
#         company-com.mail.protection.outlook.com:25 (Strict-PKIX STARTTLS enforced)
# Step 2: Connect Microsoft Graph (User.Read.All, GroupMember.Read.All, Domain.Read.All;
#         Mail.ReadWrite strictly in Stage B for SentItems write-back only!)
# Step 3: Apply Exchange Online Connector, Enhanced Filtering & Trusted ARC Sealer via PowerShell
# Step 4: Run 1-click self-test ("Verify backup route now") + download NIS2 failover report
# Step 5: Publish DNS MX record & configure out-of-band alerting (+ Journal & nxfallback DKIM in Stage B)

# Option A: Smart Backup-MX (Stage A - daily mail direct to Microsoft 365, outage failover via nextxch)
_nextxch-verify.company.com. 300  IN TXT  "nx-verify=8f3c9a1d7e2b40c6a519f8e2d3b4c5a6"
company.com.                 300  IN MX   10 company-com.mail.protection.outlook.com.
company.com.                 300  IN MX   20 mx-fallback.your-hoster.eu.

# Option B: M365 Continuity (Stage B - like Option A/C + pre-published emergency DKIM selector & SPF)
nxfallback._domainkey.company.com. 3600 IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqh..."
company.com.                 3600 IN TXT  "v=spf1 ip4:198.51.100.25 include:spf.protection.outlook.com -all"

# Option C: Sovereignty Gateway (Mode C - 100% inbound filtering & optional GoBD archive pre-M365)
company.com.                 300  IN MX   10 mx-fallback.your-hoster.eu.
# (No public M365 MX in DNS; restrict direct external delivery on the EOP Inbound Connector)

2. Step 2 in detail: Microsoft Entra ID app registration (least privilege without Mail.Read)

Create a single-tenant app registration in the Microsoft Entra admin center. Stage A and Mode C require directory read permissions only. The delta sync deliberately includes shared mailboxes and rooms where accountEnabled = false, while stripping non-SMTP prefixes (SIP:, X500:, SPO:) and unrelated *.onmicrosoft.com shadow addresses.

Reference / Configuration
# Microsoft Entra admin center (https://entra.microsoft.com):
# 1. Identity > Applications > App registrations > New registration
#    Name: "nextxch M365 Fallback Directory Sync"
#    Supported account types: Accounts in this organizational directory only (Single tenant)
#
# 2. API permissions > Add a permission > Microsoft Graph > Application permissions:
#    - User.Read.All          (Users, shared mailboxes with accountEnabled=false, rooms & proxyAddresses)
#    - GroupMember.Read.All   (Mail-enabled security groups & Microsoft 365 distribution lists)
#    - Domain.Read.All        (Automatic verification of verified tenant domains)
#    -> Click "Grant admin consent for <Tenant>"
#    (IMPORTANT: Stage A & Mode C require ZERO Mail.Read and ZERO Mail.ReadWrite!
#     Grant Mail.ReadWrite ONLY when enabling Stage B "M365 Continuity", where it is used
#     exclusively for idempotent SentItems write-back after emergency Webmail recovery.)
#
# 3. Certificates & secrets:
#    Recommended: Upload an RSA 2048/3072 certificate (.cer in Entra, .pfx stored in nextxch keyring)
#    Alternative: Create a client secret and copy its Value (not the Secret ID)

# Graph delta queries executed incrementally every 15 minutes:
GET https://graph.microsoft.com/v1.0/users/delta?$select=id,mail,otherMails,proxyAddresses,accountEnabled,userType,assignedPlans,deletedDateTime
GET https://graph.microsoft.com/v1.0/groups/delta?$select=id,mail,proxyAddresses,mailEnabled,deletedDateTime
GET https://graph.microsoft.com/v1.0/contacts?$select=id,mail,proxyAddresses

3. Step 3: Exchange Online Partner Connector, Enhanced Filtering & Trusted ARC Sealer (PowerShell)

Run the following commands in Exchange Online PowerShell (module ExchangeOnlineManagement). Inside the Admin Cockpit, nextxch generates this exact script pre-populated with your server IP, TLS certificate subject, and ARC signing domain.

Reference / Configuration
# Connect to Exchange Online PowerShell
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName admin@company.com

# 1. Create the Partner Inbound Connector:
#    CRITICAL for multi-tenant isolation: bind BOTH TLS certificate name AND source IP!
New-InboundConnector `
  -Name "nextxch M365 Fallback (company.com)" `
  -ConnectorType Partner `
  -SenderDomains "*" `
  -RequireTls $true `
  -RestrictDomainsToCertificate $true `
  -TlsSenderCertificateName "mx-fallback.your-hoster.eu" `
  -RestrictDomainsToIPAddresses $true `
  -SenderIPAddresses @("198.51.100.25")

# 2. Enable Microsoft Defender Enhanced Filtering (Skip Listing):
#    Instructs EOP to extract the real originating client IP from nextxch's topmost
#    RFC 5321 Received header for SPF, reputation, and anti-phishing evaluation.
Set-InboundConnector `
  -Identity "nextxch M365 Fallback (company.com)" `
  -EFSkipLastIP $true `
  -EFSkipIPs @("198.51.100.25") `
  -EFUsers @()

# 3. Register nextxch as a Trusted ARC Sealer (RFC 8617):
#    Preserves verified inbound SPF/DKIM/DMARC verdicts cryptographically across forwarding.
Set-ArcConfig -Identity Default -ArcTrustedSealers "mx-fallback.your-hoster.eu"

# Verify settings:
Get-InboundConnector "nextxch M365 Fallback (company.com)" |
  Format-List Name,Enabled,RequireTls,TlsSenderCertificateName,SenderIPAddresses,EFSkipLastIP,EFSkipIPs
Get-ArcConfig | Format-List Identity,ArcTrustedSealers

4. Steps 4 & 5: End-to-end dress rehearsal, NIS2 report (BSIG Sec. 30) & Admin API

Before publishing the DNS MX record, the 1-click self-test validates the complete transport chain (Strict-PKIX STARTTLS, Partner Connector acceptance, ARC seal) against a real recipient in your tenant and exports the SHA-256-sealed audit report. Every operation is also available via /api/admin/backup-mx/*.

Reference / Configuration
# Admin API overview (/api/admin/backup-mx/*):
GET    /api/admin/backup-mx/domains                        All protected domains + live queue/sync summary
POST   /api/admin/backup-mx/domains                        Register a new M365 fallback domain
POST   /api/admin/backup-mx/discover-mx                    Auto-detect target hop & M365 cloud via live DNS
PUT    /api/admin/backup-mx/domains/{id}                   Update mode, holdDays, drainRate, VIP list & alerts
DELETE /api/admin/backup-mx/domains/{id}                   Remove Backup-MX configuration
POST   /api/admin/backup-mx/domains/{id}/verify-dns        Verify _nextxch-verify TXT & live MX records
POST   /api/admin/backup-mx/domains/{id}/sync-graph        Trigger immediate Microsoft Graph delta sync
GET    /api/admin/backup-mx/domains/{id}/recipients        List synchronized + manual recipients (incl. VIP flag)
POST   /api/admin/backup-mx/domains/{id}/recipients        Upsert manual allow/block entry or CSV batch
DELETE /api/admin/backup-mx/domains/{id}/recipients/{addr} Remove manual recipient entry
GET    /api/admin/backup-mx/domains/{id}/stats?hours=72    72h hourly series + queue summary
GET    /api/admin/backup-mx/domains/{id}/queue?limit=200   Inspect encrypted AES-256-GCM queue items
POST   /api/admin/backup-mx/domains/{id}/drain-now         Trigger gentle AIMD Smart Drain immediately
GET    /api/admin/backup-mx/domains/{id}/powershell-setup  Fetch pre-filled Exchange Online PowerShell script
POST   /api/admin/backup-mx/domains/{id}/self-test         Send end-to-end failover probe to test recipient
GET    /api/admin/backup-mx/domains/{id}/nis2-report       Download SHA-256-sealed NIS2 report (.html/.md)
GET    /api/admin/backup-mx/domains/{id}/continuity        Stage B status: Journal, DKIM, Readiness Score & Outbox
POST   /api/admin/backup-mx/domains/{id}/continuity/emergency          Toggle emergency Webmail ({ "active": true|false })
POST   /api/admin/backup-mx/domains/{id}/continuity/emergency-password Set local emergency password per mailbox
POST   /api/admin/backup-mx/domains/{id}/continuity/sync-outbox        Write emergency replies back to M365 SentItems
POST   /api/admin/backup-mx/domains/{id}/continuity/purge-shadow       Purge expired shadow mailbox messages now

# Example: run end-to-end dress rehearsal via API and download the NIS2 report
curl -X POST https://mail.company.com/api/admin/backup-mx/domains/<id>/self-test \
  -H "X-Api-Key: $NEXTXCH_KEY" -H "Content-Type: application/json" \
  -d '{"testRecipient":"it-ops@company.com"}'

curl -s "https://mail.company.com/api/admin/backup-mx/domains/<id>/nis2-report?format=md&lang=en" \
  -H "X-Api-Key: $NEXTXCH_KEY" -o NIS2-Failover-Verification-company-com.md

5. Stage B (M365 Continuity): Exchange Journal shadow mailbox, crisis login readiness, emergency switch & SentItems write-back

Stage B (mode = continuity, included up to 10 mailboxes in Free and with the optional +€99 / year per-server add-on above 10 mailboxes) maintains a rolling 30-day shadow mailbox per user and unlocks full reading and DMARC-aligned replying in nextxch Webmail (/mail/) during major cloud outages - even if login.microsoftonline.com is unreachable at the same time.

Reference / Configuration
# 1. Configure the Exchange Online SMTP Journal Rule (PowerShell):
#    nextxch enforces Strict TLS plus Microsoft 365 outbound IP range verification
#    (continuityRequireMicrosoftIp = true) on continuity-jnl-<token>@..., unwraps the inner
#    original MIME payload, and deduplicates via SHA-256 into the 30-day shadow mailbox.
New-JournalRule `
  -Name "nextxch M365 Continuity (company.com)" `
  -JournalEmailAddress "continuity-jnl-8f3c9a1d7e2b@mx-fallback.your-hoster.eu" `
  -Scope Global `
  -Enabled $true

# 2. Pre-publish Crisis DNS in peacetime (zero TTL propagation delay when an outage hits):
nxfallback._domainkey.company.com. 3600 IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A..."
company.com.                       3600 IN TXT "v=spf1 ip4:198.51.100.25 include:spf.protection.outlook.com -all"

# 3. Verify Crisis Login Readiness (independent of Entra ID / login.microsoftonline.com):
#    - The "M365 Continuity & Emergency Operations" card displays the live Readiness Score
#      (readyUsers / totalUsers) across WebAuthn Passkeys (FIDO2), local emergency passwords & TOTP.
#    - Admins can assign or rotate a local emergency password inline per user in one click.

# 4. Emergency Mode Switch & Idempotent SentItems Write-Back:
#    - Normal: Standby Mode (read-only; outbound sending from shadow mailboxes is locked).
#    - Crisis: 1-click toggle in Admin OR auto-activate after continuityAutoActivateMinutes (15..240 min).
#              Inbound MX 20 failover mail is delivered straight into local shadow mailboxes too;
#              outbound replies from /mail/ are signed with nxfallback DKIM and tracked in the Outbox.
#    - Recovery: Idempotent Graph write-back (keyed by InternetMessageId) into M365 SentItems
#              (Mail.ReadWrite is required ONLY for Stage B; Stage A & Mode C remain zero-mail-read).

Settings, Default Values & Best Practices

Setting / Location Description Default Value Production Best Practice
Modus (mode) backup_mx (Stage A, MX 20 store-and-forward during EOP outages), gateway_first_mx (Mode C, permanent MX 10 ahead of Microsoft 365 using the identical engine), or continuity (Stage B, rolling Exchange journal shadow mailbox + emergency Webmail + SentItems write-back). backup_mx All 3 modes are included free up to 10 mailboxes; above 10 mailboxes, Stage A & Mode C run in Business while Stage B is included with the optional server add-on (+€99 / year per server, on request).
Ziel-Hop (targetHost, targetPort) Pinned Exchange Online target host (allowlist: *.mail.protection.outlook.com, *.mail.protection.outlook.de, *.mail.protection.office365.us, *.mail.protection.partner.outlook.cn). Every resolved IP is checked against loopback, RFC1918, link-local, cloud metadata (169.254.169.254), and local listener IPs before socket connect. <tenant>.mail.protection.outlook.com:25 Always use the pinned EOP host rather than dynamic MX lookup to prevent routing loops; custom target hosts are restricted to ServerAdmin.
Graph-Berechtigungen & Auth (credentialType) Least-privilege Microsoft Graph Application permissions: User.Read.All, GroupMember.Read.All, and Domain.Read.All (zero Mail.Read!). Supports RSA certificate (x5t#S256), client secret (encrypted in server keyring), or offline CSV/manual lists (manual_csv). certificate / 15 min Delta Prefer RSA certificate authentication in production; shared mailboxes with accountEnabled = false are captured automatically via proxyAddresses.
Fail-Safe Freeze & Lösch-Schonfrist (syncFrozen, softDeletedUntilUtc) If a Graph sync fails or a snapshot suddenly drops more than 20% of active addresses at once, nextxch freezes the directory automatically (syncFrozen = true). Normally removed Entra addresses retain a 72-hour soft-delete grace window. aktiv · > 20 % Bremse · 72 h Keep active so simultaneous Graph/Entra disruptions or accidental group edits never cause valid recipients to be rejected.
Plus-Addressing & Anti-Harvesting (allowPlusAddressing) Resolves RFC 5233 subaddressing (anna+project@company.com) in O(1) against the base recipient in FrozenSet. After 5 invalid RCPT TO commands per session or 15 per IP / 10 min, progressive async tarpitting and Auto-Ban engage. true Keep enabled (true) to match Exchange Online's default subaddressing behavior.
Vorhaltezeit & Backscatter-Schutz (holdDays, HeaderFromAuthenticated) Time-based retention in the AES-256-GCM spool (holdDays, 1 to 14 days) decoupled from normal 8-attempt outbound limits. Late DSN bounces are emitted strictly when inbound SPF or DKIM alignment (HeaderFromAuthenticated) passed. 5 Tage (120 h) 5 days safely bridges multi-day outages across long weekends with zero premature bounces and zero backscatter.
Outbound-TLS, Received & ARC-Seal Enforces STARTTLS (TLS 1.2/1.3) with Strict PKIX validation and exact SAN matching toward EOP, omits SRS, prepends one clean RFC 5321 Received header, and signs an RFC 8617 ARC-Seal. Strict PKIX · kein SRS · ARC an Cannot be downgraded to Opportunistic or cleartext; on TLS mismatch, mail stays encrypted in the spool and triggers an immediate admin alert.
Circuit-Breaker, Smart Drain & VIP-Vorrang (drainRatePerMin, vipAddresses) Opens after 3 consecutive EOP failures (Circuit Open), probes every 60 s (±10 s jitter) with a single Canary connection, and ramps via AIMD from 20 mails/min (+20 every 2 clean minutes) up to drainRatePerMin, draining VIP mailboxes first. 120 Mails/Min · max. 3 Verbindungen List critical addresses such as ceo@, dispatch@, and support@ in vipAddresses so urgent business mail drains ahead of bulk traffic.
Stufe B: Schattenpostfach & Exchange-Journal (shadowRetentionDays, continuityJournalAddress, continuityRequireMicrosoftIp) Accepts Exchange Online journal reports at continuity-jnl-<token>@<serverHost> strictly over TLS and (by default) verified Microsoft 365 IP ranges, unwraps the inner original MIME message, and stores it SHA-256 deduplicated for shadowRetentionDays (7 to 365 days) inside each user's shadow mailbox. 30 Tage · M365-IP + TLS Pflicht Keep continuityRequireMicrosoftIp = true and configure New-JournalRule with Scope Global so both inbound and outbound threads are available during an outage.
Stufe B: Notbetrieb, Krisen-DKIM & SentItems-Write-Back (continuityEmergencyActive, continuityAutoActivateMinutes, continuityDkimSelector) Read-only standby during normal operations; via 1-click toggle in Admin or automatically after continuityAutoActivateMinutes (0 = manual, 15..240 min of degraded EOP), unlocks Webmail replies signed with the pre-published DKIM selector (default nxfallback) and writes sent items idempotently back into M365 SentItems via Graph Mail.ReadWrite. Bereitschaft · 0 (manuell) · nxfallback Publish nxfallback._domainkey.<domain> and SPF in DNS ahead of time, and verify via the Admin Readiness Score that key staff have a local Passkey or emergency password enrolled.