-
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.
Add default policies for k8s, tf and update README
Signed-off-by: santoshkal <[email protected]>
- Loading branch information
1 parent
735beaa
commit ece0a69
Showing
4 changed files
with
99 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package validate_k8s | ||
|
||
import future.keywords | ||
|
||
default deny_latest = false | ||
default deny_secret = false | ||
default deny_priviliged_pod = false | ||
|
||
deny_latest{ | ||
input.kind == "Deployment" | ||
c:= input.spec.template.spec.containers[i].image | ||
not endswith(c, "latest") | ||
} | ||
|
||
deny_secret{ | ||
input.kind == "Deployment" | ||
container := input.spec.template.spec.containers[_] | ||
not container.envFrom | ||
} | ||
|
||
deny_secret{ | ||
input.kind == "Deployment" | ||
container := input.spec.template.spec.containers[_] | ||
env := container.envFrom[_] | ||
|
||
not env.secretRef | ||
} | ||
|
||
deny_secret{ | ||
input.kind == "Deployment" | ||
container := input.spec.template.spec.containers[_] | ||
|
||
env := container.env[_] | ||
env.valueFrom != [] | ||
} | ||
|
||
deny_priviliged_pod{ | ||
input.kind == "Deployment" | ||
not input.spec.template.spec.securityContext | ||
} | ||
|
||
deny_priviliged_pod{ | ||
input.kind == "Deployment" | ||
podSpec := input.spec.template.spec.securityContext | ||
|
||
not podSpec.priviliged | ||
} |
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,11 @@ | ||
package validate_input_tf | ||
|
||
default deny_global_ingress = false | ||
|
||
deny_global_ingress { | ||
input.resource[_].aws_security_group | ||
ing := input.resource[_].aws_security_group.allow_tls.ingress[_] | ||
denied_cidr := "0.0.0.0/0" | ||
global := ing.cidr_blocks[_] | ||
not contains(global, denied_cidr) | ||
} |