Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3763128
D3355.id8771.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D3355.id8771.diff
View Options
diff --git a/roles/vault/bootstrap/files/vault-initialize.sh b/roles/vault/bootstrap/files/vault-initialize.sh
--- a/roles/vault/bootstrap/files/vault-initialize.sh
+++ b/roles/vault/bootstrap/files/vault-initialize.sh
@@ -34,6 +34,12 @@
VAULT_CERTS_PATH=/usr/local/etc/certificates/vault
+# -------------------------------------------------------------
+# Authentication :: token roles
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+vault write auth/token/roles/admin allowed_policies=admin period=30d
+
# -------------------------------------------------------------
# PKI :: root CA
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/roles/vault/policies/files/salt-primary.hcl b/roles/vault/policies/files/salt-primary.hcl
--- a/roles/vault/policies/files/salt-primary.hcl
+++ b/roles/vault/policies/files/salt-primary.hcl
@@ -37,6 +37,7 @@
# Tokens management
#
# :: Create, check, revoke tokens to be used by nodes through Salt
+# :: Create admin token as self-service for ops members
# :: Manage and renew own token
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -48,6 +49,14 @@
capabilities = ["read"]
}
+path "auth/token/create/admin" {
+ capabilities = ["create", "update"]
+}
+
+path "auth/token/roles/admin" {
+ capabilities = ["read"]
+}
+
path "auth/token/lookup-self" {
capabilities = ["read"]
}
diff --git a/utils/vault/issue-admin-token.py b/utils/vault/issue-admin-token.py
--- a/utils/vault/issue-admin-token.py
+++ b/utils/vault/issue-admin-token.py
@@ -48,7 +48,7 @@
def run(verify):
client = connect_to_vault(verify)
- token = client.auth.token.create(policies=["admin"], ttl="30d")
+ token = client.auth.token.create(role_name="admin", policies=["admin"], ttl="30d")
print(token["auth"]["client_token"])
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 20:52 (18 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2256335
Default Alt Text
D3355.id8771.diff (1 KB)
Attached To
Mode
D3355: Allow Salt policy to create admin-level tokens
Attached
Detach File
Event Timeline
Log In to Comment