Grant vault deployer access to import + manage the rancher engine #91
Reference in New Issue
Block a user
Delete Branch "benvin/rancher-deployer-policy"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Wiring the new Rancher token secrets engine into Vault. The deployer registers the plugin (sudo-protected
sys/plugins/catalog) and configures the engine via the ranchervaultsecret provider, so it needs catalog + engine-path access. Mirrors #88 (gpg).Changes
policies/rancher/admin.yamlgranting thetf_vaultapprole andwoodpecker_terraform_vaultk8s role: catalog sudo onvault-plugin-secrets-rancher, and manage onrancher/{config,service-accounts,roles}.Merge order
Part 1 of 4. Merge before the plugin-import and backend PRs so apply doesn't 403. (Puppet install + this policy first, then import, then backend.)
The rancher token secrets engine is registered ('imported') into the catalog by terraform-vault (sys/plugins/catalog, sudo-protected) and configured via the ranchervaultsecret provider, so the deployer needs catalog access plus write on the engine's config/service-accounts/roles paths. Without this, apply 403s on plugin registration and on rancher/* writes. - Add policies/rancher/admin.yaml granting the tf_vault approle and the woodpecker_terraform_vault k8s role: catalog sudo on the plugin, and manage on rancher/{config,service-accounts,roles}.The path a policy lives should be the base of the paths inside the policy file. This is so when I enable code owners, a code owner of one file in their policy path like policy/foo/bar.yaml cannot grant themselves access to another path, like sys or approles
Addresses review: a policy's directory should be the base of the paths it grants, so a code owner of one policy path cannot grant themselves access elsewhere (e.g. sys or approle). - policies/rancher/admin.yaml now grants only rancher/{config,service-accounts, roles}. - Move the sudo-protected plugin-catalog grant to policies/sys/plugins/catalog/rancher.yaml (base path sys/plugins/catalog/), owned by a sys code owner.Fixed in
78a2052.policies/rancher/admin.yamlnow grants onlyrancher/{config,service-accounts,roles}. The sudo-protected plugin-catalog grant moved topolicies/sys/plugins/catalog/rancher.yaml(base pathsys/plugins/catalog/), so it is owned by asyscode owner and apolicies/rancher/owner cannot escalate outside the rancher mount.Note:
policies/gpg/admin.yamlstill carries itssys/plugins/catalog/secret/vault-plugin-secrets-gpggrant inline — happy to move that topolicies/sys/plugins/catalog/gpg.yamlin a follow-up if you want the same treatment there.