vault hashicorp cheat sheet

Solutions on MaxInterview for vault hashicorp cheat sheet by the best coders in the world

showing results for - "vault hashicorp cheat sheet"
Marta
15 Aug 2019
1Vault sheet
Iban
20 Apr 2018
1#Change Default and Max TTL's in system which is 32 days
2  $ vault write sys/mounts/auth/token/tune default_lease_ttl=6m max_lease_ttl=24h
3
Lucia
23 Jan 2017
1#Enabling and Disabling Auth Methods
2
3  $ vault auth enable userpass
4  $ vault auth list
5  $ vault auth list -detailed
6  $ vault auth enable -path=my-login userpass
7  $ vault write sys/auth/my-auth type=userpass
8#Check
9  $ vault read sys/auth/
10  $ vault read sys/mounts/auth/token/tune
11  $ vault path-help auth/my-auth
12
13#Creation/Lookup a token
14
15  $ vault token create
16  $ vault token create -format=json -policy="admin"
17  $ vault token lookup <TOKEN-ID>
18
19#Create a token with use limit 
20  $ vault token create -policy=default -use-limit=2
21#Create periodic token with period of 24h
22  $ vault write auth/token/roles/zabbix allowed_policies="default" period="24h"
23  $ vault token create -role=zabbix
24
25#Accessor token check
26  $ vault list auth/token/accessors
27  $ vault token lookup -accessor <TOKEN-ID>
28
29#Login/Revoke/Renew with the new token
30
31  $ vault login <TOKENID>
32  $ vault login $VAULT_TOKEN
33  $ vault token revoke <TOKENID>
34  $ vault token renew <token>
35  $ vault token renew -increment=<EXTENSION> <TOKEN>
36
37#Token Capabilities
38    
39  $ vault token capabilities <TOKEN_ID> <PATH>
40
41#login using the different auth method
42  
43  $ vault login -method=<auth-method> token=<TOKEN_ID>
44  
45#Write Policy for different auth-Methods.
46
47  $ vault policy write <POLICY_NAME> <POLICY_FILE_PATH_WITH .HCL_EXTENSION>
48
49#List all enabled policies:
50
51  $ vault policy list
52        
53#Delete the policy named my-policy:
54
55  $ vault policy delete my-policy
56
57#Read the policy
58  
59  $ vault policy read <POLICY_NAME>
60
61#Wrapping the password like secret-id in approle method
62  $ vault write -wrap-ttl=60s -f auth/approle/role/jenkins/secret-id
63
64#Generating Orphan Tokens
65  $  vault token create -orphan
66
67/*Creation of the batch tokens. Notice that the token value is much longer than the service tokens. 
68This is because batch tokens are encrypted by the Vault's barrier*/
69  $  vault token create -type=batch -policy="test"
70
Gabriele
28 Feb 2019
1#Get the Token Count
2  $ vault read sys/internal/counters/tokens