diff --git a/changelog/85.fixed.md b/changelog/85.fixed.md new file mode 100644 index 0000000..8895035 --- /dev/null +++ b/changelog/85.fixed.md @@ -0,0 +1 @@ +Change unseal query to be always unauthenticated. diff --git a/src/saltext/vault/runners/vault.py b/src/saltext/vault/runners/vault.py index 5c9382c..d4bb3b7 100644 --- a/src/saltext/vault/runners/vault.py +++ b/src/saltext/vault/runners/vault.py @@ -27,6 +27,7 @@ from saltext.vault.utils.vault import cache as vcache from saltext.vault.utils.vault import factory from saltext.vault.utils.vault import helpers +from saltext.vault.utils.vault.client import VaultClient from saltext.vault.utils.versions import warn_until log = logging.getLogger(__name__) @@ -547,8 +548,12 @@ def unseal(): salt-run vault.unseal """ + config = factory.parse_config(__opts__.get("vault", {})) + client = VaultClient(**config["server"], **config["client"]) + for key in __opts__["vault"]["keys"]: - ret = vault.query("POST", "sys/unseal", __opts__, __context__, payload={"key": key}) + ret = client.post("sys/unseal", payload={"key": key}) + # Return immediately after Vault is unsealed. No need to go over all the keys if ret["sealed"] is False: return True return False