Giter Site home page Giter Site logo

vault-snapshot.sh's Introduction

             _ _                           _       _         _   
 _ _ ___ _ _| | |_ ___ ___ ___ ___ ___ ___| |_ ___| |_   ___| |_ 
| | | .'| | | |  _|___|_ -|   | .'| . |_ -|   | . |  _|_|_ -|   |
 \_/|__,|___|_|_|     |___|_|_|__,|  _|___|_|_|___|_| |_|___|_|_|
                                  |_|                            

Tool used to easily download self-hosted HashiCorp Vault
  snapshot which can be automated with a simple cronjob

Requirements: curl, jq

Vault cluster should be unsealed and on standby.

Configuration for vault-snapshot.sh is set with:
  /path/to/vault-snapshot.sh/config/vault-snapshot.cfg

You must have a token generated with storage/raft READ permissions.
  The token must be placed in /config/vault_token file.
  (Location can be modified in /config/vault-snapshot.cfg)

Usage:
  vault-snapshot.sh [<arguments>]
  vault-snapshot.sh -h | Help - Show this screen.
  vault-snapshot.sh -v | Verbose - Show [info] level output (Default is error only)
  vault-snapshot.sh -c | Check - Only check which Vault node is the master
  vault-snapshot.sh -g | Get - Only get vault snapshot without checking for master node.
                         NOT RECOMMENDED!
Examples:
  vault-snapshot.sh       | Tool fully ran, silent output unless error.
  vault-snapshot.sh -vc   | Verbose output while only checking for master node.
  vault-snapshot.sh -c    | Only master node checked, silent output unless error
  vault-snapshot.sh -vg   | Verbose output while only getting Vault snapshot.
                            NOT RECOMMENDED!
                            

Usage

  1. Install prerequisites
# Ubuntu/Debian
sudo apt install git curl jq
# CentOS/RHEL
sudo yum install epel-release -y # needed to install JQ package
sudo yum -y install git curl jq
# Fedora
sudo dnf -y install git curl jq
  1. Clone and navigate to this repository:
git clone https://github.com/Sidicer/vault-snapshot.sh.git
cd vault-snapshot.sh
  1. Add your Vault token (with /storage/ READ permissions):
echo "hcv.your-token" > config/vault_token
  1. Configure _VAULT_URL:
vim config/vault-snapshot.cfg
# Change _VAULT_URL= to match your cluster setup
# :wq
  1. Test vault-snapshot.sh:
bin/vault-snapshot.sh -v
  1. Automate snapshot creation (weekly):
crontab -l | { cat; echo "0 5 * * 7 /path/to/vault-snapshot.sh/bin/vault-snapshot.sh"; } | crontab -

vault-snapshot.sh's People

Contributors

sidicer avatar

Stargazers

Noil.lt avatar  avatar  avatar Tadas Malinauskas avatar Erikas Bulba avatar Tadas Gedgaudas avatar  avatar  avatar  avatar Ovidijus Balkauskas avatar Kostas avatar

Watchers

 avatar

Forkers

tadasgedgaudas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.