Skip to content

Instantly share code, notes, and snippets.

@vishalnayak
Last active May 12, 2018 02:43
Show Gist options
  • Save vishalnayak/3a030f0502aba3109abb05ca8c371cf9 to your computer and use it in GitHub Desktop.
Save vishalnayak/3a030f0502aba3109abb05ca8c371cf9 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -aex
initResult=$(vault operator init -format json -key-shares 1 -key-threshold 1)
unsealKey=$(echo -n $initResult | jq -r '.unseal_keys_b64[0]')
rootToken=$(echo -n $initResult | jq -r '.root_token')
# Store the unseal key and the root token for future use
echo -n $unsealKey > unsealKey
echo -n $rootToken > rootToken
vault operator unseal `cat unsealKey`
vault login `cat rootToken`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment