From 45a38e389395fed49c82648dfd93c65430956c07 Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Sun, 1 Feb 2009 00:21:57 -0500 Subject: add setup subcommand call to ms-authentication, and more fixes to tests --- tests/basic | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) (limited to 'tests/basic') diff --git a/tests/basic b/tests/basic index 5006f8f..bf6a364 100755 --- a/tests/basic +++ b/tests/basic @@ -19,7 +19,7 @@ set -o pipefail ## make sure that the right tools are installed to run the test. the ## test has *more* requirements than plain ol' monkeysphere: -which socat || { echo "You must have socat installed to run this test." ; exit 1; } +which socat >/dev/null || { echo "You must have socat installed to run this test." ; exit 1; } ## FIXME: other checks? @@ -107,7 +107,7 @@ trap failed_cleanup EXIT ## set up some variables to ensure that we're operating strictly in ## the tests, not system-wide: -export TESTDIR=$(pwd) +export TESTDIR=$(dirname "$0") # make temp dir TEMPDIR="$TESTDIR"/tmp @@ -161,34 +161,22 @@ get_gpg_prng_arg >> "$GNUPGHOME"/gpg.conf # set up sshd echo "### configuring sshd..." -cp etc/ssh/sshd_config "$SSHD_CONFIG" +cp "$TESTDIR"/etc/ssh/sshd_config "$SSHD_CONFIG" # write the sshd_config cat <> "$SSHD_CONFIG" HostKey ${MONKEYSPHERE_SYSDATADIR}/ssh_host_rsa_key AuthorizedKeysFile ${MONKEYSPHERE_SYSDATADIR}/authentication/authorized_keys/%u EOF + +### SERVER HOST SETUP + # set up monkeysphere host echo "### configuring monkeysphere host..." mkdir -p -m 750 "$MONKEYSPHERE_SYSDATADIR"/host -# set up monkeysphere authentication -echo "### configuring monkeysphere authentication..." -mkdir -p -m 700 "$MONKEYSPHERE_SYSDATADIR"/authentication/{authorized_keys,core,sphere,tmp} -cp etc/monkeysphere/monkeysphere-authentication.conf "$TEMPDIR"/ -cat <> "$TEMPDIR"/monkeysphere-authentication.conf -AUTHORIZED_USER_IDS="$MONKEYSPHERE_HOME/authentication/authorized_user_ids" -EOF -cat < "$MONKEYSPHERE_SYSDATADIR"/authentication/sphere/gpg.conf -primary-keyring ${MONKEYSPHERE_SYSDATADIR}/authentication/sphere/pubring.gpg -keyring ${MONKEYSPHERE_SYSDATADIR}/authentication/core/pubring.gpg -EOF - - -### SERVER TESTS - # create a new host key -echo "### generating server key..." +echo "### generating server host key..." # add gpg.conf with quick-random get_gpg_prng_arg >> "$MONKEYSPHERE_SYSCONFIGDIR"/host/gpg.conf echo | monkeysphere-host expert gen-key --length 1024 --expire 0 testhost @@ -199,13 +187,32 @@ HOSTKEYID=$( monkeysphere-host show-key | grep '^OpenPGP fingerprint: ' | cut -f # certify it with the "Admin's Key". # (this would normally be done via keyservers) -echo "### certifying server key..." -monkeysphere-authentication expert gpg-cmd "--armor --export $HOSTKEYID" | gpgadmin --import +echo "### certifying server host key..." +GNUPGHOME="$MONKEYSPHERE_SYSCONFIGDIR"/host gpg --armor --export "$HOSTKEYID" | gpgadmin --import echo y | gpgadmin --command-fd 0 --sign-key "$HOSTKEYID" # FIXME: how can we test publish-key without flooding junk into the # keyservers? + +### SERVER AUTHENTICATION TESTS + +# set up monkeysphere authentication +echo "### configuring monkeysphere authentication..." +mkdir -p -m 700 "$MONKEYSPHERE_SYSDATADIR"/authentication/{authorized_keys,core,sphere,tmp} +cp "$TESTDIR"/etc/monkeysphere/monkeysphere-authentication.conf "$TEMPDIR"/ +cat <> "$TEMPDIR"/monkeysphere-authentication.conf +AUTHORIZED_USER_IDS="$MONKEYSPHERE_HOME/authentication/authorized_user_ids" +EOF +cat < "$MONKEYSPHERE_SYSDATADIR"/authentication/sphere/gpg.conf +primary-keyring ${MONKEYSPHERE_SYSDATADIR}/authentication/sphere/pubring.gpg +keyring ${MONKEYSPHERE_SYSDATADIR}/authentication/core/pubring.gpg +EOF + +# setup server authentication +echo "### setting up server authentication..." +monkeysphere-authentication setup + # add admin as identity certifier for testhost echo "### adding admin as certifier..." echo y | monkeysphere-authentication add-id-certifier "$TEMPDIR"/admin/.gnupg/pubkey.gpg -- cgit v1.2.3 From 6b09adf78d79ea76849a43f4af4335a7a89b10c7 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Sun, 1 Feb 2009 02:27:58 -0500 Subject: removed some unnecessary setup from the basic test, pulling the random string from /dev/urandom; generating the authentication trust core key at 2048 bits --- src/share/ma/setup | 4 ++-- tests/basic | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'tests/basic') diff --git a/src/share/ma/setup b/src/share/ma/setup index a829a98..944bb4d 100644 --- a/src/share/ma/setup +++ b/src/share/ma/setup @@ -43,11 +43,11 @@ EOF if [ -z "$CORE_FPR" ] ; then log info "Setting up Monkeysphere authentication trust core" - local CORE_UID=$(printf "Monkeysphere authentication trust core UID (random string: %s)" $(head -c21 | base64)) + local CORE_UID=$(printf "Monkeysphere authentication trust core UID (random string: %s)" $(head -c21 > "$TEMPDIR"/monkeysphere-authentication.conf AUTHORIZED_USER_IDS="$MONKEYSPHERE_HOME/authentication/authorized_user_ids" EOF -cat < "$MONKEYSPHERE_SYSDATADIR"/authentication/sphere/gpg.conf -primary-keyring ${MONKEYSPHERE_SYSDATADIR}/authentication/sphere/pubring.gpg -keyring ${MONKEYSPHERE_SYSDATADIR}/authentication/core/pubring.gpg -EOF # setup server authentication echo "### setting up server authentication..." monkeysphere-authentication setup +get_gpg_prng_arg >> "$MONKEYSPHERE_SYSDATADIR"/authentication/sphere/gpg.conf # add admin as identity certifier for testhost echo "### adding admin as certifier..." -- cgit v1.2.3 From 98ee387a0ba4b15fe80cfcd7828127ff8ae9518d Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Sun, 1 Feb 2009 12:16:33 -0500 Subject: some small tweaks, and one tiny syntax bug fix, to ma/setup, and some small formating and comment changes to test/basic --- src/share/ma/setup | 23 ++++++++++------------- tests/basic | 46 +++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 51 insertions(+), 18 deletions(-) (limited to 'tests/basic') diff --git a/src/share/ma/setup b/src/share/ma/setup index 764fdb8..abce3af 100644 --- a/src/share/ma/setup +++ b/src/share/ma/setup @@ -13,13 +13,13 @@ setup() { # make the core and the sphere: - mkdir -p ${SYSDATADIR}/authentication - mkdir -p ${GNUPGHOME_SPHERE} - mkdir -p ${GNUPGHOME_CORE} + mkdir -p "${SYSDATADIR}"/authentication + mkdir -p "${GNUPGHOME_SPHERE}" + mkdir -p "${GNUPGHOME_CORE}" # deliberately replace the config files via truncation # FIXME: should we be dumping to tmp files and then moving atomically? - cat >${GNUPGHOME_CORE}/gpg.conf <"${GNUPGHOME_CORE}"/gpg.conf <${GNUPGHOME_SPHERE}/gpg.conf <"${GNUPGHOME_SPHERE}"/gpg.conf <> "$GNUPGHOME"/gpg.conf # set up sshd +echo "##################################################" echo "### configuring sshd..." cp "$TESTDIR"/etc/ssh/sshd_config "$SSHD_CONFIG" # write the sshd_config @@ -172,10 +175,12 @@ EOF ### SERVER HOST SETUP # set up monkeysphere host +echo "##################################################" echo "### configuring monkeysphere host..." mkdir -p -m 750 "$MONKEYSPHERE_SYSDATADIR"/host # create a new host key +echo "##################################################" echo "### generating server host key..." # add gpg.conf with quick-random get_gpg_prng_arg >> "$MONKEYSPHERE_SYSCONFIGDIR"/host/gpg.conf @@ -183,10 +188,13 @@ echo | monkeysphere-host expert gen-key --length 1024 --expire 0 testhost # remove the gpg.conf rm "$MONKEYSPHERE_SYSCONFIGDIR"/host/gpg.conf +# FIXME: need to test import-key as well + HOSTKEYID=$( monkeysphere-host show-key | grep '^OpenPGP fingerprint: ' | cut -f3 -d\ ) # certify it with the "Admin's Key". # (this would normally be done via keyservers) +echo "##################################################" echo "### certifying server host key..." GNUPGHOME="$MONKEYSPHERE_SYSCONFIGDIR"/host gpg --armor --export "$HOSTKEYID" | gpgadmin --import echo y | gpgadmin --command-fd 0 --sign-key "$HOSTKEYID" @@ -194,10 +202,13 @@ echo y | gpgadmin --command-fd 0 --sign-key "$HOSTKEYID" # FIXME: how can we test publish-key without flooding junk into the # keyservers? +# FIXME: should we run "diagnostics" here to test setup? + -### SERVER AUTHENTICATION TESTS +### SERVER AUTHENTICATION SETUP # set up monkeysphere authentication +echo "##################################################" echo "### configuring monkeysphere authentication..." mkdir -p -m 700 "$MONKEYSPHERE_SYSDATADIR"/authentication/{authorized_keys,core,sphere,tmp} cp "$TESTDIR"/etc/monkeysphere/monkeysphere-authentication.conf "$TEMPDIR"/ @@ -206,65 +217,90 @@ AUTHORIZED_USER_IDS="$MONKEYSPHERE_HOME/authentication/authorized_user_ids" EOF # setup server authentication +echo "##################################################" echo "### setting up server authentication..." monkeysphere-authentication setup get_gpg_prng_arg >> "$MONKEYSPHERE_SYSDATADIR"/authentication/sphere/gpg.conf # add admin as identity certifier for testhost +echo "##################################################" echo "### adding admin as certifier..." echo y | monkeysphere-authentication add-id-certifier "$TEMPDIR"/admin/.gnupg/pubkey.gpg +# FIXME: should we run "diagnostics" here to test setup? -### TESTUSER TESTS + +### TESTUSER SETUP # generate an auth subkey for the test user that expires in 2 days +echo "##################################################" echo "### generating key for testuser..." monkeysphere gen-subkey --expire 2 # add server key to testuser keychain +echo "##################################################" echo "### export server key to testuser..." gpgadmin --armor --export "$HOSTKEYID" | gpg --import # teach the "server" about the testuser's key +echo "##################################################" echo "### export testuser key to server..." gpg --export testuser | monkeysphere-authentication gpg-cmd --import + +# update authorized_keys for user +echo "##################################################" echo "### update server authorized_keys file for this testuser..." monkeysphere-authentication update-users $(whoami) + +### TESTS + # connect to test sshd, using monkeysphere-ssh-proxycommand to verify # the identity before connection. This should work in both directions! +echo "##################################################" echo "### ssh connection test for success..." ssh_test # remove the testuser's authorized_user_ids file, update, and make # sure that the ssh authentication FAILS +echo "##################################################" echo "### removing testuser authorized_user_ids and updating..." mv "$TESTHOME"/.monkeysphere/authorized_user_ids{,.bak} monkeysphere-authentication update-users $(whoami) +echo "##################################################" echo "### ssh connection test for server authentication denial..." ssh_test 255 mv "$TESTHOME"/.monkeysphere/authorized_user_ids{.bak,} # put improper permissions on authorized_user_ids file, update, and # make sure ssh authentication FAILS +echo "##################################################" echo "### setting group writability on authorized_user_ids and updating..." chmod g+w "$TESTHOME"/.monkeysphere/authorized_user_ids monkeysphere-authentication update-users $(whoami) +echo "##################################################" echo "### ssh connection test for server authentication denial..." ssh_test 255 chmod g-w "$TESTHOME"/.monkeysphere/authorized_user_ids +echo "##################################################" echo "### setting other writability on authorized_user_ids and updating..." chmod o+w "$TESTHOME"/.monkeysphere/authorized_user_ids monkeysphere-authentication update-users $(whoami) +echo "##################################################" echo "### ssh connection test for server authentication denial..." ssh_test 255 chmod o-w "$TESTHOME"/.monkeysphere/authorized_user_ids +# FIXME: addtest: remove admin as id-certifier and check ssh failure + +# FIXME: addtest: revoke hostname on host key and check ssh failure + +# FIXME: addtest: revoke the host key and check ssh failure trap - EXIT -echo -echo "Monkeysphere basic tests completed successfully!" -echo +echo "##################################################" +echo " Monkeysphere basic tests completed successfully!" +echo "##################################################" cleanup -- cgit v1.2.3 From 89e447e2001c0406fab6d2e6ca300a19d492435b Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Sun, 1 Feb 2009 12:52:10 -0500 Subject: fix a bunch of directory references to the new data/share dirs --- src/monkeysphere-authentication | 15 ++++++++++----- src/monkeysphere-host | 13 ++++++++----- src/share/ma/setup | 12 ++++++++---- src/share/ma/update_users | 2 +- src/share/mh/gen_key | 12 ++++++------ src/share/mh/import_key | 4 ++-- tests/basic | 6 +----- 7 files changed, 36 insertions(+), 28 deletions(-) (limited to 'tests/basic') diff --git a/src/monkeysphere-authentication b/src/monkeysphere-authentication index 4aaf02d..7c43aa8 100755 --- a/src/monkeysphere-authentication +++ b/src/monkeysphere-authentication @@ -12,20 +12,25 @@ # version 3 or later. ######################################################################## +set -e + PGRM=$(basename $0) SYSSHAREDIR=${MONKEYSPHERE_SYSSHAREDIR:-"/usr/share/monkeysphere"} export SYSSHAREDIR . "${SYSSHAREDIR}/common" || exit 1 +SYSDATADIR=${MONKEYSPHERE_SYSDATADIR:-"/var/lib/monkeysphere"} +export SYSDATADIR + # sharedir for authentication functions MASHAREDIR="${SYSSHAREDIR}/ma" -SYSDATADIR=${MONKEYSPHERE_SYSDATADIR:-"/var/lib/monkeysphere"} -export SYSDATADIR +# datadir for authentication functions +MADATADIR="${SYSDATADIR}/authentication" # temp directory to enable atomic moves of authorized_keys files -MATMPDIR="${SYSDATADIR}/tmp" +MATMPDIR="${MADATADIR}/tmp" export MSTMPDIR # UTC date in ISO 8601 format if needed @@ -135,8 +140,8 @@ MONKEYSPHERE_USER=${MONKEYSPHERE_MONKEYSPHERE_USER:=${MONKEYSPHERE_USER:="monkey # other variables CHECK_KEYSERVER=${MONKEYSPHERE_CHECK_KEYSERVER:="true"} REQUIRED_USER_KEY_CAPABILITY=${MONKEYSPHERE_REQUIRED_USER_KEY_CAPABILITY:="a"} -GNUPGHOME_CORE=${MONKEYSPHERE_GNUPGHOME_CORE:="${SYSDATADIR}/authentication/core"} -GNUPGHOME_SPHERE=${MONKEYSPHERE_GNUPGHOME_SPHERE:="${SYSDATADIR}/authentication/sphere"} +GNUPGHOME_CORE=${MONKEYSPHERE_GNUPGHOME_CORE:="${MADATADIR}/core"} +GNUPGHOME_SPHERE=${MONKEYSPHERE_GNUPGHOME_SPHERE:="${MADATADIR}/sphere"} # export variables needed in su invocation export DATE diff --git a/src/monkeysphere-host b/src/monkeysphere-host index 0b37ba9..3f4a434 100755 --- a/src/monkeysphere-host +++ b/src/monkeysphere-host @@ -18,11 +18,14 @@ SYSSHAREDIR=${MONKEYSPHERE_SYSSHAREDIR:-"/usr/share/monkeysphere"} export SYSSHAREDIR . "${SYSSHAREDIR}/common" || exit 1 +SYSDATADIR=${MONKEYSPHERE_SYSDATADIR:-"/var/lib/monkeysphere"} +export SYSDATADIR + # sharedir for host functions MHSHAREDIR="${SYSSHAREDIR}/mh" -SYSDATADIR=${MONKEYSPHERE_SYSDATADIR:-"/var/lib/monkeysphere"} -export SYSDATADIR +# datadir for host functions +MHDATADIR="${SYSDATADIR}/host" # UTC date in ISO 8601 format if needed DATE=$(date -u '+%FT%T') @@ -114,8 +117,8 @@ show_key() { gpg_host "--fingerprint --list-key --list-options show-unusable-uids $fingerprintPGP" 2>/dev/null echo "OpenPGP fingerprint: $fingerprintPGP" - if [ -f "${SYSDATADIR}/ssh_host_rsa_key.pub" ] ; then - fingerprintSSH=$(ssh-keygen -l -f "${SYSDATADIR}/ssh_host_rsa_key.pub" | \ + if [ -f "${MHDATADIR}/ssh_host_rsa_key.pub" ] ; then + fingerprintSSH=$(ssh-keygen -l -f "${MHDATADIR}/ssh_host_rsa_key.pub" | \ awk '{ print $1, $2, $4 }') echo "ssh fingerprint: $fingerprintSSH" else @@ -144,7 +147,7 @@ MONKEYSPHERE_USER=${MONKEYSPHERE_MONKEYSPHERE_USER:=${MONKEYSPHERE_USER:="monkey # other variables CHECK_KEYSERVER=${MONKEYSPHERE_CHECK_KEYSERVER:="true"} -GNUPGHOME_HOST=${MONKEYSPHERE_GNUPGHOME_HOST:="${SYSDATADIR}/host"} +GNUPGHOME_HOST=${MONKEYSPHERE_GNUPGHOME_HOST:="${MHDATADIR}"} # export variables needed in su invocation export DATE diff --git a/src/share/ma/setup b/src/share/ma/setup index abce3af..672a960 100644 --- a/src/share/ma/setup +++ b/src/share/ma/setup @@ -12,8 +12,9 @@ # version 3 or later. setup() { - # make the core and the sphere: - mkdir -p "${SYSDATADIR}"/authentication + # make all needed directories + mkdir -p "${MADATADIR}" + mkdir -p "${MATMPDIR}" mkdir -p "${GNUPGHOME_SPHERE}" mkdir -p "${GNUPGHOME_CORE}" @@ -46,14 +47,17 @@ EOF local CORE_UID=$(printf "Monkeysphere authentication trust core UID (random string: %s)" $(head -c21 "${SYSDATADIR}/ssh_host_rsa_key") -log info "SSH host private key output to file: ${SYSDATADIR}/ssh_host_rsa_key" -ssh-keygen -y -f "${SYSDATADIR}/ssh_host_rsa_key" > "${SYSDATADIR}/ssh_host_rsa_key.pub" -log info "SSH host public key output to file: ${SYSDATADIR}/ssh_host_rsa_key.pub" -gpg_host "--export-options export-minimal --armor --export 0x${fingerprint}\!" > "${SYSDATADIR}/ssh_host_rsa_key.pub.gpg" -log info "SSH host public key in OpenPGP form: ${SYSDATADIR}/ssh_host_rsa_key.pub.gpg" + openpgp2ssh "$fingerprint" > "${MHDATADIR}/ssh_host_rsa_key") +log info "SSH host private key output to file: ${MHDATADIR}/ssh_host_rsa_key" +ssh-keygen -y -f "${MHDATADIR}/ssh_host_rsa_key" > "${MHDATADIR}/ssh_host_rsa_key.pub" +log info "SSH host public key output to file: ${MHDATADIR}/ssh_host_rsa_key.pub" +gpg_host "--export-options export-minimal --armor --export 0x${fingerprint}\!" > "${MHDATADIR}/ssh_host_rsa_key.pub.gpg" +log info "SSH host public key in OpenPGP form: ${MHDATADIR}/ssh_host_rsa_key.pub.gpg" # show info about new key show_key diff --git a/src/share/mh/import_key b/src/share/mh/import_key index c0d5956..0f16d27 100644 --- a/src/share/mh/import_key +++ b/src/share/mh/import_key @@ -79,8 +79,8 @@ log verbose "setting ultimate owner trust for host key..." echo "${fingerprint}:6:" | gpg_host "--import-ownertrust" # export public key to file -gpg_host "--export-options export-minimal --armor --export 0x${fingerprint}\!" > "${SYSDATADIR}/ssh_host_rsa_key.pub.gpg" -log info "SSH host public key in OpenPGP form: ${SYSDATADIR}/ssh_host_rsa_key.pub.gpg" +gpg_host "--export-options export-minimal --armor --export 0x${fingerprint}\!" > "${MHDATADIR}/ssh_host_rsa_key.pub.gpg" +log info "SSH host public key in OpenPGP form: ${MHDATADIR}/ssh_host_rsa_key.pub.gpg" # show info about new key show_key diff --git a/tests/basic b/tests/basic index e30f31b..b5afb23 100755 --- a/tests/basic +++ b/tests/basic @@ -209,16 +209,12 @@ echo y | gpgadmin --command-fd 0 --sign-key "$HOSTKEYID" # set up monkeysphere authentication echo "##################################################" -echo "### configuring monkeysphere authentication..." +echo "### setup monkeysphere authentication..." mkdir -p -m 700 "$MONKEYSPHERE_SYSDATADIR"/authentication/{authorized_keys,core,sphere,tmp} cp "$TESTDIR"/etc/monkeysphere/monkeysphere-authentication.conf "$TEMPDIR"/ cat <> "$TEMPDIR"/monkeysphere-authentication.conf AUTHORIZED_USER_IDS="$MONKEYSPHERE_HOME/authentication/authorized_user_ids" EOF - -# setup server authentication -echo "##################################################" -echo "### setting up server authentication..." monkeysphere-authentication setup get_gpg_prng_arg >> "$MONKEYSPHERE_SYSDATADIR"/authentication/sphere/gpg.conf -- cgit v1.2.3 From 44dfeaec9209521ca6a65e85c1276bad4bdf5c01 Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Sun, 1 Feb 2009 13:59:02 -0500 Subject: some tweaks to the man pages --- man/man7/monkeysphere.7 | 13 +++--- man/man8/monkeysphere-authentication.8 | 62 +++++++++++++------------ man/man8/monkeysphere-host.8 | 82 ++++++++++++++++++---------------- src/monkeysphere | 2 +- tests/basic | 15 +++++++ 5 files changed, 102 insertions(+), 72 deletions(-) (limited to 'tests/basic') diff --git a/man/man7/monkeysphere.7 b/man/man7/monkeysphere.7 index 8d7c43a..d221c87 100644 --- a/man/man7/monkeysphere.7 +++ b/man/man7/monkeysphere.7 @@ -7,7 +7,7 @@ Trust .SH DESCRIPTION -\fBMonkeySphere\fP is a framework to leverage the OpenPGP Web of Trust +\fBMonkeysphere\fP is a framework to leverage the OpenPGP Web of Trust for ssh authentication. OpenPGP keys are tracked via GnuPG, and added to the authorized_keys and known_hosts files used by ssh for connection authentication. @@ -40,14 +40,17 @@ URI specification for the host, i.e. "ssh://host.full.domain[:port]". .SH AUTHOR -Written by Jameson Rollins , Daniel Kahn -Gillmor +Written by: +Jameson Rollins , +Daniel Kahn Gillmor .SH SEE ALSO .BR monkeysphere (1), -.BR monkeysphere-server (8), -.BR monkeysphere-ssh-proxycommand (1), +.BR monkeysphere-host (8), +.BR monkeysphere-authentication (8), +.BR openpgp2ssh (1), +.BR pem2openpgp (1), .BR gpg (1), .BR ssh (1), .BR http://tools.ietf.org/html/rfc4880, diff --git a/man/man8/monkeysphere-authentication.8 b/man/man8/monkeysphere-authentication.8 index 68a7a1b..2b0091e 100644 --- a/man/man8/monkeysphere-authentication.8 +++ b/man/man8/monkeysphere-authentication.8 @@ -20,26 +20,28 @@ authentication. \fBmonkeysphere-authentication\fP is a Monkeysphere server admin utility. .SH SUBCOMMANDS -\fBmonkeysphere-authentication\fP takes various subcommands.(Users may use the -abbreviated subcommand in parentheses): +\fBmonkeysphere-authentication\fP takes various subcommands. .TP -.B update-users (u) [ACCOUNT]... -Rebuild the monkeysphere-controlled authorized_keys files. For each specified -account, the user ID's listed in the account's authorized_user_ids file are -processed. For each user ID, gpg will be queried for keys associated with that -user ID, optionally querying a keyserver. If an acceptable key is found (see -KEY ACCEPTABILITY in monkeysphere(7)), the key is added to the account's -monkeysphere-controlled authorized_keys file. If the RAW_AUTHORIZED_KEYS -variable is set, then a separate authorized_keys file (usually -~USER/.ssh/authorized_keys) is appended to the monkeysphere-controlled -authorized_keys file. If no accounts are specified, then all accounts on the -system are processed. `u' may be used in place of `update-users'. - -\" XXX - +.B setup +Setup the server for Monkeysphere user authentication. `s' may be +used in place of `setup'. .TP -.B add-id-certifier (c+) KEYID +.B update-users [ACCOUNT]... +Rebuild the monkeysphere-controlled authorized_keys files. For each +specified account, the user ID's listed in the account's +authorized_user_ids file are processed. For each user ID, gpg will be +queried for keys associated with that user ID, optionally querying a +keyserver. If an acceptable key is found (see KEY ACCEPTABILITY in +monkeysphere(7)), the key is added to the account's +monkeysphere-controlled authorized_keys file. If the +RAW_AUTHORIZED_KEYS variable is set, then a separate authorized_keys +file (usually ~USER/.ssh/authorized_keys) is appended to the +monkeysphere-controlled authorized_keys file. If no accounts are +specified, then all accounts on the system are processed. `u' may be +used in place of `update-users'. +.TP +.B add-id-certifier KEYID Instruct system to trust user identity certifications made by KEYID. Using the `-n' or `--domain' option allows you to indicate that you only trust the given KEYID to make identifications within a specific @@ -50,11 +52,11 @@ the `-t' or `--trust' option (possible values are `marginal' and with the `-d' or `--depth' option (default is 1). `c+' may be used in place of `add-id-certifier'. .TP -.B remove-id-certifier (c-) KEYID +.B remove-id-certifier KEYID Instruct system to ignore user identity certifications made by KEYID. `c-' may be used in place of `remove-id-certifier'. .TP -.B list-id-certifiers (c) +.B list-id-certifiers List key IDs trusted by the system to certify user identities. `c' may be used in place of `list-id-certifiers'. .TP @@ -66,11 +68,13 @@ Output a brief usage summary. `h' or `?' may be used in place of show version number .SH "EXPERT" SUBCOMMANDS + Some commands are very unlikely to be needed by most administrators. -These commands must follow the word `expert'. +These commands must prefaced by the word `expert'. .TP -.B diagnostics (d) -Review the state of the server with respect to authentication. +.B diagnostics +Review the state of the server with respect to authentication. `d' +may be used in place of `diagnostics'. .TP .B gpg-cmd Execute a gpg command on the gnupg-authentication keyring as the @@ -79,7 +83,7 @@ arguments need to be quoted). Use this command with caution, as modifying the gnupg-authentication keyring can affect ssh user authentication. -.SH SETUP +.SH SETUP USER AUTHENTICATION If the server will handle user authentication through monkeysphere-generated authorized_keys files, the server must be told @@ -116,7 +120,7 @@ to grant access to user accounts for remote users. You must also tell sshd to look at the monkeysphere-generated authorized_keys file for user authentication by setting the following in the sshd_config: -AuthorizedKeysFile /var/lib/monkeysphere/authorized_keys/%u +AuthorizedKeysFile /var/lib/monkeysphere/authentication/authorized_keys/%u It is recommended to add "monkeysphere-authentication update-users" to a system crontab, so that user keys are kept up-to-date, and key @@ -125,7 +129,7 @@ revocations and expirations can be processed in a timely manner. .SH ENVIRONMENT The following environment variables will override those specified in -(defaults in parentheses): +the config file (defaults in parentheses): .TP MONKEYSPHERE_MONKEYSPHERE_USER User to control authentication keychain (monkeysphere). @@ -135,7 +139,7 @@ Set the log level (INFO). Can be SILENT, ERROR, INFO, VERBOSE, DEBUG, in increasing order of verbosity. .TP MONKEYSPHERE_KEYSERVER -OpenPGP keyserver to use (subkeys.pgp.net). +OpenPGP keyserver to use (pool.sks-keyservers.net). .TP MONKEYSPHERE_AUTHORIZED_USER_IDS Path to user authorized_user_ids file @@ -156,8 +160,10 @@ Monkeysphere-generated user authorized_keys files. .SH AUTHOR -Written by Jameson Rollins , Daniel Kahn -Gillmor +Written by: +Jameson Rollins , +Daniel Kahn Gillmor , +Matthew Goins .SH SEE ALSO diff --git a/man/man8/monkeysphere-host.8 b/man/man8/monkeysphere-host.8 index fd676a4..78b6b4a 100644 --- a/man/man8/monkeysphere-host.8 +++ b/man/man8/monkeysphere-host.8 @@ -23,6 +23,10 @@ connection authentication. \fBmonkeysphere-host\fP takes various subcommands: .TP +.B show-key +Output information about host's OpenPGP and SSH keys. `s' may be used +in place of `show-key'. +.TP .B extend-key EXPIRE Extend the validity of the OpenPGP key for the host until EXPIRE from the present. If EXPIRE is not specified, then the user will be @@ -36,7 +40,6 @@ does: y = key expires in n years .fi `e' may be used in place of `extend-key'. - .TP .B add-hostname HOSTNAME Add a hostname user ID to the server host key. `n+' may be used in @@ -47,11 +50,12 @@ Revoke a hostname user ID from the server host key. `n-' may be used in place of `revoke-hostname'. .TP .B add-revoker FINGERPRINT - +Add a revoker to the host's OpenPGP key. `o' may be be used in place +of `add-revoker'. .TP -.B show-key -Output gpg information about host's OpenPGP key. `s' may be used in -place of `show-key'. +.B revoke-key +Revoke the host's OpenPGP key. `r' may be used in place of +`revoke-key'. .TP .B publish-key Publish the host's OpenPGP key to the keyserver. `p' may be used in @@ -63,9 +67,11 @@ Output a brief usage summary. `h' or `?' may be used in place of .TP .B version show version number + .SH "EXPERT" SUBCOMMANDS + Some commands are very unlikely to be needed by most administrators. -These commands must follow the word `expert'. +These commands must prefaced by the word `expert'. .TP .B gen-key [HOSTNAME] Generate a OpenPGP key for the host. If HOSTNAME is not specified, @@ -73,18 +79,8 @@ then the system fully-qualified domain name will be user. An alternate key bit length can be specified with the `-l' or `--length' option (default 2048). An expiration length can be specified with the `-e' or `--expire' option (prompt otherwise). The expiration format -is the same as that of \fBextend-key\fP, below. A key revoker -fingerprint can be specified with the `-r' or `--revoker' option. `g' -may be used in place of `gen-key'. - -.TP -.B diagnostics -Review the state of the server with respect to the MonkeySphere in -general and report on suggested changes. Among other checks, this -includes making sure there is a valid host key, that the key is -published, that the sshd configuration points to the right place, and -that there are at least some valid identity certifiers. `d' may be -used in place of `diagnostics'. +is the same as that of \fBextend-key\fP, below. `g' may be used in +place of `gen-key'. .TP .B import-key FIXME: @@ -92,53 +88,63 @@ FIXME: --hostname (-h) NAME[:PORT] hostname for key user ID --keyfile (-f) FILE key file to import --expire (-e) EXPIRE date to expire +.TP +.B diagnostics +Review the state of the monkeysphere server host key and report on +suggested changes. Among other checks, this includes making sure +there is a valid host key, that the key is published, that the sshd +configuration points to the right place, etc. `d' may be used in +place of `diagnostics'. -.SH SETUP +.SH SETUP HOST AUTHENTICATION -In order to start using the monkeysphere, you must first generate an -OpenPGP key for the server and convert that key to an ssh key that can -be used by ssh for host authentication. This can be done with the -\fBgen-key\fP subcommand: +To enable host verification via the monkeysphere, the host's key must +be published to the Web of Trust. This is not done by default. To +publish the host key to the keyservers, run the following command: -$ monkeysphere-server gen-key +$ monkeysphere-host publish-key -To enable host verification via the monkeysphere, you must then -publish the host's key to the Web of Trust using the \fBpublish-key\fP -command to push the key to a keyserver. You must also modify the -sshd_config on the server to tell sshd where the new server host key -is located: +You must also modify the sshd_config on the server to tell sshd where +the new server host key is located: -HostKey /var/lib/monkeysphere/ssh_host_rsa_key +HostKey /var/lib/monkeysphere/host/ssh_host_rsa_key In order for users logging into the system to be able to identify the host via the monkeysphere, at least one person (e.g. a server admin) will need to sign the host's key. This is done using standard OpenPGP -keysigning techniques, usually: pul the key from the keyserver, verify -and sign the key, and then re-publish the signature. Once an admin's -signature is published, users logging into the host can use it to -validate the host's key. +keysigning techniques, usually: pull the key from the keyserver, +verify and sign the key, and then re-publish the signature. Once an +admin's signature is published, users logging into the host can use it +to validate the host's key. + +.SH ENVIRONMENT +The following environment variables will override those specified in +the config file (defaults in parentheses): .TP MONKEYSPHERE_LOG_LEVEL Set the log level (INFO). Can be SILENT, ERROR, INFO, VERBOSE, DEBUG, in increasing order of verbosity. .TP MONKEYSPHERE_KEYSERVER -OpenPGP keyserver to use (subkeys.pgp.net). +OpenPGP keyserver to use (pool.sks-keyservers.net). .SH FILES + .TP /etc/monkeysphere/monkeysphere-host.conf System monkeysphere-host config file. .TP -/var/lib/monkeysphere/ssh_host_rsa_key +/var/lib/monkeysphere/host/ssh_host_rsa_key Copy of the host's private key in ssh format, suitable for use by sshd. .SH AUTHOR -Written by Jameson Rollins , Daniel Kahn -Gillmor +Written by: +Jameson Rollins , +Daniel Kahn Gillmor , +Matthew Goins .SH SEE ALSO diff --git a/src/monkeysphere b/src/monkeysphere index 8b7bfee..da5f406 100755 --- a/src/monkeysphere +++ b/src/monkeysphere @@ -51,7 +51,7 @@ subcommands: gen-subkey (g) [KEYID] generate an authentication subkey --length (-l) BITS key length in bits (2048) --expire (-e) EXPIRE date to expire - ssh-proxycommand ssh proxycommand + ssh-proxycommand monkeysphere ssh ProxyCommand subkey-to-ssh-agent (s) store authentication subkey in ssh-agent version (v) show version number help (h,?) this help diff --git a/tests/basic b/tests/basic index b5afb23..99a881b 100755 --- a/tests/basic +++ b/tests/basic @@ -23,6 +23,9 @@ which socat >/dev/null || { echo "You must have socat installed to run this test ## FIXME: other checks? +###################################################################### +### FUNCTIONS + # gpg command for test admin user gpgadmin() { GNUPGHOME="$TEMPDIR"/admin/.gnupg gpg "$@" @@ -103,7 +106,9 @@ SSHD_PID= trap failed_cleanup EXIT +###################################################################### ### SETUP VARIABLES + ## set up some variables to ensure that we're operating strictly in ## the tests, not system-wide: @@ -138,6 +143,7 @@ export SOCKET="$TEMPDIR"/ssh-socket export DISPLAY=monkeys +###################################################################### ### CONFIGURE ENVIRONMENTS # copy in admin and testuser home to tmp @@ -172,6 +178,7 @@ AuthorizedKeysFile ${MONKEYSPHERE_SYSDATADIR}/authentication/authorized_keys/%u EOF +###################################################################### ### SERVER HOST SETUP # set up monkeysphere host @@ -199,12 +206,15 @@ echo "### certifying server host key..." GNUPGHOME="$MONKEYSPHERE_SYSCONFIGDIR"/host gpg --armor --export "$HOSTKEYID" | gpgadmin --import echo y | gpgadmin --command-fd 0 --sign-key "$HOSTKEYID" +# FIXME: add revoker? + # FIXME: how can we test publish-key without flooding junk into the # keyservers? # FIXME: should we run "diagnostics" here to test setup? +###################################################################### ### SERVER AUTHENTICATION SETUP # set up monkeysphere authentication @@ -226,6 +236,7 @@ echo y | monkeysphere-authentication add-id-certifier "$TEMPDIR"/admin/.gnupg/pu # FIXME: should we run "diagnostics" here to test setup? +###################################################################### ### TESTUSER SETUP # generate an auth subkey for the test user that expires in 2 days @@ -249,6 +260,7 @@ echo "### update server authorized_keys file for this testuser..." monkeysphere-authentication update-users $(whoami) +###################################################################### ### TESTS # connect to test sshd, using monkeysphere-ssh-proxycommand to verify @@ -293,6 +305,9 @@ chmod o-w "$TESTHOME"/.monkeysphere/authorized_user_ids # FIXME: addtest: revoke the host key and check ssh failure + +###################################################################### + trap - EXIT echo "##################################################" -- cgit v1.2.3