Skip to content

Google Workspace

Google Workspace is Google's suite of mail, documents and user accounts for organizations; one connector covers one customer account.

  • What DRACO uses: Directory and policy settings for posture scans, the Admin SDK Reports audit events, users, groups and devices.
  • What for: Compliance, detections, UEBA and hunts on sign-in and admin events, user suspension and sign-out.

Add it in Connectors > Add connector: pick Google Workspace, choose With posture scans (the account first, then the other parts) or Without posture scans (only logs, users and groups, or response actions, each with a key of its own), then choose what DRACO collects and what it may change. Add more later with Add a part on its connector page. See Connectors for how connectors, sign-in and tags work.

Parts

Part What DRACO uses Access Permissions
Posture Google Workspace read Domain-wide delegation of the read-only scopes admin.directory.user, domain, customer, orgunit, rolemanagement and cloud-identity.policies (.readonly) to the service account, impersonating a super administrator.
Logs Google Workspace audit logs read Domain-wide delegation of https://www.googleapis.com/auth/admin.reports.audit.readonly to the service account, added to the same client ID entry as the scan's scopes; the logs act as the provider's delegated administrator (without a provider: an administrator whose role holds the Reports privilege).
Directory Google Workspace audit logs read Domain-wide delegation of the read-only scopes https://www.googleapis.com/auth/admin.directory.user.readonly and https://www.googleapis.com/auth/admin.directory.group.readonly to the service account of the logs part.
Devices (optional): admin.directory.device.mobile.readonly and admin.directory.device.chromeos.readonly as well.
The impersonated administrator is the super administrator of the scan (a custom role reads users and groups with the Admin privileges Users > Read and Groups > Read; devices need a super administrator).
Response Suspend user, Sign out user (Google Workspace) write Domain-wide delegation of admin.directory.user (Suspend user), admin.directory.user.security and admin.directory.user.readonly (Sign out user) to a separate service account, acting as a super administrator.

Posture

DRACO for Google Workspace audits the organization's Google Workspace environment for security misconfigurations, including super administrator account hygiene, domain settings, and more.

Prerequisites

Set up authentication for Google Workspace with the Google Workspace Authentication guide before starting either path:

  • Service Account: Create a Service Account in a GCP project with Domain-Wide Delegation enabled.
  • OAuth Scopes: Authorize the required read-only OAuth scopes in the Google Workspace Admin Console.
  • Customer ID: Identify the Google Workspace Customer ID to use as the provider identifier.
  • Delegated User: Have the email of a super administrator to use as the delegated user.

Connect the provider in DRACO

Step 1: Locate the Customer ID

  1. Log into the Google Workspace Admin Console.
  2. Navigate to "Account" > "Account Settings".
  3. Find the Customer ID on the Account Settings page.

    Google Workspace Customer ID

Note

The Customer ID starts with the letter "C" followed by alphanumeric characters (e.g., C0xxxxxxx). This value acts as the unique identifier for the Google Workspace account in DRACO.

Step 2: Open DRACO

  1. Sign in to DRACO
  2. Open Connectors, click Add connector and pick Google Workspace: the wizard opens at Link a Provider.

Step 3: Provide Credentials

  1. Enter the Customer ID and an optional alias, then click "Next".

  2. Paste the Service Account JSON credentials content.

  3. Enter the Delegated User Email (a super administrator in the Google Workspace organization), then click Authenticate.

Note

The Service Account JSON is the full content of the key file downloaded when creating the Service Account. Paste the entire JSON object, not just the file path. For setup instructions, see the Authentication guide.

Step 4: Check Connection

  1. Click Check connection to verify that the credentials and Domain-Wide Delegation are configured correctly.
  2. DRACO will test the Service Account impersonation and Admin SDK access.

Note

If the connection test fails, verify that Domain-Wide Delegation is properly configured and that all required OAuth scopes are authorized. It may take a few minutes for delegation changes to propagate. See the Troubleshooting section for common errors.

Step 5: Launch the Scan

  1. Launch the first scan (Run now or On a schedule).

Every authentication option, with the exact scopes: Google Workspace authentication.

Logs

The Google Workspace audit logs data source (google_workspace_audit) reads the activity reports of your Google Workspace domain through the Admin SDK Reports API: sign-ins, admin console changes, Drive sharing, OAuth app grants, SAML sign-ins to other apps, user account changes, groups, mobile devices and data protection (DLP) rules.

DRACO signs in as a service account with domain-wide delegation and reads the reports as one of your administrators. Nothing is installed in your domain and no data leaves Google other than these audit events.

Requirements

  • A Google Workspace edition with the audit logs you want (all editions have login, admin, Drive, token and user account logs; some logs such as data protection rules or Chrome need higher editions).
  • A super admin for the setup (creating the delegation).
  • An administrator account DRACO impersonates: a super admin, or an admin with a role that has the Reports privilege (Admin console > Account > Admin roles > the role > Privileges > Admin console privileges > Reports).

Client setup

  1. Create or pick a Google Cloud project (console.cloud.google.com). If you already connected Google Workspace as a DRACO provider, use the same project and service account and skip to step 4.
  2. Enable the Admin SDK API in the project: APIs & Services > Library > Admin SDK API > Enable.
  3. Create a service account (IAM & Admin > Service accounts > Create service account; no project roles are needed). Open it > Keys > Add key > Create new key > JSON, and keep the downloaded file safe. Copy the service account's Client ID (Details tab, a long number).
  4. Delegate the Reports scope (super admin): Admin console (admin.google.com) > Security > Access and data control > API controls > Manage Domain Wide Delegation > Add new (or edit the existing entry of the service account):

    • Client ID: the number from step 3;
    • OAuth scopes: https://www.googleapis.com/auth/admin.reports.audit.readonly.

    If the service account already has scopes (the DRACO provider's directory scopes), add this one to the comma-separated list; do not replace them. Delegation can take a few minutes, rarely up to 24 hours, to apply. 5. Pick the administrator to impersonate: a super admin, or better a dedicated admin account with a custom role that has only the Reports privilege. It must be a real user (not a group or an alias) and stay active.

The scope is read-only: DRACO cannot change anything in the domain.

Add the source in DRACO

  1. Connectors > Add connector, pick Google Workspace, then:

    • With posture scans: the account steps first (Customer ID, the service account JSON and a super administrator, Check connection), then tick Logs under Collectors. DRACO uses the account's service account and its delegated user; the administrator field is hidden. That service account still needs the Reports scope of step 4.
    • Without posture scans, for a key that has only the Reports scope and an administrator with only the Reports privilege: tick Logs under Collectors (no account check). On Account enter the administrator's email in Delegated admin email (the Customer ID may stay empty); on Sign in save the whole key file from step 3 as a new Generic JSON credential.

    On a Google Workspace connector you already have, use Add a part instead. 2. Settings: - Applications, one per line. Default: login, admin, drive, token, saml, user_accounts, groups, mobile, rules. Also available: access_transparency, calendar, chat, chrome, context_aware_access, data_studio, gcp, groups_enterprise, jamboard, keep, meet, vault. - Optional: how far the first run looks back (24 hours), the re-read window for late events (120 minutes) and the pages per application per run (5 pages of 1,000 events). 3. Test connection: DRACO signs in, reads a few events of every picked application and shows them parsed. The source is created only after a passing test; an application Google refuses for your edition fails the test with its name (remove it from the list).

What DRACO collects

One event per activity event (an activity with several events, such as a bulk admin action, gives several events):

Event field From the activity
time id.time
action application.event, for example login.login_failure, admin.ASSIGN_ROLE, drive.change_document_visibility, token.authorize
actor_user actor.email (else the key or profile id of a service caller)
src_ip ipAddress
geo.country networkInfo.regionCode (when Google provides it)
resource_uid what the event is about: the Drive doc_id, the OAuth client_id, the user or group of an admin event, the user of a sign-in
cloud_account ownerDomain, else the customer id
status failure for login_failure and other failure events, success otherwise
class Authentication for sign-ins, Account Change for users, roles and 2-step verification, File Activity for Drive, API Activity for the rest
message who did what, on what, from where, and the result: [email protected]: login_failure (login) from 198.51.100.23 (BR): failed
fields the whole activity: id, actor, event (with the original parameters), params (the parameters as name: value, lists kept), application, event_name, event_type

Search examples:

source_type=google_workspace_audit action=login.login_failure | stats count by actor_user, src_ip
source_type=google_workspace_audit application=drive params.visibility=people_with_link | table ts, actor_user, params.doc_title, params.visibility
source_type=google_workspace_audit action=token.authorize | stats count by params.app_name, params.client_id
source_type=google_workspace_audit application=admin | stats count by actor_user, event_name

IDs resolved (Readable IDs): actor profile ID → e-mail; Drive document ID → title; OAuth client ID → app name; admin role ID → role name.

Latency

Google documents that activity reaches the Reports API from a few minutes up to several hours later, depending on the application (see Google's Data retention and lag times article); Drive and login events can take hours at busy times. DRACO therefore:

  • re-reads the last 120 minutes on every poll (up to 24 hours, Re-read window) and skips the events it already stored, so late events are not lost and nothing is stored twice;
  • keeps one cursor per application, so a slow application does not hold back the others;
  • when a run reaches its page limit, keeps Google's page token and the time window, and the next run finishes the same window before moving on (the API returns the newest events first).

Events that arrive later than the re-read window are not read: raise the window if your Drive or login events often arrive later. The built-in rules look back two to four hours for the same reason. The Reports API keeps 180 days of activity.

Rate limits (HTTP 429) are retried after the delay Google asks for; if Google keeps refusing, the run stops and the next one continues from the same point.

Built-in rules

The draco-saas pack has these rules for this source (Detections > Built-in). The ones marked recommended are on by default.

Rule Severity Fires on
Admin role or privilege granted (recommended) high admin.ASSIGN_ROLE, GRANT_ADMIN_PRIVILEGE, GRANT_DELEGATED_ADMIN_PRIVILEGES
2-step verification turned off (recommended) high a user's 2sv_disable; ENFORCE_STRONG_AUTHENTICATION or ALLOW_STRONG_AUTHENTICATION set to false
Mail forwarded to an outside address (recommended) high email_forwarding_out_of_domain; Gmail routing settings created or changed
Drive file shared publicly (recommended) medium Drive visibility changed to people_with_link or public_on_the_web
Suspicious sign-in flagged by Google medium suspicious_login*, gov_attack_warning, accounts disabled as hijacked or with a leaked password, is_suspicious sign-ins
One user signed in from two countries within two hours medium successful sign-ins of one user from two or more countries
OAuth app granted broad scopes medium token.authorize with full Gmail, full Drive, Gmail modify or send, admin or Cloud Platform scopes
Several users suspended or deleted by one admin medium three or more SUSPEND_USER or DELETE_USER by one admin in two hours

Each rule has What to do guidance (triage, likely false positives, containment).

Directory

Pulls the vendor's directory into the ID directory (readable names for alerts, incidents and investigations) and the assets: users (admin and delegated admin, 2-Step Verification, suspended, last sign-in), groups, mobile and ChromeOS devices. It signs in with the sign-in of the logs part, so turn logs on first, then turn on Directory on the connection (or tick Pull the directory in the log source's settings) and run Test: the Directory row reads one page of each part and names a missing permission.

Permissions (read): add these scopes to the domain-wide delegation of the service account (Security > Access and data control > API controls > Manage Domain Wide Delegation):

  • https://www.googleapis.com/auth/admin.directory.user.readonly and https://www.googleapis.com/auth/admin.directory.group.readonly;
  • for devices (optional): https://www.googleapis.com/auth/admin.directory.device.mobile.readonly and https://www.googleapis.com/auth/admin.directory.device.chromeos.readonly.

The administrator DRACO impersonates is a super administrator, who needs nothing more; a custom role reads users and groups with the Admin privileges Users > Read and Groups > Read, and devices need a super administrator. Devices name their ids in the ID directory only: they have no host name the events use.

DRACO reads the directory every hour (only what changed, where the vendor's API allows it) and in full once a day. Names and asset facts the vendor no longer lists are removed after the ID retention period. When the pull fails three times in a row, the connection shows the error and a connector health problem is opened.

Response

Runs response actions in the domain from incidents and workflows:

Action What it does Undo Delegated scopes
Suspend user Suspends the user (by primary email or ID): they can no longer sign in and their sessions end. Mail to them is still delivered. Restores the user. https://www.googleapis.com/auth/admin.directory.user
Sign out user Signs the user out of every web and device session; they sign in again with the same password. Not reversible. https://www.googleapis.com/auth/admin.directory.user.security, https://www.googleapis.com/auth/admin.directory.user.readonly

Setup: a second service account, separate from the read-only one of posture and logs, so the read-only key never gets write scopes.

  1. In the Google Cloud project of DRACO create a service account draco-workspace-response (no roles), create its JSON key and copy its Unique ID.
  2. In the Admin console open Security > Access and data control > API controls > Manage Domain Wide Delegation, click Add new and enter the Unique ID with only the scopes of the actions you want.
  3. Pick the administrator DRACO acts as: a super administrator, or an admin whose role has the privileges Users > Suspend and Users > Update. Only a super administrator can suspend another super administrator.
  4. In DRACO, at the Write access step, create a Generic JSON credential with the whole key file; on the Settings step enter the administrator's email.

Test asks Google for a token with the action's scopes (refused when the delegation does not hold them) and reads the administrator; it changes nothing. When the administrator is not a super administrator, the test says that their role decides.

More: Response actions.

If you turn on several parts

When you connect Google Workspace once and tick several parts, the wizard shows one guide for all of them: what to check first, the access to create once, one list of permissions that names the part each one is for, the extra steps of each part, and one test that checks every part on its own. Turning a part on later shows only what it adds.

Posture and the audit log can use the same service account: add the Reports scope to its domain-wide delegation next to the posture scopes. Response actions use a second service account with only their scopes, pasted at the Write access step.

Troubleshooting

The test or a run says Fix
Domain-wide delegation does not allow this service account (client ID ...) Step 4: add the client ID with the scope https://www.googleapis.com/auth/admin.reports.audit.readonly, or add the scope to the existing entry. Wait a few minutes and test again.
Google refused to impersonate ... The administrator must exist, be active and be a user (not a group or alias); check the spelling. A deleted or disabled key gives the same answer: create a new key.
Google denied reading the ... activity (HTTP 403) The impersonated user needs super admin or the Reports privilege, and the Admin SDK API must be enabled in the service account's project (step 2).
Google does not return ... activity That application is not part of your edition, or its name is wrong: remove it from Applications.
not a service account key file The credential must hold the JSON key file of a service account ("type": "service_account"), not an OAuth client or user credentials.
rate limit reached Google throttled the project; DRACO retried, and the next run continues from the same point.
Google Workspace denied the request (HTTP 403) on Suspend user or Sign out user The administrator DRACO acts as may not manage that user: use a super administrator (needed to suspend another super administrator), or give their role Users > Suspend and Users > Update.