git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sam Vilain <sam@vilain.net>
To: git@vger.kernel.org
Subject: [RFC] Authenticate push via PGP signature, not SSH
Date: Mon, 28 Jan 2008 17:12:01 +1300	[thread overview]
Message-ID: <479D5611.4010205@vilain.net> (raw)

I recently sent this to the gitorious list; I knocked up a working
system for this, and it so far seems workable, and it is now topical.

Note that the design used by the proof of concept would not be suitable
for the upcoming versions of git which do not allow pushing tags to
branch refs - they would require calling the tags something like
refs/tags/heads/master or some other suitable convention.  Probably not
even using refs/tags etc, to avoid races.

The key idea is to reject pushes if the PGP signature cannot be verified.

Connect to this data - http://www.rubin.ch/wotsap/ - and give everyone
in the world with a working and well signed PGP key secure push access
without them having to set anything up.  Of course, you would also want
to layer on top of this rules that would force unknown contributors into
a "mob"-like namespace.

When heads are pushed, the signed tags that are moved from refs/heads/
foo can be saved in an "archive" tag space, such as under refs/audit/
KEYID/ - this will allow, in the case of a network of git servers, for
servers to synchronise from each other, even when they
don't trust each other.

The update hook first verifies the signature, and rejects the signature
if not accepted:

------8<------
#!/bin/sh
#
# An example hook script to require all pushes be signed
#

ref=$1
sha1_old=$2
sha1_new=$3

if [ -d "$GIT_DIR/keyring" ]; then
        echo "pgp-git: using repository keyring" >&2
        GNUPGHOME=$GIT_DIR/keyring
        export GNUPGHOME
else
        echo "pgp-git: using default keyring" >&2
fi

set -e

case $ref in
        refs/tags/tmp/*)
                echo "E:Even TRYING that lark makes me ANGRY!" >&2
                exit 38
                ;;

        refs/heads/*|refs/tags/*)
                audit=$(echo "$ref" | sed 's!refs/!refs/tags/tmp/!')
                tagname=$(echo "$audit" | sed 's!refs/tags!!')
                git update-ref -m "update hook" \
                        "$audit" $sha1_new
                ;;

        *)
                echo "E:WHOA!  Pushing to $ref?" >&2
                exit 1
                ;;
esac

trap "git-tag -d $tagname" ERR
git-tag -v "$tagname"
------8<------

And then, the post-update hook will move the tag into the designed place;

------8<------
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, make this file executable by "chmod +x post-update".

for ref
do
        case "$ref" in
                refs/heads/*)
                        type=$(git cat-file -t $ref)
                        if [ $type = "tag" ]
                        then
                                echo "pgp-git: removing dummy tag" >&2
                                git update-ref -m "post-update hook -
remove dummy tag" "$ref" "$ref^{commit}"
                        fi

                        ;;
                *);;
        esac
done

git-update-server-info
------8<------

This does force potential contributors to get PGP keys, and get them
signed - but that seems to me to be a reasonable barrier of entry and
may even help drive some PGP adoption.

Remember this is a proof of concept, so let's discuss the design first
and not worry too much about the glaring bugs yet.

Sam.

             reply	other threads:[~2008-01-28  4:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-28  4:12 Sam Vilain [this message]
2008-01-28  8:12 ` [RFC] Authenticate push via PGP signature, not SSH Shawn O. Pearce
2008-01-28 21:06   ` Jan Hudec
2008-01-28 21:58   ` Sam Vilain
2008-01-29  2:57     ` Shawn O. Pearce
2008-01-29  4:10     ` Shawn O. Pearce
2008-01-29 19:08       ` Pierre Habouzit
2008-01-30  4:22         ` Shawn O. Pearce
2008-01-30  5:55           ` Sam Vilain
2008-01-30  6:16             ` Shawn O. Pearce
2008-01-30  8:35             ` Pierre Habouzit
2008-01-30 20:22               ` Sam Vilain
2008-01-30  8:00           ` Johannes Sixt
2008-01-31  5:43             ` Shawn O. Pearce
2008-01-30  8:33           ` Pierre Habouzit
2008-01-31  4:30             ` Shawn O. Pearce
2008-01-31  9:25               ` Pierre Habouzit
2008-01-30  6:29       ` Sam Vilain
2008-01-30  7:47         ` Shawn O. Pearce
2008-01-31  1:18           ` Sam Vilain
2008-01-28  8:48 ` Pierre Habouzit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=479D5611.4010205@vilain.net \
    --to=sam@vilain.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).