1 From c6498dd5d5703887c8b45619879e1ec33fb771d4 Mon Sep 17 00:00:00 2001
2 From: Kristian Fiskerstrand <kf@sumptuouscapital.com>
3 Date: Wed, 18 Dec 2013 21:28:41 +0100
4 Subject: [PATCH] Add a sanity check that openpgp2ssh is working before
5 allowing update-users or keys-for-user to run. Failure of this can result in
6 a scenario where no keys are added even though they are otherwise valid.
9 src/monkeysphere-authentication | 11 +++++++++++
10 1 file changed, 11 insertions(+)
12 diff --git a/src/monkeysphere-authentication b/src/monkeysphere-authentication
13 index edc7995..d9f3f03 100755
14 --- a/src/monkeysphere-authentication
15 +++ b/src/monkeysphere-authentication
16 @@ -84,6 +84,15 @@ gpg_sphere() {
17 su_monkeysphere_user gpg --fixed-list-mode --no-greeting --quiet --no-tty "$@"
20 +check_openpgp2ssh_sanity()
22 + su_monkeysphere_user openpgp2ssh ABC &> /dev/null
23 + if [ "$?" != "255" ]; then
24 + echo "openpgp2ssh command gives unexpected return code. This can lead to a scenario where no authorized keys are populated, even though they are otherwise valid";
29 # output to stdout the core fingerprint from the gpg core secret
32 @@ -163,6 +172,7 @@ case $COMMAND in
33 'update-users'|'update-user'|'update'|'u')
34 source "${MASHAREDIR}/setup"
36 + check_openpgp2ssh_sanity
37 source "${MASHAREDIR}/update_users"
38 OUTPUT_STDOUT= update_users "$@"
40 @@ -171,6 +181,7 @@ case $COMMAND in
41 (( $# > 0 )) || failure "Must specify user."
42 source "${MASHAREDIR}/setup"
44 + check_openpgp2ssh_sanity
45 source "${MASHAREDIR}/update_users"
46 OUTPUT_STDOUT=true update_users "$1"