I currently am experimenting with setting up a GIT repository server so we can switch from SVN to GIT. I've got almost everything covered, but am left with an issue.
The current setup is as follows:
This works perfectly so far, and eliminates the need for gitosis or gitolite.
Because I would like to have a browsable overview of the repositories I've set up gitweb including pathinfo. Because the repos are private I've set up authentication through Perl AuthenNIS and this works, but here I encounter a problem.
It is undesired that all developers have access to all repositories, but gitweb just shows every repository it (the apache user) can read.
So my question is: is it possible to make gitweb only show the GIT repo's the currently logged in user has access to?
Possible solutions:
$export_auth_hook
in combination with $cgi->remote_user
seems promising, but my understanding of perl is too limited to use it (the hook would need to verify that the user has permission to access the repo directory before showing/exporting it)Is there anyone who knows how to make 3 or 4 work or has another solution?
If developers are pushing/pulling from the repository server using ssh under (I presume) their own user names, then perhaps the easiest way to accomplish what this is to find a way to run gitweb
or git
under that user's identity.
For instance, find a way to add an authentication hook before gitweb
is executed. Then add a wrapper around gitweb
that executes sudo -u $user gitweb.real
where $user
is the authenticated user name.
Or, you could just wrap the git
command, i.e. have gitweb
execute a wrapper which does a sudo -u $user {real-git-path}
.
For implementing authentication against NIS/PAM in Apache, have a look at mod_auth_external
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With