Skip to content

Commit d4de53e

Browse files
authored
Merge pull request #314 from jonrau1/gcp_improvements_2025
GCP Improvements Quicky
2 parents 485a696 + 7e15c79 commit d4de53e

13 files changed

+726
-113
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ eeauditor/processor/outputs/*.html
1212
LOCAL_external_providers.toml
1313
output.json
1414
output_ocsf_v1-4-0_events.json
15+
gcp_cred.json

Dockerfile

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
#specific language governing permissions and limitations
1919
#under the License.
2020

21-
# latest hash as of 27 AUG 2024 - Alpine 3.20.2
22-
# https://hub.docker.com/layers/library/alpine/3.20.2/images/sha256-eddacbc7e24bf8799a4ed3cdcfa50d4b88a323695ad80f317b6629883b2c2a78?context=explore
21+
# latest hash as of 13 FEB 2025 - Alpine 3.21.3
22+
# https://hub.docker.com/layers/library/alpine/3.20.2/images/sha256-a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c?context=explore
2323
# use as builder image to pull in required deps
24-
FROM alpine@sha256:56fa17d2a7e7f168a043a2712e63aed1f8543aeafdcee47c58dcffe38ed51099 AS builder
24+
FROM alpine@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c AS builder
2525

2626
ENV PYTHONUNBUFFERED=1
2727

@@ -40,9 +40,9 @@ RUN \
4040
rm -rf /tmp/* && \
4141
rm -f /var/cache/apk/*
4242

43-
# latest hash as of 27 AUG 2024 - Alpine 3.20.2
44-
# https://hub.docker.com/layers/library/alpine/3.20.2/images/sha256-eddacbc7e24bf8799a4ed3cdcfa50d4b88a323695ad80f317b6629883b2c2a78?context=explore
45-
FROM alpine@sha256:56fa17d2a7e7f168a043a2712e63aed1f8543aeafdcee47c58dcffe38ed51099 as electriceye
43+
# latest hash as of 13 FEB 2025 - Alpine 3.21.3
44+
# https://hub.docker.com/layers/library/alpine/3.20.2/images/sha256-a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c?context=explore
45+
FROM alpine@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c as electriceye
4646

4747
COPY --from=builder /usr /usr
4848

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ In total there are:
153153

154154
- **4** Supported Public CSPs: `AWS`, `GCP`, `OCI`, and `Azure`
155155
- **4** Supported SaaS Providers: `ServiceNow`, `M365`, `Salesforce`, and `Snowflake`
156-
- **1193** ElectricEye Checks
157-
- **177** Supported CSP & SaaS Asset Components across all Services
158-
- **133** ElectricEye Auditors
156+
- **1196** ElectricEye Checks
157+
- **179** Supported CSP & SaaS Asset Components across all Services
158+
- **135** ElectricEye Auditors
159159

160160
The tables of supported Services and Checks have been migrated to the respective per-Provider setup documentation linked above in [Configuring ElectricEye](#configuring-electriceye).
161161

@@ -389,6 +389,8 @@ The controls frameworks that ElectricEye supports is always being updated as new
389389
- CIS Amazon Web Services Foundations Benchmark V2.0
390390
- CIS Amazon Web Services Foundations Benchmark V3.0
391391
- CIS Microsoft Azure Foundations Benchmark V2.0.0
392+
- CIS Snowflake Foundations Benchmark V1.0.0
393+
- CIS Google Cloud Platform Foundation Benchmark V2.0
392394

393395
## Repository Security
394396

docs/setup/Setup_GCP.md

+15-9
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ To configure the TOML file, you need to modify the values of the variables in th
2222

2323
- `gcp_project_ids`: Set this variable to specify a list of GCP Project IDs, ensure you only specify the GCP Projects which the Service Account specified in `gcp_service_account_json_payload_value` has access to.
2424

25-
- `gcp_service_account_json_payload_value`: This variable is used to specify the contents of the Google Cloud Platform (GCP) service account key JSON file that ElectricEye should use to authenticate to GCP. The contents of the JSON file should be provided as a string, and the entire string should be assigned to the `gcp_service_account_json_payload_value` setting.
25+
- `gcp_service_account_json_payload_value`: This variable is used to specify the contents of the Google Cloud Platform (GCP) service account key JSON file that ElectricEye should use to authenticate to GCP. If `credentials_location` is set to `CONFIG_FILE` you should paste the entire contents of the Service Account JSON within triple single-quotes (`'''`) otherwise the newline characters (`\n`) will cause an issue within the TOML.
2626

2727
It's important to note that this setting is a sensitive credential, and as such, its value should be stored in a secure manner that matches the location specified in the `[global]` section's `credentials_location` setting. For example, if `credentials_location` is set to `"AWS_SSM"`, then the gcp_service_account_json_payload_value should be the name of an AWS Systems Manager Parameter Store SecureString parameter that contains the contents of the GCP service account key JSON file.
2828

@@ -32,16 +32,19 @@ Refer [here](#gcp-multi-project-service-account-support) for information on addi
3232

3333
1. Enable the following APIs for all GCP Projects you wish to assess with ElectricEye.
3434

35-
> - Compute Engine API
36-
> - Cloud SQL Admin API
37-
> - Cloud Logging API
38-
> - OS Config API
39-
> - Service Networking API
35+
- Compute Engine API
36+
- Cloud SQL Admin API
37+
- Cloud Logging API
38+
- OS Config API
39+
- Service Networking API
40+
- BigQuery API
4041

4142
2. Create a **Service Account** with the following permissions per Project you want to assess with ElectricEye (**Note**: In the future, Organizations will be supported for GCP, you can instead create a single **Service Account** and add it's Email into all of your other Projects)
4243

43-
> - Security Reviewer
44-
> - Project Viewer
44+
- Security Reviewer
45+
- Viewer
46+
- BigQuery Data Viewer
47+
- BigQuery Metadata Viewer
4548

4649
#### NOTE: For evaluating multiple GCP Projects, you only need ONE Service Account, refer to [GCP Multi-Project Service Account Support](#gcp-multi-project-service-account-support) for more information on adding permissions to other Projects.
4750

@@ -150,10 +153,13 @@ done
150153
151154
## GCP Checks & Services
152155
153-
These are the following services and checks perform by each Auditor, there are currently **53 Checks** across **3 Auditors** that support the secure configuration of **2 services/components**
156+
These are the following services and checks perform by each Auditor, there are currently **56 Checks** across **5 Auditors** that support the secure configuration of **4 services/components**
154157
155158
| Auditor File Name | Scanned Resource Name | Auditor Scan Description |
156159
|---|---|---|
160+
| GCP_BigQuery_Auditor | BigQuery table | Has the table been updated in the last 90 days |
161+
| GCP_BigQuery_Auditor | BigQuery table | Do tables use CMEKs for encryption |
162+
| GCP_IAM_Auditor | Service Account | Are user-managed keys in use (lol, yes, at least one!) |
157163
| GCP_ComputeEngine_Auditor | GCE VM Instance | Is deletion protection enabled |
158164
| GCP_ComputeEngine_Auditor | GCE VM Instance | Is IP forwarding disabled |
159165
| GCP_ComputeEngine_Auditor | GCE VM Instance | Is auto-restart enabled |

eeauditor/auditors/gcp/ElectricEye_AttackSurface_GCP_Auditor.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# Instantiate a NMAP scanner for TCP scans to define ports
3131
nmap = nmap3.NmapScanTechniques()
3232

33-
def get_compute_engine_instances(cache: dict, gcpProjectId: str):
33+
def get_compute_engine_instances(cache: dict, gcpProjectId: str, gcpCredentials):
3434
'''
3535
AggregatedList result provides Zone information as well as every single Instance in a Project
3636
'''
@@ -39,7 +39,7 @@ def get_compute_engine_instances(cache: dict, gcpProjectId: str):
3939

4040
results = []
4141

42-
compute = googleapiclient.discovery.build('compute', 'v1')
42+
compute = googleapiclient.discovery.build('compute', 'v1', credentials=gcpCredentials)
4343

4444
aggResult = compute.instances().aggregatedList(project=gcpProjectId).execute()
4545

@@ -79,11 +79,11 @@ def scan_host(hostIp, assetName, assetComponent):
7979
results = None
8080

8181
@registry.register_check("gce")
82-
def gce_attack_surface_open_tcp_port_check(cache: dict, awsAccountId: str, awsRegion: str, awsPartition: str, gcpProjectId: str):
82+
def gce_attack_surface_open_tcp_port_check(cache: dict, awsAccountId: str, awsRegion: str, awsPartition: str, gcpProjectId: str, gcpCredentials):
8383
"""[AttackSurface.GCP.GCE.{checkIdNumber}] Google Compute Engine VM instances should not be publicly reachable on {serviceName}"""
8484
iso8601Time = datetime.datetime.now(datetime.timezone.utc).isoformat()
8585

86-
for gce in get_compute_engine_instances(cache, gcpProjectId):
86+
for gce in get_compute_engine_instances(cache, gcpProjectId, gcpCredentials):
8787
# B64 encode all of the details for the Asset
8888
assetJson = json.dumps(gce,default=str).encode("utf-8")
8989
assetB64 = base64.b64encode(assetJson)

0 commit comments

Comments
 (0)