Created
December 9, 2021 15:46
-
-
Save avoidik/0f6fca2bd4af940416d38b2a54ca7662 to your computer and use it in GitHub Desktop.
Vault Sentinel sample 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
import "sockaddr" | |
import "strings" | |
# | |
# allow update secrets under secret/ path only to clients coming from 10.0.0.0/8 CIDR range | |
# | |
precond = rule { | |
request.operation in ["update"] and | |
strings.has_prefix(request.path, "secret/") | |
} | |
cidrcheck = rule { | |
sockaddr.is_contained(request.connection.remote_addr, "10.0.0.0/8") | |
} | |
main = rule when precond { | |
cidrcheck | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment