git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: Sitaram Chamarty <sitaramc@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Cc: "Robin H. Johnson" <robbat2@gentoo.org>, tv@eagain.net
Subject: Re: gitosis question: identifying/logging remote user
Date: Tue, 2 Jun 2009 13:21:18 -0700	[thread overview]
Message-ID: <20090602202118.GD3042@orbis-terrarum.net> (raw)
In-Reply-To: <2e24e5b90906020619o1bef150k43eba2870ff4fc4e@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2729 bytes --]

On Tue, Jun 02, 2009 at 06:49:22PM +0530, Sitaram Chamarty wrote:
> > 2. At the top, look for RFC822 headers with a leading "# " as padding:
> >   Examples from my own patch:
> >   # Full-Name: "Robin H. Johnson (robbat2)" <robbat2@gentoo.org>
> >   # cia-vc-username: robbat2
> Hmmm... is this a significantly different gitosis? 
Available here:
http://git.overlays.gentoo.org/gitweb/?p=proj/gitosis-gentoo.git;a=summary

> The files in my keydir mostly contain just one line (some have two,
> for people who work from different machines), looking like this:
> 
> ssh-rsa [long series of base64 type characters]== some.one@company.com
Comments ARE valid at the top of the files. Some of files have many
keys (users that keep keys unique to machines rather than use agents).
In the comments, we keep contact details for the user, as well as who
requested adding them, when, and for what purpose. The name of the file
is only for the ACL system. We had one potential conflict in naming
already, I got one of the users to rename to avoid having problems
elsewhere.

> >   The headers are followed by a blank line then further text is free-form
> >   and not parsed. Continuation lines are NOT supported.
> > 3. The header field names are transformed to enviornoment variable names
> >   as follows:
> >   - y/[[:lower:]]/[[:upper:]]/g
> >   - s/-/_/g
> > 4. Export the environment variables, named per above, with the full
> >   content of the rest of the line.
> > (We need to export the CIA.vc data, and also send off a commit mail).
> Nope, I'm completely lost.  Perhaps I failed miserably in explaining
> what I want... !
No, it just seems that you aren't expecting the extra level of
indirection. Instead of explicitly exporting values via environment in
authorized_keys, OR in gitosis-serve (like the other patch), I teach
gitosis-serve how to find the keydir again, and extract pre-formatted
data.

Say I'm committing to gitosis.
The entry in the authorized keys is:
command="gitosis-serve robbat2",no-port-forwarding,no-X11-forwarding,...

When gitosis-serve runs, it goes and opens keydir/robbat2.pub.
The following headers are there:
# Full-Name: "Robin H. Johnson (robbat2)"
# Email: <robbat2@gentoo.org>
# cia-vc-username: robbat2

And the gitosis-serve mangles these per my instructions above, and does
os.putenv with them.

Then the following exists in the environment:
FULL_NAME='Robin H. Johnson (robbat2)'
EMAIL='robbat2@gentoo.org'
CIA_VC_USERNAME='robbat2'

Which are thus usable in the hooks.

-- 
Robin Hugh Johnson
Gentoo Linux Developer & Infra Guy
E-Mail     : robbat2@gentoo.org
GnuPG FP   : 11AC BA4F 4778 E3F6 E4ED  F38E B27B 944E 3488 4E85

[-- Attachment #2: Type: application/pgp-signature, Size: 330 bytes --]

  reply	other threads:[~2009-06-02 20:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-02  4:02 gitosis question: identifying/logging remote user Sitaram Chamarty
2009-06-02  6:31 ` Robin H. Johnson
2009-06-02 13:19   ` Sitaram Chamarty
2009-06-02 20:21     ` Robin H. Johnson [this message]
2009-06-03  0:54       ` Sitaram Chamarty
2009-06-02 13:56 ` [PATCH] Add USER environment variable to executed git commands when serving Heiko Voigt
2009-06-03  1:04   ` Sitaram Chamarty
2009-06-03  6:24     ` Sitaram Chamarty
2009-06-03 20:27       ` Heiko Voigt
2009-06-03 20:50         ` Robin H. Johnson
2009-06-03 21:02           ` Shawn O. Pearce

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20090602202118.GD3042@orbis-terrarum.net \
    --to=robbat2@gentoo.org \
    --cc=git@vger.kernel.org \
    --cc=sitaramc@gmail.com \
    --cc=tv@eagain.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).