Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for Frabkfurt data center and Organization sub accounts #1

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Overview

This repo provides example JSON body sections to enable and disable the CIS Benchmarks for GCP in Lacework when calling the PATCH method on *https://lacework-tenant.lacework.net/api/v1/external/recommendations/gcp* API Endpoint
This repo provides example JSON body sections to enable and disable the CIS Benchmarks for GCP & Azure in Lacework when calling the PATCH method on *https://lacework-tenant.lacework.net/api/v1/external/recommendations/gcp* and *https://lacework-tenant.lacework.net/api/v1/external/recommendations/azure* API Endpoints

# Script
This repo also includes an example script that can be used to perform the config, with a requirement of having curl and the Lacework CLI installed. Usage is:

`gcp-cis-config.sh [disable_cis_10|disable_cis_12|enable_cis_12] [lacework-tenant]`
`cis-config.sh [disable_cis_10|disable_cis_12|enable_cis_12|disable_cis_azure|enable_cis_azure] [lacework-tenant] [lacework-subaccount]`

Where the first argument is the action you wish to perform, and the second argument is your lacework tenant (without the `.lacework.net`)
Where the first argument is the action you wish to perform, the second argument is your lacework tenant (without the `.lacework.net`) and the third argument is the subaccount where the GCP for Lacework is configured.

# Further information

`lacework-tenant` If you are in the Frankfurt datacenter you need to specify this as `tenant.fra`

`lacework-subaccount` If you Lacework tenant is enrolled in an organization then you need to specify the name of the subaccount. If this is not the case then ignore the third argument.
19 changes: 15 additions & 4 deletions gcp-cis-config.sh → cis-config.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
#!/bin/zsh

lacework_tenant=$2
lacework_subaccount=$3

#Set data strings
disable_cis_10='{"GCP_CIS_1_1": "disable","GCP_CIS_1_2": "disable","GCP_CIS_1_3": "disable","GCP_CIS_1_4": "disable","GCP_CIS_1_5": "disable","GCP_CIS_1_6": "disable","GCP_CIS_1_7": "disable","GCP_CIS_1_8": "disable","GCP_CIS_1_9": "disable","GCP_CIS_1_10": "disable","GCP_CIS_1_11": "disable","GCP_CIS_1_12": "disable","GCP_CIS_1_13": "disable","GCP_CIS_2_1": "disable","GCP_CIS_2_2": "disable","GCP_CIS_2_3": "disable","GCP_CIS_2_4": "disable","GCP_CIS_2_5": "disable","GCP_CIS_2_6": "disable","GCP_CIS_2_7": "disable","GCP_CIS_2_8": "disable","GCP_CIS_2_9": "disable","GCP_CIS_2_10": "disable","GCP_CIS_2_11": "disable","GCP_CIS_3_1": "disable","GCP_CIS_3_2": "disable","GCP_CIS_3_3": "disable","GCP_CIS_3_4": "disable","GCP_CIS_3_5": "disable","GCP_CIS_3_6": "disable", "GCP_CIS_3_7": "disable", "GCP_CIS_3_8": "disable", "GCP_CIS_4_1": "disable", "GCP_CIS_4_2": "disable", "GCP_CIS_4_3": "disable", "GCP_CIS_4_4": "disable", "GCP_CIS_4_5": "disable", "GCP_CIS_4_6": "disable", "GCP_CIS_5_1": "disable", "GCP_CIS_5_2": "disable", "GCP_CIS_5_3": "disable", "GCP_CIS_6_1": "disable", "GCP_CIS_6_2": "disable", "GCP_CIS_6_3": "disable", "GCP_CIS_6_4": "disable", "GCP_CIS_7_1": "disable", "GCP_CIS_7_2": "disable", "GCP_CIS_7_3": "disable", "GCP_CIS_7_4": "disable", "GCP_CIS_7_5": "disable", "GCP_CIS_7_6": "disable", "GCP_CIS_7_7": "disable", "GCP_CIS_7_8": "disable", "GCP_CIS_7_9": "disable", "GCP_CIS_7_10": "disable", "GCP_CIS_7_11": "disable", "GCP_CIS_7_12": "disable", "GCP_CIS_7_13": "disable", "GCP_CIS_7_14": "disable", "GCP_CIS_7_15": "disable", "GCP_CIS_7_16": "disable", "GCP_CIS_7_17": "disable", "GCP_CIS_7_18": "disable" }'
disable_cis_12='{"GCP_CIS12_1_1": "disable","GCP_CIS12_1_2": "disable","GCP_CIS12_1_3": "disable","GCP_CIS12_1_4": "disable","GCP_CIS12_1_5": "disable","GCP_CIS12_1_6": "disable","GCP_CIS12_1_7": "disable","GCP_CIS12_1_8": "disable","GCP_CIS12_1_9": "disable","GCP_CIS12_1_10": "disable","GCP_CIS12_1_11": "disable","GCP_CIS12_1_12": "disable","GCP_CIS12_1_13": "disable","GCP_CIS12_1_14": "disable","GCP_CIS12_1_15": "disable","GCP_CIS12_2_1": "disable","GCP_CIS12_2_2": "disable","GCP_CIS12_2_3": "disable","GCP_CIS12_2_4": "disable","GCP_CIS12_2_5": "disable","GCP_CIS12_2_6": "disable","GCP_CIS12_2_7": "disable","GCP_CIS12_2_8": "disable","GCP_CIS12_2_9": "disable","GCP_CIS12_2_10": "disable","GCP_CIS12_2_11": "disable","GCP_CIS12_2_12": "disable","GCP_CIS12_3_1": "disable","GCP_CIS12_3_2": "disable","GCP_CIS12_3_3": "disable","GCP_CIS12_3_4": "disable","GCP_CIS12_3_5": "disable","GCP_CIS12_3_6": "disable","GCP_CIS12_3_7": "disable","GCP_CIS12_3_8": "disable","GCP_CIS12_3_9": "disable","GCP_CIS12_3_10": "disable","GCP_CIS12_4_1": "disable","GCP_CIS12_4_2": "disable","GCP_CIS12_4_3": "disable","GCP_CIS12_4_4": "disable","GCP_CIS12_4_5": "disable","GCP_CIS12_4_6": "disable","GCP_CIS12_4_7": "disable","GCP_CIS12_4_8": "disable","GCP_CIS12_4_9": "disable","GCP_CIS12_4_10": "disable","GCP_CIS12_4_11": "disable","GCP_CIS12_5_1": "disable","GCP_CIS12_5_2": "disable","GCP_CIS12_6_1_1": "disable","GCP_CIS12_6_1_2": "disable","GCP_CIS12_6_1_3": "disable","GCP_CIS12_6_2_1": "disable","GCP_CIS12_6_2_2": "disable","GCP_CIS12_6_2_3": "disable","GCP_CIS12_6_2_4": "disable","GCP_CIS12_6_2_5": "disable","GCP_CIS12_6_2_6": "disable","GCP_CIS12_6_2_7": "disable","GCP_CIS12_6_2_8": "disable","GCP_CIS12_6_2_9": "disable","GCP_CIS12_6_2_10": "disable","GCP_CIS12_6_2_11": "disable","GCP_CIS12_6_2_12": "disable","GCP_CIS12_6_2_13": "disable","GCP_CIS12_6_2_14": "disable","GCP_CIS12_6_2_15": "disable","GCP_CIS12_6_2_16": "disable","GCP_CIS12_6_3_1": "disable","GCP_CIS12_6_3_2": "disable","GCP_CIS12_6_3_3": "disable","GCP_CIS12_6_3_4": "disable","GCP_CIS12_6_3_5": "disable","GCP_CIS12_6_3_6": "disable","GCP_CIS12_6_3_7": "disable","GCP_CIS12_6_4": "disable","GCP_CIS12_6_5": "disable","GCP_CIS12_6_6": "disable","GCP_CIS12_6_7": "disable","GCP_CIS12_7_1": "disable","GCP_CIS12_7_2": "disable","GCP_CIS12_7_3": "disable","GCP_K8S_1_1": "disable","GCP_K8S_1_2": "disable","GCP_K8S_1_3": "disable","GCP_K8S_1_4": "disable","GCP_K8S_1_5": "disable","GCP_K8S_1_6": "disable","GCP_K8S_1_7": "disable","GCP_K8S_1_8": "disable","GCP_K8S_1_9": "disable","GCP_K8S_1_10": "disable","GCP_K8S_1_11": "disable","GCP_K8S_1_12": "disable","GCP_K8S_1_13": "disable","GCP_K8S_1_14": "disable","GCP_K8S_1_15": "disable","GCP_K8S_1_16": "disable","GCP_K8S_1_17": "disable","GCP_K8S_1_18": "disable"}'
enable_cis_12='{"GCP_CIS12_1_1": "enable","GCP_CIS12_1_2": "enable","GCP_CIS12_1_3": "enable","GCP_CIS12_1_4": "enable","GCP_CIS12_1_5": "enable","GCP_CIS12_1_6": "enable","GCP_CIS12_1_7": "enable","GCP_CIS12_1_8": "enable","GCP_CIS12_1_9": "enable","GCP_CIS12_1_10": "enable","GCP_CIS12_1_11": "enable","GCP_CIS12_1_12": "enable","GCP_CIS12_1_13": "enable","GCP_CIS12_1_14": "enable","GCP_CIS12_1_15": "enable","GCP_CIS12_2_1": "enable","GCP_CIS12_2_2": "enable","GCP_CIS12_2_3": "enable","GCP_CIS12_2_4": "enable","GCP_CIS12_2_5": "enable","GCP_CIS12_2_6": "enable","GCP_CIS12_2_7": "enable","GCP_CIS12_2_8": "enable","GCP_CIS12_2_9": "enable","GCP_CIS12_2_10": "enable","GCP_CIS12_2_11": "enable","GCP_CIS12_2_12": "enable","GCP_CIS12_3_1": "enable","GCP_CIS12_3_2": "enable","GCP_CIS12_3_3": "enable","GCP_CIS12_3_4": "enable","GCP_CIS12_3_5": "enable","GCP_CIS12_3_6": "enable","GCP_CIS12_3_7": "enable","GCP_CIS12_3_8": "enable","GCP_CIS12_3_9": "enable","GCP_CIS12_3_10": "enable","GCP_CIS12_4_1": "enable","GCP_CIS12_4_2": "enable","GCP_CIS12_4_3": "enable","GCP_CIS12_4_4": "enable","GCP_CIS12_4_5": "enable","GCP_CIS12_4_6": "enable","GCP_CIS12_4_7": "enable","GCP_CIS12_4_8": "enable","GCP_CIS12_4_9": "enable","GCP_CIS12_4_10": "enable","GCP_CIS12_4_11": "enable","GCP_CIS12_5_1": "enable","GCP_CIS12_5_2": "enable","GCP_CIS12_6_1_1": "enable","GCP_CIS12_6_1_2": "enable","GCP_CIS12_6_1_3": "enable","GCP_CIS12_6_2_1": "enable","GCP_CIS12_6_2_2": "enable","GCP_CIS12_6_2_3": "enable","GCP_CIS12_6_2_4": "enable","GCP_CIS12_6_2_5": "enable","GCP_CIS12_6_2_6": "enable","GCP_CIS12_6_2_7": "enable","GCP_CIS12_6_2_8": "enable","GCP_CIS12_6_2_9": "enable","GCP_CIS12_6_2_10": "enable","GCP_CIS12_6_2_11": "enable","GCP_CIS12_6_2_12": "enable","GCP_CIS12_6_2_13": "enable","GCP_CIS12_6_2_14": "enable","GCP_CIS12_6_2_15": "enable","GCP_CIS12_6_2_16": "enable","GCP_CIS12_6_3_1": "enable","GCP_CIS12_6_3_2": "enable","GCP_CIS12_6_3_3": "enable","GCP_CIS12_6_3_4": "enable","GCP_CIS12_6_3_5": "enable","GCP_CIS12_6_3_6": "enable","GCP_CIS12_6_3_7": "enable","GCP_CIS12_6_4": "enable","GCP_CIS12_6_5": "enable","GCP_CIS12_6_6": "enable","GCP_CIS12_6_7": "enable","GCP_CIS12_7_1": "enable","GCP_CIS12_7_2": "enable","GCP_CIS12_7_3": "enable","GCP_K8S_1_1": "enable","GCP_K8S_1_2": "enable","GCP_K8S_1_3": "enable","GCP_K8S_1_4": "enable","GCP_K8S_1_5": "enable","GCP_K8S_1_6": "enable","GCP_K8S_1_7": "enable","GCP_K8S_1_8": "enable","GCP_K8S_1_9": "enable","GCP_K8S_1_10": "enable","GCP_K8S_1_11": "enable","GCP_K8S_1_12": "enable","GCP_K8S_1_13": "enable","GCP_K8S_1_14": "enable","GCP_K8S_1_15": "enable","GCP_K8S_1_16": "enable","GCP_K8S_1_17": "enable","GCP_K8S_1_18": "enable"}'
disable_cis_azure='{"Azure_CIS_131_1_1": "disable","Azure_CIS_131_1_2": "disable","Azure_CIS_131_1_21": "disable","Azure_CIS_131_2_1": "disable","Azure_CIS_131_2_2": "disable","Azure_CIS_131_2_3": "disable","Azure_CIS_131_2_4": "disable","Azure_CIS_131_2_5": "disable","Azure_CIS_131_2_6": "disable","Azure_CIS_131_2_7": "disable","Azure_CIS_131_2_8": "disable","Azure_CIS_131_2_9": "disable","Azure_CIS_131_2_10": "disable","Azure_CIS_131_2_11": "disable","Azure_CIS_131_2_12": "disable","Azure_CIS_131_2_13": "disable","Azure_CIS_131_2_14": "disable","Azure_CIS_131_2_15": "disable","Azure_CIS_131_3_1": "disable","Azure_CIS_131_3_2": "disable","Azure_CIS_131_3_3": "disable","Azure_CIS_131_3_4": "disable","Azure_CIS_131_3_5": "disable","Azure_CIS_131_3_6": "disable","Azure_CIS_131_3_7": "disable","Azure_CIS_131_3_8": "disable","Azure_CIS_131_3_9": "disable","Azure_CIS_131_3_10": "disable","Azure_CIS_131_3_11": "disable","Azure_CIS_131_4_1_1": "disable","Azure_CIS_131_4_1_2": "disable","Azure_CIS_131_4_1_3": "disable","Azure_CIS_131_4_2_1": "disable","Azure_CIS_131_4_2_2": "disable","Azure_CIS_131_4_2_3": "disable","Azure_CIS_131_4_2_4": "disable","Azure_CIS_131_4_2_5": "disable","Azure_CIS_131_4_3_1": "disable","Azure_CIS_131_4_3_2": "disable","Azure_CIS_131_4_3_3": "disable","Azure_CIS_131_4_3_4": "disable","Azure_CIS_131_4_3_5": "disable","Azure_CIS_131_4_3_6": "disable","Azure_CIS_131_4_3_7": "disable","Azure_CIS_131_4_3_8": "disable","Azure_CIS_131_4_4": "disable","Azure_CIS_131_4_5": "disable","Azure_CIS_131_5_1_1": "disable","Azure_CIS_131_5_1_2": "disable","Azure_CIS_131_5_1_3": "disable","Azure_CIS_131_5_1_4": "disable","Azure_CIS_131_5_1_5": "disable","Azure_CIS_131_5_2_1": "disable","Azure_CIS_131_5_2_2": "disable","Azure_CIS_131_5_2_3": "disable","Azure_CIS_131_5_2_4": "disable","Azure_CIS_131_5_2_5": "disable","Azure_CIS_131_5_2_6": "disable","Azure_CIS_131_5_2_7": "disable","Azure_CIS_131_5_2_8": "disable","Azure_CIS_131_5_2_9": "disable","Azure_CIS_131_5_3": "disable","Azure_CIS_131_6_1": "disable","Azure_CIS_131_6_2": "disable","Azure_CIS_131_6_3": "disable","Azure_CIS_131_6_4": "disable","Azure_CIS_131_6_5": "disable","Azure_CIS_131_6_6": "disable","Azure_CIS_131_7_1": "disable","Azure_CIS_131_7_2": "disable","Azure_CIS_131_7_3": "disable","Azure_CIS_131_7_4": "disable","Azure_CIS_131_7_5": "disable","Azure_CIS_131_7_6": "disable","Azure_CIS_131_7_7": "disable","Azure_CIS_131_8_1": "disable","Azure_CIS_131_8_2": "disable","Azure_CIS_131_8_3": "disable","Azure_CIS_131_8_4": "disable","Azure_CIS_131_8_5": "disable","Azure_CIS_131_9_1": "disable","Azure_CIS_131_9_2": "disable","Azure_CIS_131_9_3": "disable","Azure_CIS_131_9_4": "disable","Azure_CIS_131_9_5": "disable","Azure_CIS_131_9_6": "disable","Azure_CIS_131_9_7": "disable","Azure_CIS_131_9_8": "disable","Azure_CIS_131_9_9": "disable","Azure_CIS_131_9_10": "disable","Azure_CIS_131_9_11": "disable"}'
enable_cis_azure='{"Azure_CIS_131_1_1": "enable","Azure_CIS_131_1_2": "enable","Azure_CIS_131_1_21": "enable","Azure_CIS_131_2_1": "enable","Azure_CIS_131_2_2": "enable","Azure_CIS_131_2_3": "enable","Azure_CIS_131_2_4": "enable","Azure_CIS_131_2_5": "enable","Azure_CIS_131_2_6": "enable","Azure_CIS_131_2_7": "enable","Azure_CIS_131_2_8": "enable","Azure_CIS_131_2_9": "enable","Azure_CIS_131_2_10": "enable","Azure_CIS_131_2_11": "enable","Azure_CIS_131_2_12": "enable","Azure_CIS_131_2_13": "enable","Azure_CIS_131_2_14": "enable","Azure_CIS_131_2_15": "enable","Azure_CIS_131_3_1": "enable","Azure_CIS_131_3_2": "enable","Azure_CIS_131_3_3": "enable","Azure_CIS_131_3_4": "enable","Azure_CIS_131_3_5": "enable","Azure_CIS_131_3_6": "enable","Azure_CIS_131_3_7": "enable","Azure_CIS_131_3_8": "enable","Azure_CIS_131_3_9": "enable","Azure_CIS_131_3_10": "enable","Azure_CIS_131_3_11": "enable","Azure_CIS_131_4_1_1": "enable","Azure_CIS_131_4_1_2": "enable","Azure_CIS_131_4_1_3": "enable","Azure_CIS_131_4_2_1": "enable","Azure_CIS_131_4_2_2": "enable","Azure_CIS_131_4_2_3": "enable","Azure_CIS_131_4_2_4": "enable","Azure_CIS_131_4_2_5": "enable","Azure_CIS_131_4_3_1": "enable","Azure_CIS_131_4_3_2": "enable","Azure_CIS_131_4_3_3": "enable","Azure_CIS_131_4_3_4": "enable","Azure_CIS_131_4_3_5": "enable","Azure_CIS_131_4_3_6": "enable","Azure_CIS_131_4_3_7": "enable","Azure_CIS_131_4_3_8": "enable","Azure_CIS_131_4_4": "enable","Azure_CIS_131_4_5": "enable","Azure_CIS_131_5_1_1": "enable","Azure_CIS_131_5_1_2": "enable","Azure_CIS_131_5_1_3": "enable","Azure_CIS_131_5_1_4": "enable","Azure_CIS_131_5_1_5": "enable","Azure_CIS_131_5_2_1": "enable","Azure_CIS_131_5_2_2": "enable","Azure_CIS_131_5_2_3": "enable","Azure_CIS_131_5_2_4": "enable","Azure_CIS_131_5_2_5": "enable","Azure_CIS_131_5_2_6": "enable","Azure_CIS_131_5_2_7": "enable","Azure_CIS_131_5_2_8": "enable","Azure_CIS_131_5_2_9": "enable","Azure_CIS_131_5_3": "enable","Azure_CIS_131_6_1": "enable","Azure_CIS_131_6_2": "enable","Azure_CIS_131_6_3": "enable","Azure_CIS_131_6_4": "enable","Azure_CIS_131_6_5": "enable","Azure_CIS_131_6_6": "enable","Azure_CIS_131_7_1": "enable","Azure_CIS_131_7_2": "enable","Azure_CIS_131_7_3": "enable","Azure_CIS_131_7_4": "enable","Azure_CIS_131_7_5": "enable","Azure_CIS_131_7_6": "enable","Azure_CIS_131_7_7": "enable","Azure_CIS_131_8_1": "enable","Azure_CIS_131_8_2": "enable","Azure_CIS_131_8_3": "enable","Azure_CIS_131_8_4": "enable","Azure_CIS_131_8_5": "enable","Azure_CIS_131_9_1": "enable","Azure_CIS_131_9_2": "enable","Azure_CIS_131_9_3": "enable","Azure_CIS_131_9_4": "enable","Azure_CIS_131_9_5": "enable","Azure_CIS_131_9_6": "enable","Azure_CIS_131_9_7": "enable","Azure_CIS_131_9_8": "enable","Azure_CIS_131_9_9": "enable","Azure_CIS_131_9_10": "enable","Azure_CIS_131_9_11": "enable"}'

case $1 in
"disable_cis_10")
#Disable GCP CIS 1.0 checks
curl -X PATCH -H 'Content-Type: application/json' -H 'Authorization: Bearer '$(lacework access-token) -d ${disable_cis_10} https://${lacework_tenant}.lacework.net/api/v1/external/recommendations/gcp
curl -X PATCH -H 'Content-Type: application/json' -H 'Authorization: Bearer '$(lacework access-token) --header 'Account-name: '${lacework_subaccount} -d ${disable_cis_10} https://${lacework_tenant}.lacework.net/api/v1/external/recommendations/gcp
;;
"disable_cis_12")
#Disable GCP CIS 1.2 checks
curl -X PATCH -H 'Content-Type: application/json' -H 'Authorization: Bearer '$(lacework access-token) -d ${disable_cis_12} https://${lacework_tenant}.lacework.net/api/v1/external/recommendations/gcp
curl -X PATCH -H 'Content-Type: application/json' -H 'Authorization: Bearer '$(lacework access-token) --header 'Account-name: '${lacework_subaccount} -d ${disable_cis_12} https://${lacework_tenant}.lacework.net/api/v1/external/recommendations/gcp
;;
"enable_cis_12")
#Enable GCP CIS 1.2 checks
curl -X PATCH -H 'Content-Type: application/json' -H 'Authorization: Bearer '$(lacework access-token) -d ${enable_cis_12} https://${lacework_tenant}.lacework.net/api/v1/external/recommendations/gcp
curl -X PATCH -H 'Content-Type: application/json' -H 'Authorization: Bearer '$(lacework access-token) --header 'Account-name: '${lacework_subaccount} -d ${enable_cis_12} https://${lacework_tenant}.lacework.net/api/v1/external/recommendations/gcp
;;
"disable_cis_azure")
#Disable Azure CIS 1.3.1 checks
curl -X PATCH -H 'Content-Type: application/json' -H 'Authorization: Bearer '$(lacework access-token) --header 'Account-name: '${lacework_subaccount} -d ${disable_cis_azure} https://${lacework_tenant}.lacework.net/api/v1/external/recommendations/azure
;;
"enable_cis_azure")
#Enable Azure CIS 1.3.1 checks
curl -X PATCH -H 'Content-Type: application/json' -H 'Authorization: Bearer '$(lacework access-token) --header 'Account-name: '${lacework_subaccount} -d ${enable_cis_azure} https://${lacework_tenant}.lacework.net/api/v1/external/recommendations/azure
;;
*)
echo "Syntax: gcp-cis-config.sh [disable_cis_10|disable_cis_12|enable_cis_12] [lacework-tenant]"
echo "Syntax: gcp-cis-config.sh [disable_cis_10|disable_cis_12|enable_cis_12|disable_cis_azure|enable_cis_azure] [lacework-tenant] [lacework-subaccount]"
esac