Created
February 19, 2021 20:34
-
-
Save jmassardo/3332ef2ecd116238b728e65bd8dbafdc to your computer and use it in GitHub Desktop.
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
# List of insecure ports | |
disallowedPorts = {"22", "80", "3389"} | |
deny[msg] { | |
# loop through the resources and find all the network security groups. | |
# Get all their security rules and destination ports | |
resourcePorts := {p | c = input.resource_changes[_]; | |
p = c.change.after.security_rule[_].destination_port_range} | |
# Find any resource ports that match a port on the disallowed list | |
badPorts := {b | b = resourcePorts[_]; disallowedPorts[b]} | |
# Return a list of bad ports to the user | |
msg := sprintf("The following insecure ports open: %v", [badPorts]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment