vault-dump-restore
Dumps keys from a Hashicorp instance into a file, to be able to restore it later in any other instance. Remember to encrypt the file!
This only supports reading a kv2 engine. Also note that these dumps and restores are meant to be used very rarely and under emergency situations since this kind of defeats the purpose of having a vault (storing secrets inside a vault, sealed with a key, etc) - you're dumping all the secrets to a external file!
The following examples use gpg commands to encrypt/decrypt the files.
Example for dump:
# make sure you have the vault environment variables:
export VAULT_ADDR=https://<vault-addr>
export VAULT_TOKEN=<vault-token>
# dumps the entire vault kv secrets in a shell script (vault commands)
vault-dump -o vault vault -o | gpg --symmetric --cipher-algo AES256 > vault-backup.sh.enc
# dumps a specific path with the default json format
vault-dump -p secrets/specific-app | gpg --symmetric --cipher-algo AES256 > vault-backup.json.enc
Examples for restore:
# make sure you have the vault environment variables:
export VAULT_ADDR=https://<vault-addr>
export VAULT_TOKEN=<vault-token>
# you will also must have the secret engine created
vault secrets enable -path=secrets kv
# restore a full dump using the shell script format
. <(gpg -qd vault-backup.sh.enc)
# restore a full dump using the JSON format
gpg -qd vault-backup.json.enc | vault-restore -
# restore a specific path using the JSON format
gpg -qd vault-backup.json.enc | vault-restore -p secrets/specific-app -
Installation and usage
Installation can be done through pip:
pip install vault-dump-restore
Use the -h parameter to get help from the commands:
vault-dump -h
vault-restore -h
Contents
Setup and usage for local development
Make a virtual environment:
python3 -m venv venv
source venv/bin/activate
pip install -e .
Note that this will also install the local dependencies, which might change after
some time. If needed, you can run pip install -e . again to reinstall the
updated dependencies anytime.
Documentation build
Run:
make docs
HTML documentation will be generated at docs/_build/html.
Metadata
Release files for vault-dump-restore 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vault-dump-restore-0.5.1.tar.gz | 21.0 kB | Without provenance | Details for vault-dump-restore-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vault_dump_restore-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for vault_dump_restore-0.5.1-py3-none-any.whl |
Total release size: 42.2 kB
Release files / vault-dump-restore-0.5.1.tar.gz
| Download URL | vault-dump-restore-0.5.1.tar.gz |
|---|---|
| Size | 21.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c5f376b329e708ece10385d5ae0eab93583dc3cde36644bd31c77cf98ee7acb9
|
|
BLAKE2b-256 checksum How to use checksums |
a1e0f4cd6e66060a1369f0cfcfbea7af7d02138da1f415ee86202323639f4b32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10
|
Release files / vault_dump_restore-0.5.1-py3-none-any.whl
| Download URL | vault_dump_restore-0.5.1-py3-none-any.whl |
|---|---|
| Size | 21.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
16fc9552c6afff952df3b3dd68dc0cfee508fb80e3156f58d1b86adf58e93412
|
|
BLAKE2b-256 checksum How to use checksums |
93d54695da3b2787f56d5c250fb2722ca5b1f8e1aad9ecbeacc011c2dce32906
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10
|
Security for vault-dump-restore 0.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.