diff options
Diffstat (limited to 'src/subcommands/ma')
-rw-r--r-- | src/subcommands/ma/add-certifier | 14 | ||||
-rw-r--r-- | src/subcommands/ma/list-certifiers | 4 | ||||
-rw-r--r-- | src/subcommands/ma/remove-certifier | 8 | ||||
-rw-r--r-- | src/subcommands/ma/update-users | 22 |
4 files changed, 28 insertions, 20 deletions
diff --git a/src/subcommands/ma/add-certifier b/src/subcommands/ma/add-certifier index 9ad0515..0c3c647 100644 --- a/src/subcommands/ma/add-certifier +++ b/src/subcommands/ma/add-certifier @@ -60,7 +60,7 @@ if [ -z "$keyID" ] ; then fi if [ -f "$keyID" ] ; then echo "Reading key from file '$keyID':" - importinfo=$(gpg_authentication "--import" < "$keyID" 2>&1) || failure "could not read key from '$keyID'" + importinfo=$(gpg_sphere "--import" < "$keyID" 2>&1) || failure "could not read key from '$keyID'" # FIXME: if this is tried when the key database is not # up-to-date, i got these errors (using set -x): @@ -83,13 +83,13 @@ if [ -f "$keyID" ] ; then fi else # get the key from the key server - gpg_authentication "--keyserver $KEYSERVER --recv-key '0x${keyID}!'" || failure "Could not receive a key with this ID from the '$KEYSERVER' keyserver." + gpg_sphere "--keyserver $KEYSERVER --recv-key '0x${keyID}!'" || failure "Could not receive a key with this ID from the '$KEYSERVER' keyserver." fi export keyID # get the full fingerprint of a key ID -fingerprint=$(gpg_authentication "--list-key --with-colons --with-fingerprint 0x${keyID}!" | \ +fingerprint=$(gpg_sphere "--list-key --with-colons --with-fingerprint 0x${keyID}!" | \ grep '^fpr:' | grep "$keyID" | cut -d: -f10) if [ -z "$fingerprint" ] ; then @@ -98,7 +98,7 @@ fi echo echo "key found:" -gpg_authentication "--fingerprint 0x${fingerprint}!" +gpg_sphere "--fingerprint 0x${fingerprint}!" echo "Are you sure you want to add the above key as a" read -p "certifier of users on this system? (y/N) " OK; OK=${OK:-N} @@ -107,7 +107,7 @@ if [ "${OK/y/Y}" != 'Y' ] ; then fi # export the key to the host keyring -gpg_authentication "--export 0x${fingerprint}!" | gpg_host --import +gpg_sphere "--export 0x${fingerprint}!" | gpg_core --import if [ "$trust" = marginal ]; then trustval=1 @@ -132,10 +132,10 @@ EOF # ltsign the key if echo "$ltsignCommand" | \ - gpg_host --quiet --command-fd 0 --edit-key "0x${fingerprint}!" ; then + gpg_core --quiet --command-fd 0 --edit-key "0x${fingerprint}!" ; then # update the trustdb for the authentication keyring - gpg_authentication "--check-trustdb" + gpg_sphere "--check-trustdb" echo echo "Identity certifier added." diff --git a/src/subcommands/ma/list-certifiers b/src/subcommands/ma/list-certifiers index 83f7786..e37485e 100644 --- a/src/subcommands/ma/list-certifiers +++ b/src/subcommands/ma/list-certifiers @@ -19,12 +19,12 @@ local keys local key # find trusted keys in authentication keychain -keys=$(gpg_authentication "--no-options --list-options show-uid-validity --keyring ${GNUPGHOME_AUTHENTICATION}/pubring.gpg --list-keys --with-colons --fingerprint" | \ +keys=$(gpg_sphere "--no-options --list-options show-uid-validity --keyring ${GNUPGHOME_AUTHENTICATION}/pubring.gpg --list-keys --with-colons --fingerprint" | \ grep ^pub: | cut -d: -f2,5 | egrep '^(u|f):' | cut -d: -f2) # output keys for key in $keys ; do - gpg_authentication "--no-options --list-options show-uid-validity --keyring ${GNUPGHOME_AUTHENTICATION}/pubring.gpg --list-key --fingerprint $key" + gpg_sphere "--no-options --list-options show-uid-validity --keyring ${GNUPGHOME_AUTHENTICATION}/pubring.gpg --list-key --fingerprint $key" done } diff --git a/src/subcommands/ma/remove-certifier b/src/subcommands/ma/remove-certifier index 59d3f0c..560281d 100644 --- a/src/subcommands/ma/remove-certifier +++ b/src/subcommands/ma/remove-certifier @@ -23,7 +23,7 @@ if [ -z "$keyID" ] ; then failure "You must specify the key ID of a key to remove." fi -if gpg_authentication "--no-options --list-options show-uid-validity --keyring ${GNUPGHOME_AUTHENTICATION}/pubring.gpg --list-key 0x${keyID}!" ; then +if gpg_sphere "--no-options --list-options show-uid-validity --keyring ${GNUPGHOME_AUTHENTICATION}/pubring.gpg --list-key 0x${keyID}!" ; then read -p "Really remove above listed identity certifier? (y/N) " OK; OK=${OK:-N} if [ "${OK/y/Y}" != 'Y' ] ; then failure "Identity certifier not removed." @@ -33,12 +33,12 @@ else fi # delete the requested key -if gpg_authentication "--delete-key --batch --yes 0x${keyID}!" ; then +if gpg_sphere "--delete-key --batch --yes 0x${keyID}!" ; then # delete key from host keyring as well - gpg_host --delete-key --batch --yes "0x${keyID}!" + gpg_core --delete-key --batch --yes "0x${keyID}!" # update the trustdb for the authentication keyring - gpg_authentication "--check-trustdb" + gpg_sphere "--check-trustdb" echo echo "Identity certifier removed." diff --git a/src/subcommands/ma/update-users b/src/subcommands/ma/update-users index 0335e31..73685f6 100644 --- a/src/subcommands/ma/update-users +++ b/src/subcommands/ma/update-users @@ -13,6 +13,11 @@ update_users() { +local unames +local uname +local authorizedKeysDir +local authorizedUserIDs + if [ "$1" ] ; then # get users from command line unames="$@" @@ -21,13 +26,16 @@ else unames=$(getent passwd | cut -d: -f1) fi -RETCODE=0 +RETURN=0 # set mode MODE="authorized_keys" # set gnupg home -GNUPGHOME="$GNUPGHOME_AUTHENTICATION" +GNUPGHOME="$GNUPGHOME_SPHERE" + +# the authorized_keys directory +authorizedKeysDir="${SYSDATADIR}/authentication/authorized_keys" # check to see if the gpg trust database has been initialized if [ ! -s "${GNUPGHOME}/trustdb.gpg" ] ; then @@ -35,7 +43,7 @@ if [ ! -s "${GNUPGHOME}/trustdb.gpg" ] ; then fi # make sure the authorized_keys directory exists -mkdir -p "${SYSDATADIR}/authorized_keys" +mkdir -p "${authorizedKeysDir}" # loop over users for uname in $unames ; do @@ -48,7 +56,7 @@ for uname in $unames ; do log verbose "----- user: $uname -----" # make temporary directory - TMPLOC=$(mktemp -d ${MSTMPDIR}/tmp.XXXXXXXXXX) || failure "Could not create temporary directory!" + TMPLOC=$(mktemp -d ${MATMPDIR}/tmp.XXXXXXXXXX) || failure "Could not create temporary directory!" # trap to delete temporary directory on exit trap "rm -rf $TMPLOC" EXIT @@ -128,15 +136,15 @@ for uname in $unames ; do chown $(whoami) "$AUTHORIZED_KEYS" && \ chgrp $(id -g "$uname") "$AUTHORIZED_KEYS" && \ chmod g+r "$AUTHORIZED_KEYS" && \ - mv -f "$AUTHORIZED_KEYS" "${SYSDATADIR}/authorized_keys/${uname}" || \ + mv -f "$AUTHORIZED_KEYS" "${authorizedKeysDir}/${uname}" || \ { log error "Failed to install authorized_keys for '$uname'!" - rm -f "${SYSDATADIR}/authorized_keys/${uname}" + rm -f "${authorizedKeysDir}/${uname}" # indicate that there has been a failure: RETURN=1 } else - rm -f "${SYSDATADIR}/authorized_keys/${uname}" + rm -f "${authorizedKeysDir}/${uname}" fi # unset the trap |