From 0bf2edd57c8017d94f2943bd0c45e71c1a1611d9 Mon Sep 17 00:00:00 2001 From: LeeW Date: Thu, 30 Jan 2025 17:36:42 +0100 Subject: [PATCH] automates creation+verification of sops config --- __update_sops.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/__update_sops.sh b/__update_sops.sh index b947a69..920ba87 100755 --- a/__update_sops.sh +++ b/__update_sops.sh @@ -65,14 +65,14 @@ fn_verify_sops_config(){ sops_enc_file="${1}";shift; # update keys in mock secret file # prereq: create a file with a mock secret, src: https://bash-org-archive.com/?244321 - test -e mock_secrets.yaml || (yq -n '.demo.credentials.secret = "hunter2"' > mock_secrets.yaml && sops -e -i mock_secrets.yaml ) + test -e "${sops_enc_file}" || (yq -n '.demo.credentials.secret = "hunter2"' > "${sops_enc_file}" && sops -e -i "${sops_enc_file}" ) # "update the keys of SOPS files using the config file" - sops updatekeys mock_secrets.yaml + sops updatekeys "${sops_enc_file}" # dump secrets, GPG_TTY src: https://www.varokas.com/secrets-in-code-with-mozilla-sops/ - GPG_TTY=$(tty) sops -d mock_secrets.yaml + GPG_TTY=$(tty) sops -d "${sops_enc_file}" } -fn_verify_sops_config +fn_verify_sops_config mock_secrets.yaml echo "# SUCESS: all users with keys in this dir should have functional keys"