From 0cc9a8f041a9b9b97e7f5f24f71a92961e54c4f2 Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Thu, 12 Feb 2009 13:29:30 -0500 Subject: clean up how trust level was check in ma/setup, with some debug output --- src/share/ma/setup | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/share/ma/setup') diff --git a/src/share/ma/setup b/src/share/ma/setup index 034f047..894db84 100644 --- a/src/share/ma/setup +++ b/src/share/ma/setup @@ -85,7 +85,10 @@ EOF # our preferences are reasonable (i.e. 3 marginal OR 1 fully # trusted certifications are sufficient to grant full validity. log debug "check trust level of core key..." - if [ "1:3:1" != $(gpg_sphere --with-colons --fixed-list-mode --list-keys | head -n1 | grep ^tru: cut -f3,6,7 -d:) ] ; then + local TRUST_LEVEL=$(gpg_sphere --with-colons --fixed-list-mode --list-keys \ + | head -n1 | grep "^tru:" | cut -d: -f3,6,7) + log debug "trust level: $TRUST_LEVEL" + if [ "$TRUST_LEVEL" != '1:3:1' ] ; then failure "monkeysphere-authentication does not have the expected trust model settings." fi } -- cgit v1.2.3 From 07316c65eb5302a1d5385301876be7971e26fd1f Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Thu, 12 Feb 2009 16:17:00 -0500 Subject: fix reference to MONKEYSPHER_USER in ma/setup --- src/monkeysphere-host | 3 +++ src/share/ma/setup | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/share/ma/setup') diff --git a/src/monkeysphere-host b/src/monkeysphere-host index 4aab995..f79c2bb 100755 --- a/src/monkeysphere-host +++ b/src/monkeysphere-host @@ -123,6 +123,9 @@ create_gpg_pub_file() { # load the host fingerprint into the fingerprint variable, using the # export gpg pub key file +# FIXME: this seems much less than ideal, with all this temp keyring +# stuff. is there a way we can do this without having to create temp +# files? load_fingerprint() { if [ -f "$HOST_KEY_PUB_GPG" ] ; then HOST_FINGERPRINT=$( \ diff --git a/src/share/ma/setup b/src/share/ma/setup index 894db84..0cd92e0 100644 --- a/src/share/ma/setup +++ b/src/share/ma/setup @@ -40,10 +40,10 @@ primary-keyring ${GNUPGHOME_SPHERE}/pubring.gpg list-options show-uid-validity EOF - # make sure the monkeysphere user owns everything in th sphere + # make sure the monkeysphere user owns everything in the sphere # gnupghome - chown -R "$MONKEYPSHER_USER" "${GNUPGHOME_SPHERE}" - chgrp -R "$MONKEYPSHER_USER" "${GNUPGHOME_SPHERE}" + chown -R "$MONKEYPSHERE_USER" "${GNUPGHOME_SPHERE}" + chgrp -R "$MONKEYPSHERE_USER" "${GNUPGHOME_SPHERE}" # get fingerprint of core key. this should be empty on unconfigured systems. local CORE_FPR=$(gpg_core --with-colons --fixed-list-mode --fingerprint --list-secret-key | grep ^fpr: | cut -f10 -d: ) -- cgit v1.2.3 From f54abea9da2be063b0d0ed974f6130b303b2a1c7 Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Thu, 12 Feb 2009 18:19:35 -0500 Subject: Fix the ma/setup function: - fix reference to MONKEYSPHERE_USER for GNUPGHOME_SPHERE - break out core_fingerprint function - export core key to sphere keyring (necessary) - fix some logging (add more debug) and formatting --- src/monkeysphere-authentication | 19 ++++++++++++------- src/share/ma/setup | 35 ++++++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 18 deletions(-) (limited to 'src/share/ma/setup') diff --git a/src/monkeysphere-authentication b/src/monkeysphere-authentication index 6d2e72c..a33de1e 100755 --- a/src/monkeysphere-authentication +++ b/src/monkeysphere-authentication @@ -75,17 +75,12 @@ gpg_core() { GNUPGHOME="$GNUPGHOME_CORE" export GNUPGHOME - # NOTE: we supress this warning because we need the monkeysphere - # user to be able to read the host pubring. we realize this might - # be problematic, but it's the simplest solution, without too much - # loss of security. gpg "$@" } # function to interact with the gpg sphere keyring -# FIXME: this function requires basically accepts only a single -# argument because of problems with quote expansion. this needs to be -# fixed/improved. +# FIXME: this function requires only a single argument because of +# problems with quote expansion. this needs to be fixed/improved. gpg_sphere() { GNUPGHOME="$GNUPGHOME_SPHERE" export GNUPGHOME @@ -93,8 +88,18 @@ gpg_sphere() { su_monkeysphere_user "gpg $@" } +# load the core fingerprint into the fingerprint variable, using the +# gpg host secret key +core_fingerprint() { + log debug "determining core key fingerprint..." + gpg_core --quiet --list-secret-key \ + --with-colons --fixed-list-mode --with-fingerprint \ + | grep ^fpr: | cut -d: -f10 +} + # export signatures from core to sphere gpg_core_sphere_sig_transfer() { + log debug "exporting core local sigs to sphere..." gpg_core --export-options export-local-sigs --export | \ gpg_sphere --import-options import-local-sigs --import } diff --git a/src/share/ma/setup b/src/share/ma/setup index 0cd92e0..5960ab4 100644 --- a/src/share/ma/setup +++ b/src/share/ma/setup @@ -23,6 +23,7 @@ setup() { # deliberately replace the config files via truncation # FIXME: should we be dumping to tmp files and then moving atomically? + log debug "write core gpg.conf..." cat >"${GNUPGHOME_CORE}"/gpg.conf <"${GNUPGHOME_SPHERE}"/gpg.conf < Date: Thu, 12 Feb 2009 18:30:38 -0500 Subject: fix typo --- src/share/ma/setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/share/ma/setup') diff --git a/src/share/ma/setup b/src/share/ma/setup index 5960ab4..533e6a1 100644 --- a/src/share/ma/setup +++ b/src/share/ma/setup @@ -44,7 +44,7 @@ EOF # make sure the monkeysphere user owns everything in the sphere # gnupghome - log debuf "fix sphere gnupg home ownership..." + log debug "fix sphere gnupg home ownership..." chown -R "$MONKEYSPHERE_USER" "${GNUPGHOME_SPHERE}" chgrp -R "$MONKEYSPHERE_USER" "${GNUPGHOME_SPHERE}" -- cgit v1.2.3 From 5d6d207f7c1ad3e4545484fbab84ce25ef756ea0 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Thu, 12 Feb 2009 18:32:32 -0500 Subject: no longer require the primary-keyring for the sphere gpg.conf now that we use a single keyring --- src/share/ma/setup | 1 - 1 file changed, 1 deletion(-) (limited to 'src/share/ma/setup') diff --git a/src/share/ma/setup b/src/share/ma/setup index 533e6a1..09c356c 100644 --- a/src/share/ma/setup +++ b/src/share/ma/setup @@ -38,7 +38,6 @@ EOF # This file is maintained by the Monkeysphere software. # Edits will be overwritten. no-greeting -primary-keyring ${GNUPGHOME_SPHERE}/pubring.gpg list-options show-uid-validity EOF -- cgit v1.2.3 From 65e8a49c924eac3c46c93cb4bb9be9c739a58983 Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Thu, 12 Feb 2009 18:39:38 -0500 Subject: tweak some of the log output inconsequentially --- src/share/ma/setup | 12 ++++++------ src/share/mh/set_expire | 3 +++ tests/basic | 1 - 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/share/ma/setup') diff --git a/src/share/ma/setup b/src/share/ma/setup index 5960ab4..e5109fd 100644 --- a/src/share/ma/setup +++ b/src/share/ma/setup @@ -23,7 +23,7 @@ setup() { # deliberately replace the config files via truncation # FIXME: should we be dumping to tmp files and then moving atomically? - log debug "write core gpg.conf..." + log debug "writing core gpg.conf..." cat >"${GNUPGHOME_CORE}"/gpg.conf <"${GNUPGHOME_SPHERE}"/gpg.conf < Date: Thu, 12 Feb 2009 19:08:21 -0500 Subject: trust level != trust model --- src/share/ma/setup | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/share/ma/setup') diff --git a/src/share/ma/setup b/src/share/ma/setup index 09c356c..8032023 100644 --- a/src/share/ma/setup +++ b/src/share/ma/setup @@ -96,11 +96,11 @@ EOF # ensure that we're using the extended trust model (1), and that # our preferences are reasonable (i.e. 3 marginal OR 1 fully # trusted certifications are sufficient to grant full validity. - log debug "checking trust level of core key..." - local TRUST_LEVEL=$(gpg_sphere --with-colons --fixed-list-mode --list-keys \ + log debug "checking trust model for authentication ..." + local TRUST_MODEL=$(gpg_sphere --with-colons --fixed-list-mode --list-keys \ | head -n1 | grep "^tru:" | cut -d: -f3,6,7) - log debug "sphere trust level of core: $TRUST_LEVEL" - if [ "$TRUST_LEVEL" != '1:3:1' ] ; then + log debug "sphere trust model: $TRUST_MODEL" + if [ "$TRUST_MODEL" != '1:3:1' ] ; then failure "monkeysphere-authentication does not have the expected trust model settings." fi } -- cgit v1.2.3 From 387848dfa7081364094a71ff70f65bb1cbd83d8b Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Thu, 12 Feb 2009 19:10:12 -0500 Subject: fix some calls to gpg_sphere that where not putting all arguments into a single argument, as required by the strange su requirements. --- src/monkeysphere-authentication | 2 +- src/share/ma/setup | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/share/ma/setup') diff --git a/src/monkeysphere-authentication b/src/monkeysphere-authentication index a33de1e..18057e5 100755 --- a/src/monkeysphere-authentication +++ b/src/monkeysphere-authentication @@ -101,7 +101,7 @@ core_fingerprint() { gpg_core_sphere_sig_transfer() { log debug "exporting core local sigs to sphere..." gpg_core --export-options export-local-sigs --export | \ - gpg_sphere --import-options import-local-sigs --import + gpg_sphere "--import-options import-local-sigs --import" } ######################################################################## diff --git a/src/share/ma/setup b/src/share/ma/setup index e5109fd..216b0b9 100644 --- a/src/share/ma/setup +++ b/src/share/ma/setup @@ -98,7 +98,7 @@ EOF # our preferences are reasonable (i.e. 3 marginal OR 1 fully # trusted certifications are sufficient to grant full validity. log debug "checking trust level of core key..." - local TRUST_LEVEL=$(gpg_sphere --with-colons --fixed-list-mode --list-keys \ + local TRUST_LEVEL=$(gpg_sphere "--with-colons --fixed-list-mode --list-keys" \ | head -n1 | grep "^tru:" | cut -d: -f3,6,7) log debug "sphere trust level of core: $TRUST_LEVEL" if [ "$TRUST_LEVEL" != '1:3:1' ] ; then -- cgit v1.2.3 From 4b1b309608a55494cc94fee9bd9153d09fb3040a Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Thu, 12 Feb 2009 19:13:19 -0500 Subject: fix something that was resolved improperly in the previous merge. --- src/share/ma/setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/share/ma/setup') diff --git a/src/share/ma/setup b/src/share/ma/setup index f989db6..02fc069 100644 --- a/src/share/ma/setup +++ b/src/share/ma/setup @@ -97,7 +97,7 @@ EOF # our preferences are reasonable (i.e. 3 marginal OR 1 fully # trusted certifications are sufficient to grant full validity. log debug "checking trust model for authentication ..." - local TRUST_LEVEL=$(gpg_sphere "--with-colons --fixed-list-mode --list-keys" \ + local TRUST_MODEL=$(gpg_sphere "--with-colons --fixed-list-mode --list-keys" \ | head -n1 | grep "^tru:" | cut -d: -f3,6,7) log debug "sphere trust model: $TRUST_MODEL" if [ "$TRUST_MODEL" != '1:3:1' ] ; then -- cgit v1.2.3 From a2a3d02d1aaf2d3dae3afea90c85cd6ca9f7ce4d Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Tue, 17 Feb 2009 15:19:40 -0500 Subject: add some checks about setup to authentication --- man/man8/monkeysphere-authentication.8 | 6 ++++-- src/monkeysphere-authentication | 13 +++++++++++++ src/share/ma/setup | 4 +++- 3 files changed, 20 insertions(+), 3 deletions(-) (limited to 'src/share/ma/setup') diff --git a/man/man8/monkeysphere-authentication.8 b/man/man8/monkeysphere-authentication.8 index 4187c70..9b8baa9 100644 --- a/man/man8/monkeysphere-authentication.8 +++ b/man/man8/monkeysphere-authentication.8 @@ -24,8 +24,10 @@ authentication. \fBmonkeysphere-authentication\fP takes various subcommands. .TP .B setup -Setup the server for Monkeysphere user authentication. `s' may be -used in place of `setup'. +Setup the server for Monkeysphere user authentication. This command +is idempotent, which means it can be run multiple times to make sure +the setup is correct, without adversely affecting existing setups. +`s' may be used in place of `setup'. .TP .B update-users [ACCOUNT]... Rebuild the monkeysphere-controlled authorized_keys files. For each diff --git a/src/monkeysphere-authentication b/src/monkeysphere-authentication index 465777d..60cb5f2 100755 --- a/src/monkeysphere-authentication +++ b/src/monkeysphere-authentication @@ -95,6 +95,14 @@ core_fingerprint() { | grep ^fpr: | cut -d: -f10 } +# fail if authentication has not been setup +check_no_setup() { + # FIXME: what is the right test to do here? + [ -d "$MADATADIR" ] \ + || failure "This host appears to have not yet been set up for Monkeysphere authentication. +Please run 'monkeysphere-authentication setup' first." +} + # export signatures from core to sphere gpg_core_sphere_sig_transfer() { log debug "exporting core local sigs to sphere..." @@ -155,21 +163,25 @@ case $COMMAND in ;; 'update-users'|'update-user'|'u') + check_no_setup source "${MASHAREDIR}/update_users" update_users "$@" ;; 'add-identity-certifier'|'add-id-certifier'|'add-certifier'|'c+') + check_no_setup source "${MASHAREDIR}/add_certifier" add_certifier "$@" ;; 'remove-identity-certifier'|'remove-id-certifier'|'remove-certifier'|'c-') + check_no_setup source "${MASHAREDIR}/remove_certifier" remove_certifier "$@" ;; 'list-identity-certifiers'|'list-id-certifiers'|'list-certifiers'|'list-certifier'|'c') + check_no_setup source "${MASHAREDIR}/list_certifiers" list_certifiers "$@" ;; @@ -180,6 +192,7 @@ case $COMMAND in ;; 'gpg-cmd') + check_no_setup gpg_sphere "$@" ;; diff --git a/src/share/ma/setup b/src/share/ma/setup index 02fc069..f59187b 100644 --- a/src/share/ma/setup +++ b/src/share/ma/setup @@ -70,7 +70,7 @@ EOF fi else - log verbose "This system has already set up the Monkeysphere authentication trust core." + log verbose "Monkeysphere authentication trust core already exists." fi # export the core key to the sphere keyring @@ -91,6 +91,7 @@ EOF fi else failure "Could not get monkeysphere-authentication trust guidelines." + # FIXME: what does this mean? should we suggest how to fix? fi # ensure that we're using the extended trust model (1), and that @@ -102,5 +103,6 @@ EOF log debug "sphere trust model: $TRUST_MODEL" if [ "$TRUST_MODEL" != '1:3:1' ] ; then failure "monkeysphere-authentication does not have the expected trust model settings." + # FIXME: what does this mean? should we suggest how to fix? fi } -- cgit v1.2.3