Skip to main content

This Package helps to improve GCP project security and reduce billing from unused resources by performing some checks

This script is worked for individual GCP project not on organization or folder level


package installation

pip3 install gcpsecurity

Ensure google cloud platform API is enable for particular service on which you want to perform check

example,

Enable api for data proc
Enable api for app engine ...etc

How to use ??

step 1: Import classes to perform checks

    from gcpsecurity.gcp_data_proc import ExecuteCheckDp
    from gcpsecurity.gcp_gke import ExecuteCheckGke

step 2: Create GCP service account with project viewer permission
step 3: Initlize ExecuteCheck class with service account file path and project id

    dp = ExecuteCheckDp(servive_account_file_path=SERVICE_ACCOUNT_FILE_PATH, project_id=PROJECT_ID)
    gke = ExecuteCheckGke(servive_account_file_path=SERVICE_ACCOUNT_FILE_PATH, project_id=PROJECT_ID)


step 4: Call perform_check() method of ExecuteCheck classes object

        dp_result = dp.perform_check()
        gke_result = gke.perform_check()

step 5: Print results

        print(dp_result)
        print(gke_result)

Available services checks classes:

    compute engine checks ==> from gcpsecurity.gcp_vm import ExecuteCheckVm
    IAM checks            ==> from gcpsecurity.gcp_iam import ExecuteCheckIam
    VPC checks            ==> from gcpsecurity.gcp_vpc import ExecuteCheckVpc
    cloud storage         ==> from gcpsecurity.gcp_gcs import ExecuteCheckGcs
    cloud sql             ==> from gcpsecurity.gcp_cloud_sql import ExecuteCheckSql
    app engine            ==> from gcpsecurity.gcp_app_engine import ExecuteCheckGae
    data proc             ==> from gcpsecurity.gcp_data_proc import ExecuteCheckDp
    kubernetes engine     ==> gcpsecurity.gcp_gke import ExecuteCheckGke

Example script

    https://github.com/Aadeshkale/gcp-security/blob/master/main.py 

** Notes :-

  1. Script might take time to execute because it is make googleapis calls.

  2. Service account file should have appropriate permissions to perform checks That is Project Viewer (You can set permissions as per service also)

  3. To add other checks as per your use go to package gcpsecurity add checks in existing services scripts or add new scripts for new services reference :- https://github.com/Aadeshkale/gcp-security/tree/master/gcpsecurity

Release files for gcpsecurity 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gcpsecurity 0.0.6
File Size Uploaded
gcpsecurity-0.0.6.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gcpsecurity 0.0.6
File Interpreter ABI Platform
gcpsecurity-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 32.7 kB

Release files / gcpsecurity-0.0.6.tar.gz

Download URL gcpsecurity-0.0.6.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a6ed5342aa68f76a78bc1500d113868d58d13d449acb77d488989717117411b3
BLAKE2b-256 checksum
How to use checksums
0bbdb23a5fa85ab9bef4be0b23b871eb1376b66608a7cffbf72a21f86d7511ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Release files / gcpsecurity-0.0.6-py3-none-any.whl

Download URL gcpsecurity-0.0.6-py3-none-any.whl
Size 20.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a944ca13dd259b79bfeecd9d9ca2b2ae861e8e6aa3ce18c5f62521a97f0a5fad
BLAKE2b-256 checksum
How to use checksums
e1d8933ec2333cbed0a68065b4c86126a4fea72bcf17e6b9d7a99b77abc7d8cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page