summaryrefslogtreecommitdiff
path: root/secrets/get-local.sh
diff options
context:
space:
mode:
authorIgor Soarez <igor@soarez.org>2026-11-18 14:02:09 +0000
committerIgor Soarez <igor@soarez.org>2026-11-18 14:02:09 +0000
commit8f818a64f2f0f3a833fc842d52a675358ec64c9c (patch)
treeeac13a48cada4595c9073d62060c1145189c6344 /secrets/get-local.sh
parent6444d6a508cdfdcf52cc6c83bab1e29a7e2a2e10 (diff)
szecret: buckets beside the old store -- get/has/put/mv/rekey/list/check/enrol, admins from SZECRET_ADMINS_COMMAND; rotate retired (fleet hardening 12)
A bucket is a directory of secrets with one set of readers: its recipients file plus the admins, the full set recorded in .szecret by rekey. put refuses when the readers or admins drift from that set, or with no admins; a plain put of a new name goes to admin-only, one still in the old store is rewritten there. The old store keeps working throughout. link/claude.sh leaves out an MCP server whose secret is in a bucket this host doesn't read. Design: cloud-setup docs/proposal-secret-roles.md.
Diffstat (limited to 'secrets/get-local.sh')
-rwxr-xr-xsecrets/get-local.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/secrets/get-local.sh b/secrets/get-local.sh
index 719a914..22f0cd9 100755
--- a/secrets/get-local.sh
+++ b/secrets/get-local.sh
@@ -7,7 +7,9 @@ if [[ "$#" -gt 0 && ("$1" == "-h" || "$1" == "--help") ]]; then
get-local: Retrieve and decrypt a secret from a localized store
Decrypts and outputs a secret value from a localized store. The store name
-is read from the .szecret metadata file in the file's directory.
+is read from the .szecret metadata file in the file's directory. A directory
+whose .szecret says kind=bucket is a repository bucket, read with this
+machine's own identity.
Usage:
get-local <file-path>
@@ -61,6 +63,14 @@ else
target_dir="$(dirname "${file_path}")"
metadata_file="${target_dir}/.szecret"
+ # A repository bucket: this machine's identity, if it is a reader.
+ if is_bucket_dir "${target_dir}"; then
+ [[ -r "${file_path}" ]] || die "File '${file_path}' not found or not readable"
+ is_reader "${target_dir}" || die "this machine isn't one of the readers of ${target_dir}"
+ decrypt "${file_path}"
+ exit 0
+ fi
+
if ! read_local_metadata "${metadata_file}"; then
>&2 echo "ERROR: No .szecret metadata in ${target_dir}"
>&2 echo "Run 'szecret create-local <store-name> ${target_dir}' first"