automates listing of keyfiles

ADP-179_sops_manage_keys
LeeW 11 months ago
parent ffca5846f4
commit a63b96fe2e

@ -3,6 +3,8 @@
set -euo pipefail set -euo pipefail
# sops.yaml doc: https://github.com/getsops/sops?tab=readme-ov-file#using-sops-yaml-conf-to-select-kms-pgp-and-age-for-new-files # sops.yaml doc: https://github.com/getsops/sops?tab=readme-ov-file#using-sops-yaml-conf-to-select-kms-pgp-and-age-for-new-files
sops_config=".sops.yaml"
function fn_extract_fpr(){ function fn_extract_fpr(){
gpgkeyfile=$1;shift; gpgkeyfile=$1;shift;
# fingerprint # fingerprint
@ -23,6 +25,7 @@ function fn_extract_uid(){
echo "${uid}" echo "${uid}"
} }
function fn_update_sops_config(){
# CAVEAT: dirty hacks, just get it done. Not DRY at all. # CAVEAT: dirty hacks, just get it done. Not DRY at all.
echo "# Fingerprint | User Type | User ID" echo "# Fingerprint | User Type | User ID"
@ -52,3 +55,6 @@ done
for gpgkeyfile in $(ls *gpg.pub | grep -v automation | tail -n 1); do for gpgkeyfile in $(ls *gpg.pub | grep -v automation | tail -n 1); do
echo " $(fn_extract_fpr "${gpgkeyfile}")" echo " $(fn_extract_fpr "${gpgkeyfile}")"
done done
}
(fn_update_sops_config) >> "${sops_config}"

Loading…
Cancel
Save