|
|
|
@ -69,20 +69,19 @@ pushd "${keyfiles_dir}" > /dev/null 2>&1
|
|
|
|
popd > /dev/null 2>&1
|
|
|
|
popd > /dev/null 2>&1
|
|
|
|
|
|
|
|
|
|
|
|
# VERIFY
|
|
|
|
# VERIFY
|
|
|
|
fn_verify_sops_config(){
|
|
|
|
fn_sops_updatekeys_and_verify(){
|
|
|
|
sops_enc_file="${1}";shift;
|
|
|
|
sops_enc_file="${1}";shift;
|
|
|
|
# update keys in mock secret file
|
|
|
|
# update keys in secrets file
|
|
|
|
# prereq: create a file with a mock secret, src: https://bash-org-archive.com/?244321
|
|
|
|
test -e "${sops_enc_file}" || exit 1
|
|
|
|
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"
|
|
|
|
# "update the keys of SOPS files using the config file"
|
|
|
|
sops updatekeys "${sops_enc_file}"
|
|
|
|
sops updatekeys "${sops_enc_file}"
|
|
|
|
|
|
|
|
|
|
|
|
# dump secrets, GPG_TTY src: https://www.varokas.com/secrets-in-code-with-mozilla-sops/
|
|
|
|
# verify: dump secrets, GPG_TTY src: https://www.varokas.com/secrets-in-code-with-mozilla-sops/
|
|
|
|
GPG_TTY=$(tty) sops -d "${sops_enc_file}"
|
|
|
|
GPG_TTY=$(tty) sops -d "${sops_enc_file}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if [[ "${secrets_file}" != "0" ]]; then
|
|
|
|
if [[ "${secrets_file}" != "0" ]]; then
|
|
|
|
fn_verify_sops_config "${secrets_file}"
|
|
|
|
fn_sops_updatekeys_and_verify "${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
|
|
|
|
else
|
|
|
|
echo "# WARN: no secrets file passed in, make sure to call 'sops updatekeys' on secrets files"
|
|
|
|
echo "# WARN: no secrets file passed in, make sure to call 'sops updatekeys' on secrets files"
|
|
|
|
|