Repository navigation
Connecting a Google Workspace Mailbox
From v0.3.0, an organization's report mailbox can be a Google Workspace mailbox, read through one service account for the whole server. The server's hosted mailbox can be read the same way.
- In the Google Cloud console, create a project (or use one), enable the Gmail API, and create a service account. Create a JSON key for it.
- Give the key to YetAnotherDmarcTool, in the api and the worker:
-
GOOGLE_MAIL_SERVICE_ACCOUNT_FILE: the path of the key file, mounted read-only (Docker Compose); or -
GOOGLE_MAIL_SERVICE_ACCOUNT_JSON: the key's contents on one line (Portainer stack variable, or the Azure template's Google Workspace mailboxes step, which stores it in Key Vault).jq -c . key.jsonprints it on one line.
-
- The admin console's setup checks say if the key can't be read.
The service account's client ID (in the key, and shown in Settings → Mailbox) is what customers' Workspace admins grant access to.
- The organization's Google Workspace admin grants the service account
access once: admin.google.com → Security → Access and data control → API
controls → Manage domain-wide delegation → Add new:
- Client ID: the one shown in Settings → Mailbox
- OAuth scope:
https://www.googleapis.com/auth/gmail.modify
- In YetAnotherDmarcTool, an org admin: Settings → Mailbox → Google Workspace mailbox, enter the mailbox, Test connection, Save & start syncing.
The mailbox must be on one of the organization's verified domains. Domain-wide delegation lets the service account act as anyone in a Workspace that granted it, so this is what keeps one organization from reading another's mailbox.
Reports are marked read, removed from the inbox and labelled DMARC
processed (created if missing). A message that isn't a readable report is
only marked read. The report sender check uses Gmail's own
Authentication-Results (mx.google.com); nothing to confirm.
Set HOSTED_REPORTS_SOURCE=google and HOSTED_REPORTS_MAILBOX_ADDRESS to the
mailbox, with the service account above (your own Workspace grants it
access). The mailbox must deliver name+anything@domain to name@domain;
Gmail does. Reports are routed to the right organization by the address they
were sent to.
| Message | Meaning |
|---|---|
| "hasn't granted domain-wide delegation to client ID ... with scope ..." | Step 1 above isn't done, or the scope differs. Changes can take a few minutes. |
| "check that the mailbox exists in a Workspace that granted access" | Wrong address, or the mailbox is in another Workspace. |
| "the mailbox must be on one of your verified domains" | Verify the domain first (Settings → Domains). |
← Back to the README · Live demo · Report an issue · MIT licensed
- Quick Start: Docker Compose
- Deploying with Portainer
- Deploying on Azure
- Configuration Reference
- Onboarding an Organization
- IMAP Mailbox
- Google Workspace Mailbox
- Sign-in Providers
- Multi-Tenancy & RLS
- DMARC Subdomain Inheritance
- Report Attribution
- SPF Conditional Mode
- Detected Domains
- DNS Check Scheduling
- Domain Rating
🏗️ Architecture
🗺️ Roadmap