automates creation+verification of sops config

ADP-179_sops_manage_keys
LeeW 11 months ago
parent 20c2a79808
commit 0bf2edd57c

@ -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"

Loading…
Cancel
Save