# Forbid access to /gitweb but authorize the sub projets

2 messages from 2016-11-07 to 2016-11-09. Participants: Alexandre Duplaix, Dennis Kaarsemaker.
Thread: https://gitlist.dev/t/44434

## Alexandre Duplaix, 2016-11-07 13:07

Subject: Forbid access to /gitweb but authorize the sub projets
Message-ID: <58207CAB.3060105@sagemcom.com>
URL: https://gitlist.dev/e/58207CAB.3060105%40sagemcom.com

```
Hello,

I have several projects under https://myserver/gitweb and I would like 
to forbid the access to the root, so that the users can't list the 
differents projects.

However, I need to let the access to the sub projects (ex: 
https://myserver/gitweb/?p=project1;a=summary

How can I do please ?

Thank you in advance :)

" Ce courriel et les documents qui lui sont joints peuvent contenir des
informations confidentielles ou ayant un caract�re priv�. 
S'ils ne vous sont pas destin�s nous vous signalons qu'il est strictement interdit de les
divulguer, de les reproduire ou d'en utiliser de quelque mani�re que ce
soit le contenu. Si ce message vous a �t� transmis par erreur, merci d'en
informer l'exp�diteur et de supprimer imm�diatement de votre syst�me
informatique ce courriel ainsi que tous les documents qui y sont attach�s"

                               ******

" This e-mail and any attached documents may contain confidential or
proprietary information. If you are not the intended recipient, you are
notified that any dissemination, copying of this e-mail and any attachments
thereto or use of their contents by any means whatsoever is strictly
prohibited. If you have received this e-mail in error, please advise the
sender immediately and delete this e-mail and all attached documents
from your computer system."
#


```

## Dennis Kaarsemaker, 2016-11-09 08:25

Subject: Re: Forbid access to /gitweb but authorize the sub projets
Message-ID: <1478679951.12904.1.camel@kaarsemaker.net>
URL: https://gitlist.dev/e/1478679951.12904.1.camel%40kaarsemaker.net
In-Reply-To: <58207CAB.3060105@sagemcom.com>

```
On Mon, 2016-11-07 at 14:07 +0100, Alexandre Duplaix wrote:
> Hello,
> 
> I have several projects under https://myserver/gitweb and I would like 
> to forbid the access to the root, so that the users can't list the 
> differents projects.
> 
> However, I need to let the access to the sub projects (ex: 
> https://myserver/gitweb/?p=project1;a=summary
> 
> How can I do please ?

My favourite way of doing this is abusing the fact that gitweb.conf is
perl code that's loaded with do $filename.

This makes it easy to override such things. Try this in gitweb.conf for example:

sub no_index {
    die_error(403, "No access to the repository list");
}
$actions{project_list} = \&no_index;
$actions{project_index} = \&no_index;
$actions{opml} = \&no_index;

-- 
Dennis Kaarsemaker
http://www.kaarsemaker.net

```
