diff --git a/contrib/cloud9/cloud9-installation.sh b/contrib/aws/cloud9/cloud9-installation.sh similarity index 97% rename from contrib/cloud9/cloud9-installation.sh rename to contrib/aws/cloud9/cloud9-installation.sh index 165acbdde9b..116ec984349 100644 --- a/contrib/cloud9/cloud9-installation.sh +++ b/contrib/aws/cloud9/cloud9-installation.sh @@ -14,4 +14,4 @@ cd ~ || exit python3.9 -m pip install prowler-cloud prowler -v # Run Prowler -prowler +prowler aws diff --git a/contrib/cloudshell/cloudshell-installation.sh b/contrib/aws/cloudshell/cloudshell-installation.sh similarity index 100% rename from contrib/cloudshell/cloudshell-installation.sh rename to contrib/aws/cloudshell/cloudshell-installation.sh diff --git a/contrib/codebuild/codebuild-prowlerv2-audit-account-cfn.yaml b/contrib/aws/codebuild/codebuild-prowlerv2-audit-account-cfn.yaml similarity index 100% rename from contrib/codebuild/codebuild-prowlerv2-audit-account-cfn.yaml rename to contrib/aws/codebuild/codebuild-prowlerv2-audit-account-cfn.yaml diff --git a/contrib/codebuild/codebuild-prowlerv3-audit-account-cfn.yaml b/contrib/aws/codebuild/codebuild-prowlerv3-audit-account-cfn.yaml similarity index 100% rename from contrib/codebuild/codebuild-prowlerv3-audit-account-cfn.yaml rename to contrib/aws/codebuild/codebuild-prowlerv3-audit-account-cfn.yaml diff --git a/contrib/multi-account-securityhub/.awsvariables b/contrib/aws/multi-account-securityhub/.awsvariables similarity index 100% rename from contrib/multi-account-securityhub/.awsvariables rename to contrib/aws/multi-account-securityhub/.awsvariables diff --git a/contrib/multi-account-securityhub/Dockerfile b/contrib/aws/multi-account-securityhub/Dockerfile similarity index 100% rename from contrib/multi-account-securityhub/Dockerfile rename to contrib/aws/multi-account-securityhub/Dockerfile diff --git a/contrib/multi-account-securityhub/README.md b/contrib/aws/multi-account-securityhub/README.md similarity index 100% rename from contrib/multi-account-securityhub/README.md rename to contrib/aws/multi-account-securityhub/README.md diff --git a/contrib/multi-account-securityhub/run-prowler-securityhub.sh b/contrib/aws/multi-account-securityhub/run-prowler-securityhub.sh similarity index 100% rename from contrib/multi-account-securityhub/run-prowler-securityhub.sh rename to contrib/aws/multi-account-securityhub/run-prowler-securityhub.sh diff --git a/contrib/multi-account-securityhub/templates/CF-Prowler-CrossAccountRole.yml b/contrib/aws/multi-account-securityhub/templates/CF-Prowler-CrossAccountRole.yml similarity index 100% rename from contrib/multi-account-securityhub/templates/CF-Prowler-CrossAccountRole.yml rename to contrib/aws/multi-account-securityhub/templates/CF-Prowler-CrossAccountRole.yml diff --git a/contrib/multi-account-securityhub/templates/CF-Prowler-ECS.yml b/contrib/aws/multi-account-securityhub/templates/CF-Prowler-ECS.yml similarity index 100% rename from contrib/multi-account-securityhub/templates/CF-Prowler-ECS.yml rename to contrib/aws/multi-account-securityhub/templates/CF-Prowler-ECS.yml diff --git a/contrib/multi-account-securityhub/templates/CF-Prowler-IAM.yml b/contrib/aws/multi-account-securityhub/templates/CF-Prowler-IAM.yml similarity index 100% rename from contrib/multi-account-securityhub/templates/CF-Prowler-IAM.yml rename to contrib/aws/multi-account-securityhub/templates/CF-Prowler-IAM.yml diff --git a/contrib/org-multi-account/ProwlerEC2.yaml b/contrib/aws/org-multi-account/ProwlerEC2.yaml similarity index 100% rename from contrib/org-multi-account/ProwlerEC2.yaml rename to contrib/aws/org-multi-account/ProwlerEC2.yaml diff --git a/contrib/org-multi-account/ProwlerRole.yaml b/contrib/aws/org-multi-account/ProwlerRole.yaml similarity index 100% rename from contrib/org-multi-account/ProwlerRole.yaml rename to contrib/aws/org-multi-account/ProwlerRole.yaml diff --git a/contrib/org-multi-account/ProwlerS3.yaml b/contrib/aws/org-multi-account/ProwlerS3.yaml similarity index 100% rename from contrib/org-multi-account/ProwlerS3.yaml rename to contrib/aws/org-multi-account/ProwlerS3.yaml diff --git a/contrib/org-multi-account/README.md b/contrib/aws/org-multi-account/README.md similarity index 100% rename from contrib/org-multi-account/README.md rename to contrib/aws/org-multi-account/README.md diff --git a/contrib/org-multi-account/serverless_codebuild/README.md b/contrib/aws/org-multi-account/serverless_codebuild/README.md similarity index 100% rename from contrib/org-multi-account/serverless_codebuild/README.md rename to contrib/aws/org-multi-account/serverless_codebuild/README.md diff --git a/contrib/org-multi-account/serverless_codebuild/README_kr.md b/contrib/aws/org-multi-account/serverless_codebuild/README_kr.md similarity index 100% rename from contrib/org-multi-account/serverless_codebuild/README_kr.md rename to contrib/aws/org-multi-account/serverless_codebuild/README_kr.md diff --git a/contrib/org-multi-account/serverless_codebuild/docs/images/prowler_org_architecture.png b/contrib/aws/org-multi-account/serverless_codebuild/docs/images/prowler_org_architecture.png similarity index 100% rename from contrib/org-multi-account/serverless_codebuild/docs/images/prowler_org_architecture.png rename to contrib/aws/org-multi-account/serverless_codebuild/docs/images/prowler_org_architecture.png diff --git a/contrib/org-multi-account/serverless_codebuild/docs/images/s3_screenshot.png b/contrib/aws/org-multi-account/serverless_codebuild/docs/images/s3_screenshot.png similarity index 100% rename from contrib/org-multi-account/serverless_codebuild/docs/images/s3_screenshot.png rename to contrib/aws/org-multi-account/serverless_codebuild/docs/images/s3_screenshot.png diff --git a/contrib/org-multi-account/serverless_codebuild/src/run-prowler-reports.sh b/contrib/aws/org-multi-account/serverless_codebuild/src/run-prowler-reports.sh similarity index 100% rename from contrib/org-multi-account/serverless_codebuild/src/run-prowler-reports.sh rename to contrib/aws/org-multi-account/serverless_codebuild/src/run-prowler-reports.sh diff --git a/contrib/org-multi-account/serverless_codebuild/src/run-prowler-reports.sh.zip b/contrib/aws/org-multi-account/serverless_codebuild/src/run-prowler-reports.sh.zip similarity index 100% rename from contrib/org-multi-account/serverless_codebuild/src/run-prowler-reports.sh.zip rename to contrib/aws/org-multi-account/serverless_codebuild/src/run-prowler-reports.sh.zip diff --git a/contrib/org-multi-account/serverless_codebuild/templates/ProwlerCodeBuildStack.yaml b/contrib/aws/org-multi-account/serverless_codebuild/templates/ProwlerCodeBuildStack.yaml similarity index 100% rename from contrib/org-multi-account/serverless_codebuild/templates/ProwlerCodeBuildStack.yaml rename to contrib/aws/org-multi-account/serverless_codebuild/templates/ProwlerCodeBuildStack.yaml diff --git a/contrib/org-multi-account/serverless_codebuild/templates/ProwlerRole.yaml b/contrib/aws/org-multi-account/serverless_codebuild/templates/ProwlerRole.yaml similarity index 100% rename from contrib/org-multi-account/serverless_codebuild/templates/ProwlerRole.yaml rename to contrib/aws/org-multi-account/serverless_codebuild/templates/ProwlerRole.yaml diff --git a/contrib/org-multi-account/serverless_codebuild/templates/ProwlerS3.yaml b/contrib/aws/org-multi-account/serverless_codebuild/templates/ProwlerS3.yaml similarity index 100% rename from contrib/org-multi-account/serverless_codebuild/templates/ProwlerS3.yaml rename to contrib/aws/org-multi-account/serverless_codebuild/templates/ProwlerS3.yaml diff --git a/contrib/org-multi-account/src/run-prowler-reports.sh b/contrib/aws/org-multi-account/src/run-prowler-reports.sh similarity index 100% rename from contrib/org-multi-account/src/run-prowler-reports.sh rename to contrib/aws/org-multi-account/src/run-prowler-reports.sh diff --git a/contrib/gcp/enable_apis_in_projects.sh b/contrib/gcp/enable_apis_in_projects.sh new file mode 100755 index 00000000000..37054416af5 --- /dev/null +++ b/contrib/gcp/enable_apis_in_projects.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# List of project IDs +PROJECT_IDS=( + "project-id-1" + "project-id-2" + "project-id-3" + # Add more project IDs as needed +) + +# List of Prowler APIs to enable +APIS=( + "apikeys.googleapis.com" + "artifactregistry.googleapis.com" + "bigquery.googleapis.com" + "sqladmin.googleapis.com" # Cloud SQL + "storage.googleapis.com" # Cloud Storage + "compute.googleapis.com" + "dataproc.googleapis.com" + "dns.googleapis.com" + "containerregistry.googleapis.com" # GCR (Google Container Registry) + "container.googleapis.com" # GKE (Google Kubernetes Engine) + "iam.googleapis.com" + "cloudkms.googleapis.com" # KMS (Key Management Service) + "logging.googleapis.com" +) + +# Function to enable APIs for a given project +enable_apis_for_project() { + local PROJECT_ID=$1 + + echo "Enabling APIs for project: ${PROJECT_ID}" + + for API in "${APIS[@]}"; do + echo "Enabling API: $API for project: ${PROJECT_ID}" + if gcloud services enable "${API}" --project="${PROJECT_ID}"; then + echo "Successfully enabled API $API for project ${PROJECT_ID}." + else + echo "Failed to enable API $API for project ${PROJECT_ID}." + fi + done +} + +# Loop over each project and enable the APIs +for PROJECT_ID in "${PROJECT_IDS[@]}"; do + enable_apis_for_project "${PROJECT_ID}" +done diff --git a/docs/tutorials/gcp/authentication.md b/docs/tutorials/gcp/authentication.md index 5796dc6baef..e9587fa1e2c 100644 --- a/docs/tutorials/gcp/authentication.md +++ b/docs/tutorials/gcp/authentication.md @@ -24,3 +24,23 @@ Prowler will follow the same credentials search as [Google authentication librar 3. [The attached service account, returned by the metadata server](https://cloud.google.com/docs/authentication/application-default-credentials#attached-sa) Those credentials must be associated to a user or service account with proper permissions to do all checks. To make sure, add the `Viewer` role to the member associated with the credentials. + +# GCP Service APIs + +Prowler will use the Google Cloud APIs to get the information needed to perform the checks. Make sure that the following APIs are enabled in the project: + +- apikeys.googleapis.com +- artifactregistry.googleapis.com +- bigquery.googleapis.com +- sqladmin.googleapis.com +- storage.googleapis.com +- compute.googleapis.com +- dataproc.googleapis.com +- dns.googleapis.com +- containerregistry.googleapis.com +- container.googleapis.com +- iam.googleapis.com +- cloudkms.googleapis.com +- logging.googleapis.com + +You can enable them automatically using our script [enable_apis_in_projects.sh](https://github.com/prowler-cloud/prowler/blob/master/contrib/gcp/enable_apis_in_projects.sh)