Git Product home page Git Product logo

gcp_cloud_assets's Introduction

Cloud Assets

This repository will focus on providing visibility of Cloud Resources and IAM, Org, Access policies at the GCP organization level. The imperative scripts will provide examples of commands to use during an incident or an analysis view in Bigquery. The declaritive Terraform templates will create real time pub/sub feeds at the GCP organization level for CONTENT_TYPE_UNSPECIFIED, RESOURCE, IAM_POLICY, ORG_POLICY, and ACCESS_POLICY events. Enjoy being able to say I know whats going on in my GCP organization!

Software Requirements

Gcloud SDK

Download the latest gcloud SDK https://cloud.google.com/sdk/docs/

Terraform software

Imperative IAM Permissions

Cloud Asset permission

BigQuery permission

  • Bigquery write permission for export or storage is delegated to Cloud Asset service account: [email protected]"

Imperative scripts

Organization level search for assets

$ search_assets.sh --dns-domain

Organization level search for iam.serviceAccounts.actAs permission

$ search_permission.sh --dns-domain

Export assets (resources,iam policy, org policy, access policy) to Big Query for analysis

Create Bigquery dataset names assets in CLI or console

$ bq --location=US mk -d --description "$(gcloud config list --format 'value(core.account)') created assets dataset" $(gcloud config list --format 'value(core.project)'):assets

Load assets into Big Query table

$ load_assets_bq.sh --dns-domain

Entitlement report for users and service accounts

$ entitlement_report.sh --dns-domain

Create real time asset feeds

$ create_asset_feeds.sh --dns-domain

Delete real time asset feeds

$ delete_asset_feeds.sh --dns-domain

Terraform deployment

  • Create a Google Storage bucket to store Terraform state
  • gsutil mb gs://<your state bucket>
  • Copy terraform.tfvars.template to terraform.tfvars
  • cp terraform.tfvars.template terraform.tfvars
  • Update required variables in terraform.tfvars for Splunk Software, GCS Bucket, and DNS configuration
  • terraform init to get the plugins
  • Enter Google Storage bucket that will store the Terraform state
  • terraform plan to see the infrastructure plan
  • terraform apply to apply the infrastructure build
  • terraform destroy to destroy the built infrastructure

Variables

Please refer the variables.tf file for the required and optional variables.

File structure

  • /main.tf: main file for this module, contains all the resources to create
  • /variables.tf: all the variables for the module
  • /versions.tf: Terraform version and forcing to Terraform state to Google Storage
  • /readme.MD: this file

Cloud Assets documents

SQL Examples https://cloud.google.com/asset-inventory/docs/exporting-to-bigquery#querying_an_asset_snapshot

SQL Examples

Public IP available for deployments

SELECT *
FROM `<Path to your BQ Table>`
JOIN UNNEST(org_policy) AS op
WHERE
  op.constraint = "constraints/compute.vmExternalIpAccess"
  AND (op.boolean_policy IS NULL OR op.boolean_policy.enforced = FALSE);

gcp_cloud_assets's People

Contributors

jasonbisson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.