diff options
| author | Igor Soarez <igor@soarez.org> | 2026-11-18 19:45:20 +0000 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-11-18 19:45:20 +0000 |
| commit | 03d7362fc8e4f97fbd78f5e71d9943029a943650 (patch) | |
| tree | 095102f8ea0b9dd614cbd46baf853b81bf048133 | |
| parent | b5c48c17923b61b792d08599f160e5de49d77931 (diff) | |
szecret: /usr/local/bin on PATH for the age plugins, which launchd's PATH lacks; enrol --se makes an age1tag1 key, which age encrypts to natively
| -rw-r--r-- | secrets/common.sh | 5 | ||||
| -rwxr-xr-x | secrets/enrol.sh | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/secrets/common.sh b/secrets/common.sh index b839cef..13fe749 100644 --- a/secrets/common.sh +++ b/secrets/common.sh @@ -183,6 +183,11 @@ get_local_private_key() { exists() { command -v "$1" >/dev/null 2>&1; } # Check if command exists (is in path). pathadd() { [[ -d "$1" ]] && PATH="$1"$(echo ":$PATH:" | sed "s|:$1:|:|" | sed 's|:$||'); } +# Where cloud-setup installs the age plugins (age-plugin-tpm, age-plugin-se), +# which age finds on PATH; launchd's default PATH leaves it out. +if [[ ":${PATH}:" != *":/usr/local/bin:"* ]]; then + pathadd /usr/local/bin || true +fi ensure_age() { if exists age ; then diff --git a/secrets/enrol.sh b/secrets/enrol.sh index 8174d6f..4bd87f3 100755 --- a/secrets/enrol.sh +++ b/secrets/enrol.sh @@ -60,9 +60,11 @@ case "${kind}" in ;; se) exists age-plugin-se || die "--se needs age-plugin-se, which is not installed; no key made" - (umask 077 && age-plugin-se keygen --access-control=none -o "${tmp}") \ - || die "age-plugin-se could not make a key (is there a Secure Enclave, and is the screen unlocked?); no key made" - pub="$(age-plugin-se recipients -i "${tmp}")" + # tag: an age1tag1 key, which age 1.3 encrypts to without the plugin, + # so the hosts that write this machine's buckets need none. + (umask 077 && age-plugin-se keygen --access-control=none --recipient-type=tag -o "${tmp}") \ + || die "age-plugin-se could not make a key (is there a Secure Enclave?); no key made" + pub="$(age-plugin-se recipients --recipient-type=tag -i "${tmp}")" ;; esac |
