diff options
author | Linus Nordberg <linus@nordu.net> | 2017-07-28 15:14:03 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2017-07-28 15:14:03 +0200 |
commit | 4223da5ae4d440774e350a8489b7d4bd0fe38c11 (patch) | |
tree | abf75b36f7b066f8dcf674fc8decb473c1585d15 /global/post-tasks.d/015cosmos-trust | |
parent | 883c92a407ad1db7925eec9bab483b06d12aa5a7 (diff) |
Update from sunet/multiverse.ct-ops-2017-07-28-v01
Diffstat (limited to 'global/post-tasks.d/015cosmos-trust')
-rwxr-xr-x | global/post-tasks.d/015cosmos-trust | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/global/post-tasks.d/015cosmos-trust b/global/post-tasks.d/015cosmos-trust index 447d875..74835e0 100755 --- a/global/post-tasks.d/015cosmos-trust +++ b/global/post-tasks.d/015cosmos-trust @@ -4,11 +4,19 @@ if [ -z "$COSMOS_KEYS" ]; then COSMOS_KEYS=/etc/cosmos/keys fi +# Install new keys discovered in the $COSMOS_KEYS directory for k in $COSMOS_KEYS/*.pub; do - fp=`cosmos gpg --with-colons --with-fingerprint < $k| awk -F: '$1 == "pub" {print $5}'` - cosmos gpg --with-colons --fingerprint | grep -q ":$fp:" || cosmos gpg --import < $k + fp=`cosmos gpg --with-colons --with-fingerprint < $k | awk -F: '$1 == "pub" {print $5}'` + fp_in_db=`cosmos gpg --with-colons --fingerprint | grep ":$fp:"` + if [ "x`echo $fp_in_db | grep '^pub:e:'`" != "x" ]; then + echo "$0: Key expired, will re-import it from $k" + cosmos gpg --fingerprint $fp + fi + # The removal of any ^pub:e: entrys means to ignore expired keys - thereby importing them again. + echo $fp_in_db | grep -v "^pub:e:" | grep -q ":$fp:" || cosmos gpg --import < $k done +# Delete keys no longer present in $COSMOS_KEYS directory for fp in `cosmos gpg --with-colons --fingerprint | awk -F: '$1 == "pub" {print $5}'`; do seen="no" for k in $COSMOS_KEYS/*.pub; do |