-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
C
- we need the ability to write policies in HCL, with any level of complexity, and post those HCL policies to a vault server
T
- dude you just need to convert the policy to a string with quotes escaped, see below
A
- @see vault policy endpoint
sys/policies/acl/:policy_namedoesnt accept a valid json nor hcl file hashicorp/vault#18551- found a workaround but im sure theres a way to send valid hcl / json without having to parse it
creating policy policy_admin_vault:
path "secret/*" { # kv-v2
capabilities = [ "create", "read", "update", "delete", "list", "patch", "sudo"]
}
path "env/*" { # kv-v1
capabilities = [ "create", "read", "update", "delete", "list", "patch", "sudo"]
}
path "sys/*" {
capabilities = [ "create", "read", "update", "delete", "list", "patch", "sudo" ]
}
path "auth/*" {
capabilities = [ "create", "read", "update", "delete", "list", "patch", "sudo" ]
}
path "database/*" {
capabilities = [ "create", "read", "update", "delete", "list", "patch", "sudo" ]
}
path "pki*" {
capabilities = [ "create", "read", "update", "delete", "list", "patch", "sudo" ]
}
[DEBUG] SCRIPT.VAULT.SH
------------
[url]: https://dev.nirv.ai:8300/v1/sys/policies/acl/policy_admin_vault
[args]: -H X-Vault-Token: hvs.EqX-Bzh2cy5yb1lkcXlraHhYWmlLY1R5U2FxcTdoTWo --data {
"policy":
"
path \"secret/*\" {
capabilities = [ \"create\", \"read\", \"update\", \"delete\", \"list\", \"patch\", \"sudo\"]
}
path \"env/*\" {
capabilities = [ \"create\", \"read\", \"update\", \"delete\", \"list\", \"patch\", \"sudo\"]
}
path \"sys/*\" {
capabilities = [ \"create\", \"read\", \"update\", \"delete\", \"list\", \"patch\", \"sudo\" ]
}
path \"auth/*\" {
capabilities = [ \"create\", \"read\", \"update\", \"delete\", \"list\", \"patch\", \"sudo\" ]
}
path \"database/*\" {
capabilities = [ \"create\", \"read\", \"update\", \"delete\", \"list\", \"patch\", \"sudo\" ]
}
path \"pki*\" {
capabilities = [ \"create\", \"read\", \"update\", \"delete\", \"list\", \"patch\", \"sudo\" ]
}
"
}
------------
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
THE PITS