git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Fwd: Separately repository access in GitWeb

From
Андрей Баранов <admin@andrej-andb.ru>
Date
Jan 25, 2013, 09:00 UTC
Message-ID
<CAJjU7bQ65q_oznTV57oMM4XPkHrEUwZ-TZ4UzRHp=k7VkfMDGg@mail.gmail.com>
In-Reply-To
<CAJjU7bS-rRr-UuEA_xcqtTY4+tWKshL+Rvey85n70KacSnTorQ@mail.gmail.com>
good day.
I`m trying make separately repository access in GitWeb by NGINX

separation of access based on URL strings, namely, the presence of the query strings: '?p=repo.git' with a regular expression: "^.*p=(.*?)(\.git|;|&|=|\s).*$"

I am wondering how much it is correct to protect against unauthorized access.
Thanks in advance :)
complete example of a configuration file:
server {
        listen 80;
root /home/git/gitweb;
        access_log /var/log/nginx/gitweb.access_log main;
        error_log /var/log/nginx/gitweb.error_log info;
        index gitweb.cgi;
gzip off;
    location ~* \.(jpg|txt|jpeg|gif|png|ico|css|zip|js|swf)$ {
access_log        off;
        expires 1d;
    }
    location = / {
set $htpasswd "opened@";
if ($args ~* "^.*p=(.*?)(\.git|;|&|=|\s).*$") {
set $htpasswd /home/git/.gitolite/conf/$1_htpasswd;
        }
        if (-f $htpasswd) {
                rewrite ^.*$  /closed last;
        }
rewrite ^.*$ /guest last;
    }
    location = /closed {
internal;
access_log /var/log/nginx/gitweb-closed.access_log main;
auth_basic "Unauthorized";
        auth_basic_user_file $htpasswd;
        include fastcgi_params;
        fastcgi_param  SCRIPT_NAME gitweb.cgi;
        fastcgi_param SCRIPT_FILENAME /home/git/gitweb/gitweb.cgi;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
    }
    location = /guest {
internal;
access_log /var/log/nginx/gitweb-guest.access_log main;
        include fastcgi_params;
fastcgi_param  SCRIPT_NAME gitweb.cgi;
fastcgi_param SCRIPT_FILENAME /home/git/gitweb/gitweb.cgi;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
    }
    location  / {
        rewrite (.*) / permanent;
    }
}
Previous: Андрей Баранов
Message 2 of 2 in “Separately repository access in GitWeb”
  1. Андрей БарановJan 25, 2013
  2. Fwd: Separately repository access in GitWebАндрей Баранов, Jan 25, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.