Skip to content

Commit a0cc958

Browse files
committed
Releasing 1.0.7
2 parents a0cce43 + 1dfc91f commit a0cc958

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@ how to create an `approle`. Here is the essence of it:
2323
# Enable the auth method for approle
2424
vault auth enable approle
2525
26+
# Create a renewal policy
27+
echo 'path "auth/token/*" { capabilities = [ "create", "read", "update", "delete", "list", "sudo" ] }' >renewal-policy.hcl
28+
vault policy write renewal-policy renewal-policy.hcl
29+
2630
# Create a file with your policy on the respective secret path:
2731
cat 'path "secret/my-secret" { capabilities = ["read", "list"] }' >app-policy.hcl
2832
2933
# Create the policy
3034
vault policy write my-app-policy app-policy.hcl
3135
32-
# Create the approle
33-
vault write auth/approle/role/my-approle secret_id_ttl=120m token_ttl=60m token_max_tll=120m policies="my-app-policy"
36+
# Create the approle with renewal-policy and your application policy
37+
vault write auth/approle/role/my-approle token_policies=renewal-policy,my-app-policy token_period=30m token_ttl=30m token_max_ttl=1h token_explicit_max_ttl=2h
3438
3539
# Get the role ID printed
3640
vault read auth/approle/role/my-approle/role-id
@@ -39,6 +43,8 @@ vault read auth/approle/role/my-approle/role-id
3943
vault write -f auth/approle/role/my-approle/secret-id
4044
```
4145

46+
Please notice that you need to recreate the secret ID whenever you change the application role or a policy.
47+
4248
# Examples
4349
## Create a HashicorpVault
4450
Please note that this vault is actually a client to an existing Hashicorp Vault.

src/TgVault/Secret.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ public function get($key) {
4242
return NULL;
4343
}
4444

45+
/**
46+
* Returns the keys that are available in this secret.
47+
* @return list of keys.
48+
*/
49+
public function keys() {
50+
return array_keys(get_object_vars($this->data));
51+
}
52+
4553
/**
4654
* Returns any metadata - if set - from the vault for this secret
4755
* @return mixed the metadata or NULL if not set

0 commit comments

Comments
 (0)