Skip to content

Commit

Permalink
Merge pull request #328 from accurics/update-k8s-initial-policies
Browse files Browse the repository at this point in the history
updated k8s policy set and documentation
  • Loading branch information
kanchwala-yusuf authored Sep 16, 2020
2 parents 4c30787 + ecd531b commit ab92377
Show file tree
Hide file tree
Showing 134 changed files with 1,008 additions and 350 deletions.
164 changes: 81 additions & 83 deletions docs/policies/k8s.md

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "defaultNamespaceUsed",
"file": "defaultNamespaceUsed.rego",
"template_args": {
"generate_name": "generate_name",
"name": "defaultNamespaceUsed",
"prefix": "",
"resource_type": "kubernetes_pod",
"suffix": ""
},
"severity": "LOW",
"description": "The default namespace should not be used",
"reference_id": "accurics.kubernetes.OPS.460",
"category": "Operational Efficiency",
"version": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "defaultNamespaceUsed2",
"file": "defaultNamespaceUsed.rego",
"template_args": {
"generate_name": "generate_name",
"name": "defaultNamespaceUsed2",
"prefix": "",
"resource_type": "kubernetes_deployment",
"suffix": ""
},
"severity": "LOW",
"description": "The default namespace should not be used",
"reference_id": "accurics.kubernetes.OPS.461",
"category": "Operational Efficiency",
"version": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "defaultNamespaceUsed4",
"file": "defaultNamespaceUsed.rego",
"template_args": {
"generate_name": "generate_name",
"name": "defaultNamespaceUsed4",
"prefix": "",
"resource_type": "kubernetes_job",
"suffix": ""
},
"severity": "LOW",
"description": "The default namespace should not be used",
"reference_id": "accurics.kubernetes.OPS.462",
"category": "Operational Efficiency",
"version": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package accurics

{{.prefix}}{{.name}}{{.suffix}}[api.id]
{
api := input.{{.resource_type}}[_]
metadata := api.config.metadata
metadata.namespace == "default"
}

{{.prefix}}{{.name}}{{.suffix}}[api.id]
{
api := input.{{.resource_type}}[_]
metadata := api.config.metadata
metadata.namespace == ""
}

{{.prefix}}{{.name}}{{.suffix}}[api.id]
{
api := input.{{.resource_type}}[_]
metadata := api.config.metadata
not metadata.namespace
not metadata.{{.generate_name}}
}

{{.prefix}}{{.name}}{{.suffix}}[api.id]
{
api := input.{{.resource_type}}[_]
metadata := api.config.metadata
not metadata.namespace
metadata.{{.generate_name}} == false
}

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"file": "containerAllowPrivilegeEscalationIsTrue.rego",
"template_args": {
"is_init": false,
"name": "containerAllowPrivilegeEscalationIsTrue",
"prefix": "",
"resource_type": "kubernetes_cron_job",
"suffix": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"file": "containerAllowPrivilegeEscalationIsTrue.rego",
"template_args": {
"is_init": true,
"name": "containerAllowPrivilegeEscalationIsTrue",
"prefix": "",
"resource_type": "kubernetes_daemonset",
"suffix": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"file": "containerAllowPrivilegeEscalationIsTrue.rego",
"template_args": {
"is_init": true,
"name": "containerAllowPrivilegeEscalationIsTrue",
"prefix": "",
"resource_type": "kubernetes_deployment",
"suffix": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"file": "containerAllowPrivilegeEscalationIsTrue.rego",
"template_args": {
"is_init": true,
"name": "containerAllowPrivilegeEscalationIsTrue",
"prefix": "",
"resource_type": "kubernetes_job",
"suffix": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"file": "containerAllowPrivilegeEscalationIsTrue.rego",
"template_args": {
"is_init": true,
"name": "containerAllowPrivilegeEscalationIsTrue",
"prefix": "",
"resource_type": "kubernetes_pod",
"suffix": ""
Expand Down
Loading

0 comments on commit ab92377

Please sign in to comment.