-
Notifications
You must be signed in to change notification settings - Fork 15
[DEV-3183]: Orl rule testcase #23
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
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
gcp/terraform/abstract/container-cluster-avoid-bindings-to-system-anonymous/expected/main.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| resource "google_container_cluster" "non_compliant_cluster" { | ||
| name = var.cluster_name | ||
| location = var.location | ||
|
|
||
| # Enable RBAC | ||
| enable_legacy_abac = true | ||
|
|
||
| # The non-compliant setting: allow anonymous access by enabling the legacy ABAC | ||
| # This allows unauthenticated users (system:anonymous) to have access, | ||
| # which violates the CIS recommendation to avoid bindings to system:anonymous. | ||
|
|
||
| # Minimal required settings for a valid cluster | ||
| initial_node_count = 1 | ||
|
|
||
| node_config { | ||
| machine_type = var.machine_type | ||
| } | ||
|
|
||
| rbac_binding_config { | ||
| enable_insecure_binding_system_unauthenticated = false | ||
| } | ||
| } | ||
|
|
||
| resource "google_container_cluster" "non_compliant_cluster_explicit" { | ||
| name = var.cluster_name | ||
| location = var.location | ||
|
|
||
| # Enable RBAC | ||
| enable_legacy_abac = true | ||
|
|
||
| # The non-compliant setting: allow anonymous access by enabling the legacy ABAC | ||
| # This allows unauthenticated users (system:anonymous) to have access, | ||
| # which violates the CIS recommendation to avoid bindings to system:anonymous. | ||
|
|
||
| # Minimal required settings for a valid cluster | ||
| initial_node_count = 1 | ||
|
|
||
| node_config { | ||
| machine_type = var.machine_type | ||
| } | ||
|
|
||
| rbac_binding_config { | ||
| enable_insecure_binding_system_unauthenticated = false | ||
| } | ||
| } | ||
|
|
||
| resource "google_container_cluster" "compliant_cluster" { | ||
| name = var.cluster_name | ||
| location = var.location | ||
|
|
||
| # Enable RBAC | ||
| enable_legacy_abac = true | ||
|
|
||
| # Minimal required settings for a valid cluster | ||
| initial_node_count = 1 | ||
|
|
||
| node_config { | ||
| machine_type = var.machine_type | ||
| } | ||
|
|
||
| rbac_binding_config { | ||
| enable_insecure_binding_system_unauthenticated = false | ||
| } | ||
| } | ||
22 changes: 22 additions & 0 deletions
22
...aform/abstract/container-cluster-avoid-bindings-to-system-anonymous/expected/variables.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| variable "gcp_project" { | ||
| type = string | ||
| description = "The GCP project to create the cluster in" | ||
| } | ||
|
|
||
| variable "cluster_name" { | ||
| type = string | ||
| description = "The name of the GKE cluster" | ||
| default = "uut-cluster" | ||
| } | ||
|
|
||
| variable "location" { | ||
| type = string | ||
| description = "The location/region for the cluster" | ||
| default = "us-central1" | ||
| } | ||
|
|
||
| variable "machine_type" { | ||
| type = string | ||
| description = "The machine type for the cluster nodes" | ||
| default = "e2-medium" | ||
| } |
16 changes: 16 additions & 0 deletions
16
gcp/terraform/abstract/container-cluster-avoid-bindings-to-system-anonymous/gomboc.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # yaml-language-server: $schema=../../../../gomboc-schema/test-case.yaml | ||
|
|
||
| name: Avoid bindings to system:anonymous | ||
|
|
||
| provider: GCP | ||
| iac: | ||
| language: terraform | ||
| version: v1.5.8 | ||
|
|
||
| canBeApplied: false | ||
|
|
||
| benchmarkRecommendations: | ||
| - id: "4.1.8" | ||
| name: "Avoid bindings to system:anonymous" | ||
| benchmark: CIS Google Kubernetes Engine (GKE) Autopilot Benchmark | ||
| benchmarkVersion: v1.0.0 |
57 changes: 57 additions & 0 deletions
57
gcp/terraform/abstract/container-cluster-avoid-bindings-to-system-anonymous/main.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| resource "google_container_cluster" "non_compliant_cluster" { | ||
| name = var.cluster_name | ||
| location = var.location | ||
|
|
||
| # Enable RBAC | ||
| enable_legacy_abac = true | ||
|
|
||
| # The non-compliant setting: allow anonymous access by enabling the legacy ABAC | ||
| # This allows unauthenticated users (system:anonymous) to have access, | ||
| # which violates the CIS recommendation to avoid bindings to system:anonymous. | ||
|
|
||
| # Minimal required settings for a valid cluster | ||
| initial_node_count = 1 | ||
|
|
||
| node_config { | ||
| machine_type = var.machine_type | ||
| } | ||
| } | ||
|
|
||
| resource "google_container_cluster" "non_compliant_cluster_explicit" { | ||
| name = var.cluster_name | ||
| location = var.location | ||
|
|
||
| # Enable RBAC | ||
| enable_legacy_abac = true | ||
|
|
||
| # The non-compliant setting: allow anonymous access by enabling the legacy ABAC | ||
| # This allows unauthenticated users (system:anonymous) to have access, | ||
| # which violates the CIS recommendation to avoid bindings to system:anonymous. | ||
|
|
||
| # Minimal required settings for a valid cluster | ||
| initial_node_count = 1 | ||
|
|
||
| node_config { | ||
| machine_type = var.machine_type | ||
| } | ||
|
|
||
| } | ||
|
|
||
| resource "google_container_cluster" "compliant_cluster" { | ||
| name = var.cluster_name | ||
| location = var.location | ||
|
|
||
| # Enable RBAC | ||
| enable_legacy_abac = true | ||
|
|
||
| # Minimal required settings for a valid cluster | ||
| initial_node_count = 1 | ||
|
|
||
| node_config { | ||
| machine_type = var.machine_type | ||
| } | ||
|
|
||
| rbac_binding_config { | ||
| enable_insecure_binding_system_unauthenticated = false | ||
| } | ||
| } |
19 changes: 19 additions & 0 deletions
19
gcp/terraform/abstract/container-cluster-avoid-bindings-to-system-anonymous/terraform.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Provider config | ||
| terraform { | ||
| required_providers { | ||
| google = { | ||
| source = "hashicorp/google" | ||
| version = ">= 6.13.0" | ||
| } | ||
| } | ||
|
|
||
| required_version = ">= 1.1.0" | ||
| } | ||
|
|
||
| provider "google" { | ||
| project = var.gcp_project | ||
| default_labels = { | ||
| "test-repo" = "rattleback", | ||
| "test-path" = "gcp/terraform/container-cluster-avoid-bindings-to-system-anonymous" | ||
| } | ||
| } |
22 changes: 22 additions & 0 deletions
22
gcp/terraform/abstract/container-cluster-avoid-bindings-to-system-anonymous/variables.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| variable "gcp_project" { | ||
| type = string | ||
| description = "The GCP project to create the cluster in" | ||
| } | ||
|
|
||
| variable "cluster_name" { | ||
| type = string | ||
| description = "The name of the GKE cluster" | ||
| default = "uut-cluster" | ||
| } | ||
|
|
||
| variable "location" { | ||
| type = string | ||
| description = "The location/region for the cluster" | ||
| default = "us-central1" | ||
| } | ||
|
|
||
| variable "machine_type" { | ||
| type = string | ||
| description = "The machine type for the cluster nodes" | ||
| default = "e2-medium" | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.