diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2009-01-05 19:42:10 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2009-01-05 19:42:10 +0000 |
commit | f6c6fd27a4634464f7ace0c135699cce02c43817 (patch) | |
tree | 5b1903b655ad21ad6144436257ae272066f092ea /rtadm | |
parent | d7b80cace5be8b0e263cec1e36f0553842a6e991 (diff) |
GPG signature of tarball; path changes
* The tarball sent by the support user is now signed: an extra sig.asc
gpg ascii-armoured signature of the contents of all the other file
(alphabetical order).
* Client verifies that before touching the data further.
* Hence packages depend on gnupg.
* Error code from gpg errors: 7.
* Scripts used by the server are now in /usr/share/rapid-tunneling/bin .
* Server support user sources /usr/share/rapid-tunneling/support_env .
* Fixed purging for Debian -server package.
* rtadm's config file is /etc/rapid-tunneling/rtadm .
git-svn-id: svn+ssh://xorcom/home/svn/debs/components/rapid-tunneling@6550 283159da-0705-0410-b60c-f2062b4bb6ad
Diffstat (limited to 'rtadm')
-rwxr-xr-x | rtadm | 38 |
1 files changed, 33 insertions, 5 deletions
@@ -1,13 +1,19 @@ #!/bin/sh USERNAME=support -FROM_REMOTE_COMMAND=/usr/sbin/rt-from-remote +FROM_REMOTE_COMMAND=/usr/share/rapid-tunneling/bin/rt-from-remote -[ -r /etc/default/rtadm ] && . /etc/default/rtadm -[ -r /etc/sysconfig/rtadm ] && . /etc/sysconfig/rtadm +# Until we see how this works out. +# Maybe we need to add a separate "sign" functionality to sign a support +# request tarball elsewhere? +REQUIRE_PGP=yes + +CFG_FILE=/etc/rapid-tunneling/rtadm + +if [ -r $CFG_FILE ]; then . $CFG_FILE; fi if [ -z "$HOSTNAME" -o -z "$PORT" ]; then - echo "ERROR: Hostname or port not set in configuration file." 1>&2 + echo "ERROR: Hostname or port not set in configuration file $CFG_FILE." 1>&2 exit 1 fi @@ -18,6 +24,18 @@ create() TUNNEL_PORT=$1 COMMENT=$2 + if [ "$REQUIRE_PGP" = 'yes' ] && + [ `gpg --list-secret-keys 2>/dev/null | wc -l` = '0' ] + then + echo "Support user has no (secret) gpg key and can't sign the" + echo "support requests. Either create one:" + echo "" + echo " rtadm keygen" + echo "" + echo "or copy over your secret gpg key." + echo "$0: Aborting." + exit 7 + fi if grep -q "ra-[0-9]\+-$COMMENT-[0-9]\+" $HOME/.ssh/authorized_keys 2>/dev/null; then echo "Connection name '$COMMENT' already exists. Aborting." 1>&2 exit 1 @@ -35,7 +53,11 @@ create() echo $PORT > ~/tmp/port echo $USERNAME > ~/tmp/user echo $TUNNEL_PORT > ~/tmp/tunnelport - tar -czf remote-access-$COMMENT.tar.gz -C ~/tmp host port user tunnelport key --owner root --group root + # Sign all the data sent, except the signature itself: + files_in_tar="host key port tunnelport user" # alphbetical + (cd ~/tmp; grep . $files_in_tar) >~/tmp/all_data + gpg --output ~/tmp/sig.asc --armour --detach-sign ~/tmp/all_data + tar -czf remote-access-$COMMENT.tar.gz -C ~/tmp $files_in_tar sig.asc --owner root --group root mkdir -m 700 -p ~/.ssh umask 022 cat ~/tmp/key.pub >> ~/.ssh/authorized_keys @@ -120,6 +142,8 @@ usage() echo " # disconnect connection" echo " delete <connection-name>" echo " # disconnect, disable and delete any trace of the connection" + echo " genkey" + echo " # Generate an OpenPGP key for signing tarballs (interactive)" exit 1 } @@ -160,6 +184,10 @@ case "$1" in delete "$1" disconnect "$1" ;; + keygen) + shift + gpg "$@" --gen-key + ;; *) usage ;; |