|
|
|
|
@ -162,6 +162,19 @@ EOM
|
|
|
|
|
echo " ${fpr_list[${ind_2nd_last}]}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn_sops_updatekeys_and_verify(){
|
|
|
|
|
# call 'sops updatekeys' and dump contents of file so end user can visually verify functionality
|
|
|
|
|
sops_enc_file="${1}";shift;
|
|
|
|
|
# update keys in secrets file
|
|
|
|
|
test -e "${sops_enc_file}" || exit 1
|
|
|
|
|
|
|
|
|
|
# "update the keys of SOPS files using the config file"
|
|
|
|
|
sops updatekeys "${sops_enc_file}"
|
|
|
|
|
|
|
|
|
|
# verify: dump secrets, GPG_TTY src: https://www.varokas.com/secrets-in-code-with-mozilla-sops/
|
|
|
|
|
GPG_TTY=$(tty) sops -d "${sops_enc_file}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# BEGIN
|
|
|
|
|
if [[ "${opt_list_roles}" -eq 1 ]]; then
|
|
|
|
|
# list available roles and exit
|
|
|
|
|
@ -186,17 +199,6 @@ pushd "${keyfiles_dir}" > /dev/null 2>&1
|
|
|
|
|
popd > /dev/null 2>&1
|
|
|
|
|
|
|
|
|
|
# VERIFY
|
|
|
|
|
fn_sops_updatekeys_and_verify(){
|
|
|
|
|
sops_enc_file="${1}";shift;
|
|
|
|
|
# update keys in secrets file
|
|
|
|
|
test -e "${sops_enc_file}" || exit 1
|
|
|
|
|
|
|
|
|
|
# "update the keys of SOPS files using the config file"
|
|
|
|
|
sops updatekeys "${sops_enc_file}"
|
|
|
|
|
|
|
|
|
|
# verify: dump secrets, GPG_TTY src: https://www.varokas.com/secrets-in-code-with-mozilla-sops/
|
|
|
|
|
GPG_TTY=$(tty) sops -d "${sops_enc_file}"
|
|
|
|
|
}
|
|
|
|
|
if [[ "${#secrets_file_list[@]}" != "0" ]]; then
|
|
|
|
|
for secrets_file in "${secrets_file_list[@]}"; do
|
|
|
|
|
fn_sops_updatekeys_and_verify "${secrets_file}"
|
|
|
|
|
|