Google Cloud Platform
Copy link

You can configure Google Cloud Platform to send log data SIEM (InsightIDR), where they can be used for detection and investigation purposes. Logs from Google Cloud Platform flow into Log Search in the Cloud Services and Ingress Authentication log sets.

To set up this event source:

  1. Review the Before You Begin section to note any requirements.
  2. Configure Google Cloud Platform to forward logs.
  3. Configure this event source in SIEM (InsightIDR).
  4. Verify the configuration.

Privacy Policy
Copy link

Rapid7’s SIEM (InsightIDR) product uses OAuth Authentication to retrieve log messages logs from the Google Pub/Sub HTTP API. When configuring the Google Cloud Platform event source, the only permission that SIEM (InsightIDR) requires in the authorization grant is pubsub. SIEM (InsightIDR) uses encrypted Amazon Web Service S3 Buckets to store saved data. SIEM (InsightIDR) uses your logs to track and detect on potentially malicious admin activity, as well as to make logs available in Log Search for reporting and compliance. Any data you share with Rapid7 is NOT shared externally and will only be used for internal purposes such as troubleshooting and new feature development. You can read more about Rapid7’s privacy policy here: https://www.rapid7.com/privacy-policy.

Before You Begin
Copy link

Before you continue, verify that you have the following accounts, and have performed the following actions:

  • An SIEM (InsightIDR) admin account. An SIEM (InsightIDR) admin is required to complete the configuration in SIEM (InsightIDR).
  • A Google admin account. A Google admin must sign in to the GCP to set up the Log Sink and Pub/Sub services.
  • A collector installed in your environment. In order to read Google Cloud Platform logs, the collector needs to reach the Google server to pull the logs from the Pub/Sub service, and must be able to connect to https://www.googleapis.com
  • Add the Rapid7 Connector to the Trusted Apps list. Learn more at: https://support.google.com/a/answer/9368756
  • Set the re-authentication policy to exempt Trusted Apps. Learn more at: https://support.google.com/a/answer/9368756
ℹ️

Rapid7 recommends using a private browsing window to set up this event source

This helps verify that your account has the proper access levels. If you are logged into an account that does not have Admin privileges, the OAuth popup will display, prompting you to use that logon instead. If you encounter the OAuth popup, log out of the non-admin account and log in to a Google account that has Admin privileges.

Configure Google Cloud Platform to forward logs
Copy link

Google Cloud Platform sends messages (i.e. logs) using Pub/Sub, a messaging service that is enabled via an OAuth credential. To send messages or message attributes to SIEM (InsightIDR) via Pub/Sub, you’ll need to export your data using a Log Sink and create a Pub/Sub Subscription for a Pub/Sub Topic. To read more about Pub/Subs, topics, and subscriptions, see https://cloud.google.com/pubsub/docs/overview#data_model.

Set up a Pub/Sub Subscription
Copy link

You must set up a Pub/Sub Subscription to allow the data source to send logs to SIEM (InsightIDR).

Note the following important information as you create a Pub/Sub subscription:

  • Be sure to select a Pub/Sub Topic as the destination. The filter allows you to define what logs will be sent to the destination.
  • Make note of the Project ID and the Subscription ID when setting up your subscription as you will need to enter this information in SIEM (InsightIDR) later.

For more information, see https://cloud.google.com/pubsub/docs/admin.

Set up a log sink
Copy link

Rapid7 recommends that you export your logs from Google Cloud Platform using a Log Sink, which allows your logs to be filtered and routed to a Pub/Sub Topic. For instructions, see https://cloud.google.com/logging/docs/export/configure_export_v2.

As you prepare your logs for export, you should think about the type of data you want to closely monitor, such as audit logs or activity along the Firewall. We recommend against forwarding “noisy” data, such as logs generated by a service account or internal network traffic. These logs can result in large volumes of data, which may impact your storage rates.

(Optional) Use our pre-built queries
Copy link

When setting up a log sink, you can use our pre-built Log Sink queries to filter out noisy logs so that you get the data that is most valuable to you.

Send all audit logs except those generated by Kubernetes
Copy link

logName:"cloudaudit.googleapis.com" NOT protoPayload.serviceName:"k8s.io"

Send Firewall or Threat Detection logs
Copy link

If you have firewall or threat detection logging enabled in Google Cloud Platform, you can forward that data to SIEM (InsightIDR) for investigation and detection purposes. Firewall messages generate Firewall detections in SIEM (InsightIDR), and threat detection logs generate Third Party Alerts.

To send firewall or threat detection logs to SIEM (InsightIDR), add the following to the previous query:

OR log_id("compute.googleapis.com/firewall")

OR log_id("threatdetection.googleapis.com/detection")

Configure SIEM (InsightIDR) to collect data from the event source
Copy link

After you complete the prerequisite steps and configure the event source to send data, you must add the event source in SIEM (InsightIDR).

To configure the new event source in SIEM (InsightIDR):

  1. From the left menu, go to Data Collection and click Setup Event Source > Add Event Source.
  2. Do one of the following:
    • Search for Google Cloud Platform in the event sources search bar.
    • In the Product Type filter, select Cloud Service.
  3. Select the Google Cloud Platform event source tile.
  4. Select your collector and Google Cloud Platform from the event source dropdown.
  5. Name your event source.
  6. Optionally choose to send unparsed logs.
  7. Select your Account Attribution preference:
    • Use short name attribution: The system first attempts to attribute data by email address, for example, jsmith@myorg.example.com. If the first attempt is unsuccessful, attribution is attempted by short name, for example, jsmith. If the short name is unsuccessful, attribution is attempted by a user’s first and last name, for example, John Smith.
    • Use fully qualified domain name attribution: The system first attempts to attribute data by email address, for example, jsmith@myorg.example.com. If the first attempt is unsuccessful, attribution is attempted by a user’s first and last name, for example, John Smith. This option is best if your environment has collisions with short names.
  8. Enter the IDs for the Google Cloud Project.
  9. Enter the ID for the Pub/Sub Subscription where the logs have been routed.
  10. Click Begin to set up OAUTH and start the authorization process. A new window or tab will open for you to perform an authorization grant with Google. The grant must be performed by a GCP admin user.
  11. Click Allow to permit SIEM (InsightIDR) to view and manage Pub/Sub topics and subscriptions. Close the window/tab to return to SIEM (InsightIDR).
  12. Click Allow to permit SIEM (InsightIDR) to view and manage Pub/Sub topics and subscriptions. Close the window/tab to return to SIEM (InsightIDR).
  13. If you are using a multi-domain environment, configure a default domain. We will apply the default domain you configure to any logs that do not provide a domain for an account that appears in the logs.
  14. Click Save.

Verify the configuration
Copy link

  1. From the left menu, click Log Search to view your raw logs to ensure events are making it to the Collector. Select the applicable Log Sets and the Log Names within them. The Log Name will be the event source name or “Google Platform Cloud” if you did not name the event source. Google Platform Cloud logs flow into the log set:

    • Cloud Services
    • Ingress Authentication
  2. Perform a Log Search to make sure events are coming through.

Sample Log
Copy link

The following log reflects the activation of a Google Cloud Platform service by a user.

{ "insertId": "12utqhgc2li", "logName": "projects/testproject/logs/cloudaudit.googleapis.com%2Factivity", "operation": { "first": true, "id": "operations/acf.73b6492a-d2a6-4311-973d-c0de964f0570", "producer": "servicemanagement.googleapis.com" }, "protoPayload": { "@type": "type.googleapis.com/google.cloud.audit.AuditLog", "authenticationInfo": { "principalEmail": "username@email.com" }, "authorizationInfo": [ { "granted": true, "permission": "serviceusage.services.enable", "resource": "projectnumbers/123456789012/services/-", "resourceAttributes": {} }, { "permission": "serviceconsumermanagement.consumers.enable", "resource": "services/compute.googleapis.com/consumers/123456789012", "resourceAttributes": {} }, { "granted": true, "permission": "servicemanagement.services.bind", "resource": "services/compute.googleapis.com", "resourceAttributes": {} }, { "granted": true, "permission": "serviceusage.services.enable", "resource": "projectnumbers/123456789012/services/-", "resourceAttributes": {} }, { "permission": "servicemanagement.services.bindAll", "resource": "services/compute.googleapis.com", "resourceAttributes": {} }, { "permission": "serviceconsumermanagement.consumers.enable", "resource": "services/compute.googleapis.com/consumers/123456789012", "resourceAttributes": {} } ], "methodName": "google.api.servicemanagement.v1.ServiceManager.ActivateServices", "requestMetadata": { "callerIp": "100.10.200.20", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36,gzip(gfe)", "destinationAttributes": {}, "requestAttributes": { "auth": {}, "time": "2020-09-03T14:56:50.773372Z" } }, "resourceName": "projects/123456789012/services/[compute.googleapis.com]", "serviceName": "servicemanagement.googleapis.com" }, "receiveTimestamp": "2020-09-03T14:56:50.982038857Z", "resource": { "labels": { "method": "google.api.servicemanagement.v1.ServiceManager.ActivateServices", "project_id": "testproject", "service": "servicemanagement.googleapis.com" }, "type": "audited_resource" }, "severity": "NOTICE", "timestamp": "2020-09-03T14:56:49.891207Z" }

Additional OAuth 2.0 Use Cases
Copy link

Google APIs use the OAuth 2.0 protocol for authentication and authorization. Google supports common OAuth 2.0 scenarios such as those for web server, installed, and client-side applications. For more information, read this article: https://developers.google.com/identity/protocols/OAuth2.