diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-07-26 03:57:17 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-07-26 03:57:33 +0000 |
commit | e7265143908a6a85f91306a14293fab2861efbd9 (patch) | |
tree | e27ee8e570d38d6280b095260a9fdd19e75da715 /libexec/container/key | |
parent | Releasing debian version 20210725-1. (diff) | |
download | open-infrastructure-compute-tools-e7265143908a6a85f91306a14293fab2861efbd9.tar.xz open-infrastructure-compute-tools-e7265143908a6a85f91306a14293fab2861efbd9.zip |
Merging upstream version 20210726.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libexec/container/key')
-rwxr-xr-x | libexec/container/key | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/libexec/container/key b/libexec/container/key index 5f76fb2..19b7fa9 100755 --- a/libexec/container/key +++ b/libexec/container/key @@ -76,7 +76,7 @@ Parameters () Usage () { - echo "Usage: ${PROGRAM} ${COMMAND} [-a|--add KEY] [-l|--list] [-r|--remove KEY]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} [-a|--add KEY_FILE|KEY_ID] [-l|--list] [-r|--remove KEY|KEY_ID]" >&2 exit 1 } @@ -87,6 +87,15 @@ then Usage fi +if [ ! -w "${KEYS}" ] +then + if [ "$(id -u)" -ne 0 ] + then + echo "'${COMMAND}': need root privileges (or write permissions to '${KEYS}')" >&2 + exit 1 + fi +fi + # Pre hooks for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}" do @@ -105,7 +114,7 @@ then chmod 0700 "${KEYS}" cat > "${KEYS}/gnupg.conf" << EOF -keyserver hkps://hkps.pool.sks-keyservers.net +keyserver hkps://keys.openpgp.org keyserver-options include-revoked keyserver-options no-honor-keyserver-url @@ -131,7 +140,18 @@ fi case "${ACTION}" in add) - gpg --homedir "${KEYS}" --import "${ADD}" + if [ -e "${ADD}" ] + then + gpg --homedir "${KEYS}" --import "${ADD}" + elif [ -e "/usr/share/compute-tools/keys/${ADD}" ] + then + gpg --homedir "${KEYS}" --import "/usr/share/compute-tools/keys/${ADD}" + elif [ -e "/usr/share/compute-tools/keys/${ADD}.pub" ] + then + gpg --homedir "${KEYS}" --import "/usr/share/compute-tools/keys/${ADD}.pub" + else + gpg --homedir "${KEYS}" --recv "${ADD}" + fi ;; list) |