Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. GPC console access: Credentials are required to access the GCP console.

  2. Owner or Administrator permissions within the GCP console.

...

  1. Have a delegated email.

In order to retrieve the data, we need to create and authorize a Service account to authenticate the collector.

Expand
title1. Create a Project
  1. Login to Google APIs console.

  2. In the search bar, search Create a Project.

  3. Click on Create a Project.

  4. Fill in the required fields.

  5. Click on Create

Expand
title2.Enable Google Workspace Alert Center API
  1. Login to Google APIs console.

  2. In the search bar, search Workspace Alert Center API.

  3. Click on Google Workspace Alert Center API.

  4. Click on Enable to activate the API.

Expand
title3. Create credentials
  1. In the search bar, search Credentials.

  2. Click on Credentials (APIs & Services).

  3. In the Service Accounts section, click on Manage service accounts.

  4. Click on the + Create service account button.

  5. Enter a Service account name and click Done.

  6. Click on the Email field of the created service account to access its details.

  7. Copy and save the Unique ID of the created service account.

  8. Click on the Keys tab.

  9. Click on Add key button.

  10. Click on Create new key. A pop-up window will open to select the details of the key.

  11. In key type select JSON.

  12. Click on the Create button.

  13. The file with the credentials will be downloaded automatically.

  14. Rename the file credentials.json.

  15. Save the file in <any_directory>/devo-collectors/gsuite-google-workspace-alerts/credentials/

  16. Convert the content of the credentials.json to base64. Recommended method using Python version higher or equal 3.6

    1. Copy the Python script below:

      Code Block
      import base64
      
      def main():
          with open('credentials.json', 'r') as credentials:
              creds_as_bytes = credentials.read().encode('utf-8')
              base64creds = base64.b64encode(creds_as_bytes).decode("utf-8")
              print(f'Base64 encoded credentials.json: {base64creds}')
      
      if __name__ == '__main__':
          main()
    2. Save the script to <any_directory>/devo-collectors/gsuite-google-workspace-alerts/credentials/.

    3. Rename it to b64encoder.py.

    4. Run the command below in the <any_directory>/devo-collectors/gsuite-google-workspace-alerts/credentials/ directory.

      Code Block
      $ python b64encoder.py
    5. The script will output a line starting with Base64 encoded credentials.json: Copy the base64 value as this will be required for the collector configuration.

  17. Copy the content of the json file. You can use any free software to convert the content of the json file to base64.

  18. Paste it into a base64 encoder and copy the result.

Info

Save base64 value

It is important to save the base64 value to later run the collector on-premise and in the collector server.

Info

Unique ID

The Unique ID (step 7) will be used later in the domain delegation.

Note

Don’t use base64 encoders

Online base64 encoders are not recommended for security reasons.

Expand
title4. Authorize the service account through Domain Wide Delegation.

Once the service account is created and with credentials, it is necessary to authorize it through Domain Wide Delegation.

  1. Login in the google administration console: https://admin.google.com/.

  2. In the left menu select SecurityAccess and data controlAPI controls.

  3. Click Manage domain wide delegation in the Domain wide delegation section.

  4. Click on Add new. A pop-up window will open to enter the details.

    1. In Client ID field enter the previously copied Service Account Unique ID.

    2. In OAuth scopes field add the following: https://www.googleapis.com/auth/apps.alerts.

  5. Finally click on Authorize.

Info

Delegated email

You can copy the email used to login to https://accounts.google.com/ to later use it as delegated_email in the collector configuration.

Note

Delegated email

delegated_email field should contain the email of a real user (you cannot use a service account here) with enough access to display the alerts in the Google WorkSpace Admin Console → Alert Center (https://admin.google.com/ac/ac).

Expand
title5. Delegate and collaboare on email

You will need to provide a valid email address belonging to a user account. The user account must have appropriate permissions, such as alert viewing. Refer to Google documentation to know how to do it.

Action

Steps

1

Create a Project.

Info

Optional step

This step is optional, if you already have a project, you do not need to create another.

  1. Login to Google APIs console.

  2. In the search bar, search Create a Project.

  3. Click on Create a Project.

  4. Fill in the required fields.

  5. Click on Create.

2

Enable Google Workspace Alert Center API.

  1. Login to Google APIs console.

  2. In the search bar, search Workspace Alert Center API.

  3. Click on Google Workspace Alert Center API.

  4. Click on Enable to activate the API.

3

Create credentials.

  1. In the search bar, search Credentials.

  2. Click on Credentials (APIs & Services).

  3. In the Service Accounts section, click on Manage service accounts.

  4. Click on the + Create service account button.

  5. Enter a Service account name and click Done.

  6. Click on the Email field of the created service account to access its details.

  7. Copy and save the Unique ID of the created service account.

  8. Click on the Keys tab.

  9. Click on Add key button.

  10. Click on Create new key. A pop-up window will open to select the details of the key.

  11. In key type select JSON.

  12. Click on the Create button.

  13. The file with the credentials will be downloaded automatically.

  14. Rename the file credentials.json.

  15. Save the file in <any_directory>/devo-collectors/gsuite-google-workspace-alerts/credentials/

  16. Convert the content of the credentials.json to base64. Recommended method using Python version higher or equal 3.6

    1. Copy the Python script below:

      Code Block
      import base64
      
      def main():
          with open('credentials.json', 'r') as credentials:
              creds_as_bytes = credentials.read().encode('utf-8')
              base64creds = base64.b64encode(creds_as_bytes).decode("utf-8")
              print(f'Base64 encoded credentials.json: {base64creds}')
      
      if __name__ == '__main__':
          main()
    2. Save the script to <any_directory>/devo-collectors/gsuite-google-workspace-alerts/credentials/.

    3. Rename it to b64encoder.py.

    4. Run the command below in the <any_directory>/devo-collectors/gsuite-google-workspace-alerts/credentials/ directory.

      Code Block
      $ python b64encoder.py
    5. The script will output a line starting with Base64 encoded credentials.json: Copy the base64 value as this will be required for the collector configuration.

  17. Copy the content of the json file. You can use any free software to convert the content of the json file to base64.

  18. Paste it into a base64 encoder and copy the result.

Info

Save base64 value

It is important to save the base64 value to later run the collector on-premise and in the collector server.

Info

Unique ID

The Unique ID (step 7) will be used later in the domain delegation.

Note

Don’t use base64 encoders

Online base64 encoders are not recommended for security reasons.

4

Authorize the service account through Domain Wide Delegation.

Once the service account is created and with credentials, it is necessary to authorize it through Domain Wide Delegation.

  1. Login in the google administration console: https://admin.google.com/.

  2. In the left menu select SecurityAccess and data controlAPI controls.

  3. Click Manage domain wide delegation in the Domain wide delegation section.

  4. Click on Add new. A pop-up window will open to enter the details.

    1. In Client ID field enter the previously copied Service Account Unique ID.

    2. In OAuth scopes field add the following: https://www.googleapis.com/auth/apps.alerts.

  5. Finally click on Authorize.

Info

Delegated email

You can copy the email used to login to https://accounts.google.com/ to later use it as delegated_email in the collector configuration.

Note

Use a real email

delegated_email field should contain the email of a real user (you cannot use a service account here) with enough access to display the alerts in the Google WorkSpace Admin Console → Alert Center (https://admin.google.com/ac/ac).

Minimum configuration required for basic pulling

...

Here you will find a brief checklist of the important configurations that need to be done for deploying this collector:

Configuration

RequirementsDetails

GPC console

  • You have the right credentials to access the GCP console.

Perimissions

  • You have to be the owner of the account or have administrator’s permissions in the GCP console.

Delegated email

  • You need to have a delegated email with the right permissions. Refer to Google documentation to know how to do it.