-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ingress gateway connection limit spec
- Loading branch information
1 parent
ea7c779
commit db59848
Showing
10 changed files
with
115 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
33 changes: 33 additions & 0 deletions
33
internal/security/mesh/istio/7_configure_limit_downstream_connections .yml
This file contains 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,33 @@ | ||
--- | ||
benchmark_type: mesh | ||
categories: | ||
- | ||
name: istio Security Checks | ||
sub_category: | ||
name: Downstream Connections | ||
security_checks: | ||
- | ||
name: 'make sure config map with downstream Connections created' | ||
description: 'Update global_downstream_max_connections in the config map according to the number of concurrent connections needed by individual gateway instances in your deployment. Once the limit is reached, Envoy will start rejecting tcp connections.' | ||
check_command: | ||
- 'kubectl get configmap istio-custom-bootstrap-config -n istio-system -o json 2> /dev/null' | ||
remediation: 'create config map with downstream Connections created' | ||
check_type: multi_param | ||
impact: not al net traffic will not be capture | ||
eval_expr: "[${0} MATCH downstream_connection_limit_config_map.policy QUERY istio.policy_eval RETURN match];" | ||
default_value: 'By default, Istio (and Envoy) have no limit on the number of downstream connections' | ||
eval_message: 'config map istio-custom-bootstrap-config is exist on namespace istio-system' | ||
references: | ||
- https://istio.io/latest/docs/ops/best-practices/security/#configure-a-limit-on-downstream-connections | ||
- name: 'make ingress gateway deployment is patched with downstream Connections limit config' | ||
description: 'Patch ingress gateway with downstream Connections limit config Once the limit is reached, Envoy will start rejecting tcp connections.' | ||
check_command: | ||
- 'kubectl get deployment istio-ingressgateway -n istio-system -o json 2> /dev/null' | ||
remediation: 'Patch the ingress gateway deployment to use the above configuration. Download gateway-patch.yaml and apply it using the following command.' | ||
check_type: multi_param | ||
impact: not al net traffic will not be capture | ||
eval_expr: "[${0} MATCH ingress_gateway_patched_downstream_connection_limit.policy QUERY istio.policy_eval RETURN match];" | ||
default_value: 'By default, Istio (and Envoy) have no limit on the number of downstream connections' | ||
eval_message: 'deployment istio-ingressgateway is patched with istio-custom-bootstrap-config config map' | ||
references: | ||
- https://istio.io/latest/docs/ops/best-practices/security/#configure-a-limit-on-downstream-connections |
12 changes: 12 additions & 0 deletions
12
internal/security/mesh/istio/downstream_connection_limit_config_map.policy
This file contains 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,12 @@ | ||
package istio | ||
|
||
policy_eval = {"match":allow_policy} { | ||
allow_policy = downstream_connections_config_map_exist | ||
} | ||
|
||
default downstream_connections_config_map_exist = false | ||
downstream_connections_config_map_exist { | ||
input.kind == "ConfigMap" | ||
input.metadata.name == "istio-custom-bootstrap-config" | ||
input.data["custom_bootstrap.json"] | ||
} |
14 changes: 14 additions & 0 deletions
14
internal/security/mesh/istio/ingress_gateway_patched_downstream_connection_limit.policy
This file contains 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,14 @@ | ||
package istio | ||
|
||
policy_eval = {"match":allow_policy} { | ||
allow_policy = downstream_connections_exist | ||
} | ||
|
||
default downstream_connections_exist = false | ||
downstream_connections_exist { | ||
input.kind == "Deployment" | ||
input.metadata.name == "istio-ingressgateway" | ||
some i | ||
input.spec.template.spec.volumes[i].configMap.name == "istio-custom-bootstrap-config" | ||
} | ||
|
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -20,6 +20,7 @@ const EmptyLines = ` | |
` | ||
|
||
//RemediationReport banner | ||
const RemediationReport = ` | ||
|