File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ # Vault Backup  
2+ 
3+ :warning :  Check [ the oficial way] ( https://learn.hashicorp.com/tutorials/vault/sop-backup )  to backup your HashiCorp Vault.
4+ 
5+ Create a backup file of all HashiCorp Vault kv2 secrets.
6+ 
7+ ``` bash 
8+ ./vault-backup -help
9+   -base64
10+         encode secret value as base64
11+   -filename string
12+         output filename (default " vault.backup" 
13+   -help
14+         show this help  output
15+   -output string
16+         output format. one of: json| yaml| kv (default " json" 
17+   -paths string
18+         comma-separated base path. must end with /
19+ ``` 
20+ 
21+ Some environment variables must be defined before execution:
22+ 
23+ *  ` VAULT_TOKEN ` : is required, retrieve one by running ` vault login ` ;
24+ *  ` VAULT_ADDR ` : default value is ` http://127.0.0.1:8200 ` 
25+ 
26+ ## Example  
27+ 
28+ ``` bash 
29+ ./vault-backup -base64 -filename my-vault.backup
30+ 
31+ 2021/11/03 23:13:42 - reading production/app1/database
32+ 2021/11/03 23:13:42 - reading production/app1/cache
33+ 2021/11/03 23:13:43 - reading production/app2/database
34+ 2021/11/03 23:13:44 done!  ; )
35+ ``` 
36+ 
37+ Backup file
38+ 
39+ ``` json 
40+ {
41+   "secret/data/production/app1/database/user" : " dmF1bHQtYmFja3VwCg==" 
42+   "secret/data/production/app1/database/password" : " czNjcjN0Cg==" 
43+   "secret/data/production/app1/cache/token" : " czNjcjN0X19Ub2tlbgo=" 
44+   "secret/data/production/app2/database/user" : " dmF1bHQtYmFja3VwCg==" 
45+   "secret/data/production/app2/database/password" : " czNjcjN0Cg==" 
46+ }
47+ ``` 
48+ 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments