Skip to Content
IntegrationsSaaS

Secure Google Workspace with Mondoo

Continuously scan Google Workspace for security misconfigurations using a GCP service account with domain-wide delegation.

To connect Google Workspace to Mondoo, you create a Google Cloud service account, grant it domain-wide delegation in your Workspace, and add its key to a Google Workspace integration in your space. Mondoo then assesses users, applications, and configuration, and keeps the assessment current as accounts and resources are added.

Before you begin

  • Editor or Owner access to the Mondoo space, or another role with permission to add integrations. To see every role, read Roles and permissions.
  • Super administrator access to the Google Workspace Admin Console, to grant domain-wide delegation. Mondoo also impersonates a super admin when it scans.
  • Permission to create a project in the Google Cloud Console. You become the new project's Owner, which covers enabling APIs and creating the service account key. If your Google Cloud organization enforces the iam.disableServiceAccountKeyCreation policy, an admin must allow key creation for the project.

The setup creates a Google Cloud project, a service account with a JSON key, and a domain-wide delegation entry that grants the service account the OAuth scopes Mondoo needs in your Workspace.

Create a Google Cloud service account

These steps configure Admin SDK API access using Google Cloud, even if you aren't otherwise using GCP.

Step A: Create a Google Cloud project

  1. In Google Cloud, sign in as a super administrator. Accept the terms of service if prompted.

  2. From the menu, select IAM & Admin > Manage Resources.

  3. Select Create Project and name it (for example, Mondoo Security Scan).

  4. Select Create.

Step B: Enable required APIs

  1. From the menu, select APIs & Services > Library.

  2. Enable each of these APIs:

    • Admin SDK API
    • Google Calendar API
    • Cloud Identity API
    • Groups Settings API
  1. From the menu, select APIs & Services > OAuth consent screen.

  2. For User Type, select Internal and select Create.

  3. Set App name to Mondoo Security Scanner (or your preference).

  4. Under Authorized Domains, select + ADD DOMAIN and add your Google Workspace domain.

  5. Add a User support email and Developer contact information.

  6. Select Save and Continue > Save > Continue > Back to Dashboard.

Step D: Create the service account

  1. From the menu, select APIs & Services > Credentials.

  2. Select Create Credentials > Service account.

  3. Name the account (for example, mondoo-security-scanner) and select Create, then Continue > Done > Save.

  4. At the top, select Key > Add Key > Create new key. Choose JSON and select Create. The JSON key file downloads. Save it; you need it later.

  5. Select Close, then record the OAuth 2 / Client ID from the list of service accounts. You need it for the next section.

    Google Service Account Client ID

Configure domain-wide delegation

In the Google Workspace Admin Console, grant the service account the OAuth scopes it needs.

  1. Log into the Google Workspace Admin Console.

  2. In the left navigation, select Security > Access and data control > API controls.

  3. Select Domain-wide Delegation, then Add new.

  4. For Client ID, enter the Client ID you recorded in Step D.

  5. For OAuth Scopes, paste this comma-delimited list:

    https://www.googleapis.com/auth/admin.directory.customer.readonly,https://www.googleapis.com/auth/admin.directory.device.chromeos.readonly,https://www.googleapis.com/auth/admin.directory.device.mobile.readonly,https://www.googleapis.com/auth/admin.directory.domain.readonly,https://www.googleapis.com/auth/admin.directory.group.member.readonly,https://www.googleapis.com/auth/admin.directory.group.readonly,https://www.googleapis.com/auth/admin.directory.orgunit.readonly,https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly,https://www.googleapis.com/auth/admin.directory.user.readonly,https://www.googleapis.com/auth/admin.directory.user.security,https://www.googleapis.com/auth/admin.reports.audit.readonly,https://www.googleapis.com/auth/admin.reports.usage.readonly,https://www.googleapis.com/auth/calendar.readonly,https://www.googleapis.com/auth/calendar.settings.readonly,https://www.googleapis.com/auth/calendar.acls.readonly,https://www.googleapis.com/auth/apps.groups.settings,https://www.googleapis.com/auth/cloud-identity.groups.readonly,https://www.googleapis.com/auth/cloud-identity.devices.readonly,https://www.googleapis.com/auth/cloud-identity.policies.readonly
  6. Select Authorize.

Record a super admin email and your customer ID

Mondoo authenticates by impersonating a super admin. You also need the Workspace customer ID.

  1. In the Admin Console, navigate to Account > Admin Roles > Super Admins and record an email address for one of the super admins. To learn more, see Prebuilt administrator roles in the Google Workspace documentation.

  2. Navigate to Account > Account Settings and record the Customer ID.

    Google Workspace Customer ID

Add a Google Workspace integration

You need the Editor or Owner role, or another role with this permission. To see every role, read Roles and permissions.

In the Mondoo App, navigate to the space where you want to add the integration. In the side navigation bar, select Integrations. In the top right, select INSTALL. On the Install Integration page, find the integration you want by browsing a category or searching by name:

  1. Under SaaS Security, select Google Workspace.

    The Google Workspace integration setup form in the Mondoo App

  2. In Integration Name, enter a name that identifies the Workspace account.

  3. In Customer ID, enter the customer ID you recorded above.

  4. In Impersonated User Email, enter the super admin email you recorded above.

  5. Under Service Account Credentials, select UPLOAD JSON FILE and choose the JSON key file you downloaded earlier, or paste the file's contents into the box.

  6. (Optional) Under Enable security policies (optional), enable the policies you want Mondoo to score your Google Workspace against.

  7. (Optional) Under Set Annotations (optional), select + ADD ANNOTATION to add key-value pairs that Mondoo applies to every asset this integration discovers. To learn more, read Annotate assets.

  8. Select START SCANNING.

Verify the integration

When you select START SCANNING, Mondoo starts the first scan and opens the integration's page. Status shows Active once the scan is queued, and Most Recent Activity lists each scan and any errors it reports.

The Integration Details section of an integration page, with the status Active and a SHOW ASSETS button

When the scan finishes, a Google Workspace asset appears in the space. To review it, navigate to the space and select Inventory > Assets. To learn what each integration status means, read Integration status and troubleshooting.

Troubleshoot

MessageCauseFix
Invalid JSON format for service account credentialsThe service account credentials aren't the complete JSON key file.Upload the key file again, or paste its whole contents.
Google Workspace integration created, but its first scan could not be started.The integration exists, but Mondoo couldn't queue its first scan.Don't add the integration again. Open it and select RUN.
has not been used in project in Most Recent ActivityOne of the APIs Mondoo calls isn't enabled in the Google Cloud project.Enable every API in Step B, wait a few minutes, and select RUN.
Scans are paused at the top of the integration pageGoogle rejected the service account key, for example because someone deleted it. A missing domain-wide delegation scope doesn't pause scans.Create a new key and rotate it in Mondoo.
ended in a scan error, so their results are missing in Most Recent ActivityThe domain-wide delegation entry is missing some of the OAuth scopes, or the impersonated user isn't a super admin.The message names the most common error. Compare the delegation entry with the scope list, and check the Impersonated User Email.

Manage your integration

To open the integration, navigate to the space, select Integrations > Google Workspace, and choose the integration. To change its settings, select the pencil icon.

Rotate the service account key

  1. In Google Cloud, open the service account you created in Step D and select Key > Add Key > Create new key. Choose JSON and select Create. The new JSON key file downloads.

  2. Replace the key in Mondoo. On the integration's page, select the pencil icon. Under Service account JSON (optional update), select UPLOAD NEW JSON FILE and choose the new key file, or paste its contents into the box. Then select SAVE CHANGES. Leave the box empty to keep the existing key.

  3. In Google Cloud, delete the old key from the service account.

Next steps

Last updated on

On this page