From 0e4f945e1ee134029954b0b1ab591942c3e5c437 Mon Sep 17 00:00:00 2001 From: Victor Date: Tue, 2 May 2023 09:42:01 +0200 Subject: [PATCH] minor cleanup --- README.md | 7 +++---- src/main.rs | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f64b699..aa2c84e 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,13 @@ # Vault Unsealer -This is a simple Rust program that automatically unseals a hashicorp vault instance. - | :exclamation: this method of unsealing the vault is not recommended if you have high security requirements! | |-----------------------------------------| +This is a simple Rust program that automatically unseals a hashicorp vault instance given a list of keys. ## Environment Variables | env var | default | description | -| ---------- | ------- | ----------- | +| ---------- | :-------: | ----------- | | VAULT_ADDR | - | address of the vault server | -| VAULT_KEY_FILE | - | json file containing vault unseal key(s), see [./example_keys.json](./example_keys.json) | +| VAULT_KEY_FILE | - | a JSON file containing vault unseal key(s), see [./example_keys.json](./example_keys.json). | | UNSEAL_INTERVAL | 15 | seconds to wait between checks / unseal attempts | diff --git a/src/main.rs b/src/main.rs index 9a0b185..ae1e26e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -54,6 +54,9 @@ fn is_sealed(health_url: &str) -> bool { } } +/// Unseals a vault given keys and url +/// +/// See: https://developer.hashicorp.com/vault/api-docs/system/unseal fn unseal(keyfile: &KeyFile, unseal_url: &str) { for key in keyfile.keys.iter() { match ureq::post(unseal_url).send_json(json!({ "key": key })) {