summaryrefslogtreecommitdiff
path: root/src/subcommands
diff options
context:
space:
mode:
Diffstat (limited to 'src/subcommands')
-rwxr-xr-xsrc/subcommands/ma/add-certifier14
-rwxr-xr-xsrc/subcommands/ma/list-certifiers4
-rwxr-xr-xsrc/subcommands/ma/remove-certifier8
-rwxr-xr-xsrc/subcommands/ma/update-users22
-rwxr-xr-xsrc/subcommands/mh/publish-key4
5 files changed, 31 insertions, 21 deletions
diff --git a/src/subcommands/ma/add-certifier b/src/subcommands/ma/add-certifier
index 451506d..0484228 100755
--- a/src/subcommands/ma/add-certifier
+++ b/src/subcommands/ma/add-certifier
@@ -59,7 +59,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):
@@ -82,13 +82,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
@@ -97,7 +97,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}
@@ -106,7 +106,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
@@ -131,10 +131,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 e920888..26989c6 100755
--- a/src/subcommands/ma/list-certifiers
+++ b/src/subcommands/ma/list-certifiers
@@ -18,12 +18,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 117bad4..2100b2d 100755
--- a/src/subcommands/ma/remove-certifier
+++ b/src/subcommands/ma/remove-certifier
@@ -22,7 +22,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."
@@ -32,12 +32,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 0861364..d3a72dc 100755
--- a/src/subcommands/ma/update-users
+++ b/src/subcommands/ma/update-users
@@ -12,6 +12,11 @@
update_users() {
+local unames
+local uname
+local authorizedKeysDir
+local authorizedUserIDs
+
if [ "$1" ] ; then
# get users from command line
unames="$@"
@@ -20,13 +25,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
@@ -34,7 +42,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
@@ -47,7 +55,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
@@ -127,15 +135,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
diff --git a/src/subcommands/mh/publish-key b/src/subcommands/mh/publish-key
index 8b36a18..7baefc4 100755
--- a/src/subcommands/mh/publish-key
+++ b/src/subcommands/mh/publish-key
@@ -23,6 +23,8 @@ fi
fingerprint=$(fingerprint_server_key)
# publish host key
-gpg_authentication "--keyserver $KEYSERVER --send-keys '0x${fingerprint}!'"
+# FIXME: need to define how to do this
+#gpg_authentication "--keyserver $KEYSERVER --send-keys '0x${fingerprint}!'"
+echo "not published!!!"
}