From 651b701896bc9c3d890896a5d34e61c5980e0f09 Mon Sep 17 00:00:00 2001 From: LeeW Date: Fri, 31 Jan 2025 13:59:00 +0100 Subject: [PATCH] phase1: update script --- bin/update_sops.sh | 9 +++++++-- example/cmd_sops.sh | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100755 example/cmd_sops.sh diff --git a/bin/update_sops.sh b/bin/update_sops.sh index 1325dc2..22e0ec2 100755 --- a/bin/update_sops.sh +++ b/bin/update_sops.sh @@ -3,6 +3,7 @@ set -euo pipefail sops_config=".sops.yaml" +secrets_file="${1:-0}" function fn_extract_fpr(){ gpgkeyfile=$1;shift; @@ -76,6 +77,10 @@ fn_verify_sops_config(){ # dump secrets, GPG_TTY src: https://www.varokas.com/secrets-in-code-with-mozilla-sops/ GPG_TTY=$(tty) sops -d "${sops_enc_file}" } -fn_verify_sops_config __mock_secrets.yaml +if [[ "${secrets_file}" != "0" ]]; then + fn_verify_sops_config "${secrets_file}" -echo "# SUCESS: all users with keys in this dir should have functional keys" + echo "# SUCESS: all users with keys in this dir should have functional keys" +else + echo "# WARN: no secrets file passed in, make sure to call 'sops updatekeys' on secrets files" +fi diff --git a/example/cmd_sops.sh b/example/cmd_sops.sh new file mode 100755 index 0000000..4748246 --- /dev/null +++ b/example/cmd_sops.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +cd "$( dirname "${BASH_SOURCE[0]}")" + +../bin/update_sops.sh