git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Hudec <bulb@ucw.cz>
To: "Gonzalo Garramuño" <ggarra@advancedsl.com.ar>
Cc: Felipe Balbi <felipebalbi@users.sourceforge.net>, git@vger.kernel.org
Subject: Re: Git and securing a repository
Date: Wed, 2 Jan 2008 20:31:14 +0100	[thread overview]
Message-ID: <20080102193114.GA4608@efreet.light.src> (raw)
In-Reply-To: <477B6199.6070601@advancedsl.com.ar>

On Wed, Jan 02, 2008 at 07:04:09 -0300, Gonzalo Garramuño wrote:
> Felipe Balbi wrote:
>>
>> it's easy on the full repository case, create different groups and
>> share git repositories by groups, after that chmod o-rwx -R
>> /path/to/repository.git.
>>
>
> Thanks.  I'll admit what you describe is somewhat discouraging, as what you 
> are just describing is just managing user accounts or groups on the 
> underlying OS.  That does not extend well to placing code on the net and 
> has a bunch of administrative headaches.
>
> I was really looking for a permission based system that was part of git 
> itself (and thus more portable and easier to admin), and not the OS. 
> Something akin to what perforce or even CVS can do.

You don't need to manage user accounts -- managing ssh public keys will do!

The git ssh access will always run one particular command (with path as
argument) to push and another particular command (again with path as
argument) to pull.

Thus you can prepare two scripts -- git-read-only will only run
$SSH_ORIGINAL_COMMAND if it is 'git-upload-pack <somearg>' and git-read-write
will also run it if it is 'git-receive-pack <somearg>'. The <somearg> is path
to the repository, so you can further limit on that. (Note: for recent git,
you need to recognize the 'git upload-pack' and 'git receive-pack' variants
too).

Now you can have each user create a ssh public key. You will put this key
into the .ssh/authorized_keys file on the server (therefore you only need
a single account there), with option command= specifying appropriate script
depending on what permissions the user should have. Than that user will be
able to push/pull (as set) via ssh using that public key and will not have
any other access to the server.

As a bonus, this way the users can't circumvent the pre-receive hooks
(perhaps you will allow each user to only push to a particular branch or
something) by manually changing the repository.

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

  parent reply	other threads:[~2008-01-02 19:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-02  7:13 Git and securing a repository Gonzalo Garramuño
2008-01-02  6:34 ` Felipe Balbi
2008-01-02 10:04   ` Gonzalo Garramuño
2008-01-02  9:26     ` David Symonds
2008-01-02 10:39       ` Gonzalo Garramuño
2008-01-02 10:51         ` Jakub Narebski
2008-01-03  3:58           ` Shawn O. Pearce
2008-01-03  4:30             ` Bruno Cesar Ribas
2008-01-03  5:36             ` Gonzalo Garramuño
2008-01-03  4:45               ` Shawn O. Pearce
2008-01-03  6:08                 ` Gonzalo Garramuño
2008-01-03  5:19                   ` Shawn O. Pearce
2008-01-03  9:11             ` Jakub Narebski
2008-01-03  9:36               ` Junio C Hamano
2008-01-02 19:31     ` Jan Hudec [this message]
2008-01-02 19:41       ` Gregory Jefferis
2008-01-02 22:17     ` Linus Torvalds
2008-01-02 16:18 ` Daniel Barkalow

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=20080102193114.GA4608@efreet.light.src \
    --to=bulb@ucw.cz \
    --cc=felipebalbi@users.sourceforge.net \
    --cc=ggarra@advancedsl.com.ar \
    --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).