Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure vault.unseal runner is unauthenticated #86

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/85.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change unseal query to be always unauthenticated.
7 changes: 6 additions & 1 deletion src/saltext/vault/runners/vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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
Expand Down