Skip to content

Instantly share code, notes, and snippets.

@avoidik
Created December 9, 2021 15:46
Show Gist options
  • Save avoidik/0f6fca2bd4af940416d38b2a54ca7662 to your computer and use it in GitHub Desktop.
Save avoidik/0f6fca2bd4af940416d38b2a54ca7662 to your computer and use it in GitHub Desktop.
Vault Sentinel sample policy
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