Dear misc@ readers,

I'm trying to set up a git server with HTTP as transfer protocol, using
httpd(8) in base; considering that info on the net are very sparse
when apache isn't the subject and that I'm completely a newbie of this
matter, it isn't difficult to understand that I'm a bit lost...

First things first, this is what I would like to achieve:

- the bare repositories should be located at /var/www/git, so they
  should be accessible in the chroot-ed environment;

- the access to the repos for cloning and pushing should be protected by
  a userID/passwd mechanism.

I ended up with the following httpd config:

# cat /etc/httpd.conf
# $OpenBSD: httpd.conf,v 1.14 2015/02/04 08:39:35 florian Exp $

#
# Macros
#
ext_addr="*"

#
# Global Options
#
prefork 3

#
# Servers
#

# A minimal (secure) server
server "atlantide.t28.net" { 
        listen on $ext_addr tls port 443 
        tls {
                certificate "/etc/ssl/https.crt"
                key "/etc/ssl/private/https.key"
        }
        root "/htdocs/atlantide.t28.net"

        location "/restricted/*" {
                directory auto index
                authenticate with 
"/htdocs/atlantide.t28.net/restricted/.htaccess"
        }
        location "/git" {
                authenticate with "/git/.htaccess"
                fastcgi socket "/run/slowcgi.sock"
                root "/git/git-http-backend"
        }
}


This is the content of the /var/www/git directory:

# ls -la /var/www/git
total 1776
drwxr-xr-x   3 www   daemon     512 Aug 14 11:34 .
drwxr-xr-x  10 root  daemon     512 Aug 14 10:14 ..
-rw-------   1 www   daemon      68 Aug 14 10:21 .htaccess
drwxr-xr-x   7 www   daemon     512 Aug 14 10:17 dotfiles.git
-r-xr-xr-x   1 root  daemon  884442 Aug 14 10:23 git-http-backend

(where .htaccess contains the users' credentials and git-http-backend is
a copy of /usr/local/libexec/git/git-http-backend).

slowcgi is running, too:

# ls -la /var/www/run/slowcgi.sock
srw-rw----  1 www  www  0 Aug 14 10:12 /var/www/run/slowcgi.sock

If I point my browser to https://atlantide.t28.net/git, I'm asked for my
credentials, so the authentication method is working properly.

But if I try to access the dotfiles.git repository from a remote git
client, I obtain:

┌──[just22@poseidon]-[0]-[✓]-[tmp]
└─────› git clone https://atlantide.t28.net/git/dotfiles.git
Cloning into 'dotfiles'...
fatal: repository 'https://atlantide.t28.net/git/dotfiles.git/' not found

Now, for sure a lot of things are still missing in this configuration,
but again: I definitely need some help here.

The first thing that comes to my mind is: I know that I should set the
two "environmental" variables GIT_PROJECT_ROOT (to /git I suppose) and
GIT_HTTP_EXPORT_ALL, but I don't know how to export them to the CGI
script...

Any additional hints (and of course, any corrections) are welcome, of
course.

Thanks in advance

--
Alessandro DE LAURENZIS
[mailto:just22....@gmail.com]
LinkedIn: http://it.linkedin.com/in/delaurenzis

Reply via email to