Google Workspace
Rapid7 SIEM (InsightIDR) collects Google Workspace data through a cloud connection. After you connect your Google Workspace domain, SIEM (InsightIDR) collects these data types: Users, Groups, Group Members, Email Logs, Activity Logs, and Alerts.
To set up the Google Workspace event source:
- Review Before you begin and complete any prerequisite steps.
- Configure Google Workspace to send data to SIEM (InsightIDR).
- Configure SIEM (InsightIDR) to collect data from the event source.
You can also:
Before you begin
You must have administrator-level privileges for your Google Workspace domain. The Admin Email that you provide in SIEM (InsightIDR) must belong to a user with super admin rights.
Configure Google Workspace to send data to SIEM (InsightIDR)
Complete these tasks to establish communication between SIEM (InsightIDR) and Google Workspace.
Task 1: Create a service account and key
A service account allows SIEM (InsightIDR) to sign in to Google Workspace and read your data. If you already have a service account and key for this event source, skip to Authorize API scopes for the service account.
- From the Google Cloud console, create a project , or select an existing project.
- Enable the Admin SDK API and the Alert Center API for the project.
- Create a service account . Enter a name and description for the account. Google generates the service account ID.
- When Google prompts you to grant the service account access to the project, from the Role dropdown, select Project > Owner.
- Create a key for the service account, and select JSON as the key type.
Google saves the JSON key file to your browser’s default download location.
Task 2: Authorize API scopes for the service account
Domain-wide delegation allows the service account to access Google Workspace data on behalf of users in your domain. Authorize the scopes that SIEM (InsightIDR) needs to collect each data type.
-
From the Google Workspace Admin console , select Security > Access and data control > API controls. If Security isn’t visible, select More controls first.
-
Select Manage Domain Wide Delegation.
-
Select Edit for your existing Client ID, or add a new entry that uses the
client_idvalue from the JSON key file. -
Add these API scopes, separated by commas:
https://www.googleapis.com/auth/admin.directory.user.readonly, https://www.googleapis.com/auth/admin.directory.group.readonly, https://www.googleapis.com/auth/admin.directory.group.member.readonly, https://www.googleapis.com/auth/admin.reports.audit.readonly, https://www.googleapis.com/auth/apps.alerts -
Save your changes.
Delegation changes usually apply within a few minutes. Google states that changes can take up to 24 hours.
Task 3: Collect the connection details
Collect these values before you configure the connection in SIEM (InsightIDR):
- Client ID - The numeric Unique ID on the service account’s details page. This value is also the
client_idfield in the JSON key file. Use the same Client ID that you authorized for domain-wide delegation. - Client Email - The service account email address, for example
name@project-id.iam.gserviceaccount.com. This value is theclient_emailfield in the JSON key file. - Admin Email - The email address of an active Google Workspace user with super admin rights.
- Customer ID - Your Google customer ID. To find it, in the Google Workspace Admin console, go to Account > Account settings > Profile. The ID uses the format
C0xxxxxxx. - Private Key - The
private_keyvalue from the JSON key file, or from a key you previously generated for the service account.
Configure SIEM (InsightIDR) to collect data from the event source
After you authorize the API scopes, add the event source in SIEM (InsightIDR).
- From Command Home, go to Data Connectors > Data Collectors.
- Go to the Event Sources tab, then select Add Event Source.
- Do one of the following:
- Search for Google Workspace in the event sources search bar.
- In the Product Type filter, select Cloud Service.
- Select the Google Workspace event source tile.
- Select an existing connection, or select Add a New Connection.
- Enter the values that you collected in Collect the connection details.
- Select Save & Test Connection.
- View the connection status.
If the connection test returns an error, see Troubleshoot connection test errors.
How the connection test works
The connection test runs these checks in order and stops at the first check that fails:
- Validates that Admin Email and Client Email are email addresses.
- Validates that Private Key is a service account key.
- Signs in as Admin Email, using the service account, for each required scope.
- Confirms that Client ID belongs to the service account in Client Email.
- Confirms that Customer ID exists and that Admin Email can read it.
If the test passes, SIEM (InsightIDR) lists each data type with a status of true or false:
Users: true
Groups: true
Group Members: true
Email Logs: false
Activity Logs: false
Alerts: trueSIEM (InsightIDR) collects a data type only after you authorize its scope. To resolve data types that show false, see Data types show false after a passed test.
Troubleshoot connection test errors
Email address is not valid
The test returns Admin Email is not a valid email address. or Client Email is not a valid email address. The value is empty or doesn’t use the form user@example.com.
To resolve this error, check these values:
- Client Email - Enter the service account email address, for example
name@project-id.iam.gserviceaccount.com. This value is theclient_emailfield in the JSON key file. - Admin Email - Enter the email address of a Google Workspace user with super admin rights. Use a user account, not the service account.
The provided private key is not a valid service account key
SIEM (InsightIDR) couldn’t read the Private Key. Copy the full private_key value from the service account’s JSON key file, including the -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY----- lines. Paste the value exactly as it appears in the file, without edits, trimming, or re-wrapping.
Unable to authenticate against Google Workspace
Google rejected the sign-in.
To resolve this error, check these items:
- The Client Email matches the service account that issued the Private Key.
- The key is active. To check, go to the Google Cloud console and select IAM & Admin > Service Accounts > Keys. If the key was deleted or disabled, create a new key, enter the new key in the connection, and run the test again.
- The Admin Email belongs to an active user in your domain. Suspended users can’t authenticate.
None of the required scopes are granted to the service account
Domain-wide delegation isn’t set up for the service account. Complete the steps in Authorize API scopes for the service account, using the Client ID of the service account. Wait for the changes to apply, and then run the test again.
The Client ID does not match the service account
The Client ID belongs to a different service account than the Client Email. Enter the numeric Unique ID from the service account’s details page. This value is also the client_id field in the JSON key file. Use the service account’s Unique ID, not the OAuth client ID of another project or app.
Unable to verify the Client ID
The test couldn’t reach Google to check the Client ID. This error is usually a temporary network or Google issue. Run the test again. If the error persists, contact Rapid7 Support.
The Customer ID is invalid or not accessible
The test couldn’t list users for the Customer ID.
To resolve this error, check these items:
- The Customer ID is correct. To find it, in the Google Workspace Admin console, go to Account > Account settings > Profile. The ID uses the format
C0xxxxxxx. - The Admin Email belongs to an admin of the same Google Workspace account.
- The Admin SDK API is enabled in the Google Cloud project that owns the service account. To check, in the Google Cloud console, go to APIs & Services > Library > Admin SDK API.
Data types show false after a passed test
The connection works, but the domain-wide delegation entry doesn’t include the scope for the data types that show false.
Each data type requires one of these scopes:
| Data type | Required scope |
|---|---|
| Users | https://www.googleapis.com/auth/admin.directory.user.readonly |
| Groups | https://www.googleapis.com/auth/admin.directory.group.readonly |
| Group Members | https://www.googleapis.com/auth/admin.directory.group.member.readonly |
| Email Logs, Activity Logs | https://www.googleapis.com/auth/admin.reports.audit.readonly |
| Alerts | https://www.googleapis.com/auth/apps.alerts |
To add a missing scope:
- From the Google Workspace Admin console, select Security > Access and data control > API controls > Manage Domain Wide Delegation.
- Select Edit for the Client ID entry.
- Add the scope for each data type that shows
false. - Save the entry.
- Wait for the changes to apply, and then run the connection test again.