Facing new challenges everyday

How to setup windows domain authentication on mercurial repositories

October 15th, 2008

After few days searching for something about how to setup a mercurial repository with Windows domain authentication, I finally found a way to do it.

In order to get all this stuff running you must download the following softwares:

  • Python 2.5
  • Apache 2.2
  • Mercurial 1.0.2 (Windows installer)
  • mod_wsgi
  • mod_auth_sspi

The first software to be installed is Python 2.5, please install it on c:python25, once the instalation finishes you can install Apache 2.2 too.

1. Loading a configuring mod_wsgi and mod_auth_sspi on apache

Now you must copy mod_wsgi.so and mod_auth_sspi to modules folder of your apache installation directory, open the http.conf file an add the following lines:

httpd.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
LoadModule wsgi_module modules/mod_wsgi.so
LoadModule sspi_auth_module modules/mod_auth_sspi.so

WSGIScriptAlias / "c:/mercurial/scripts/public.wsgi"
WSGIPythonPath "c:/python25;c:/mercurial/library"
<Directory "c:/mercurial/scripts">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
   
    AuthName "Mercurial Repository"
    AuthType SSPI
    SSPIAuth On
    SSPIAuthoritative On
    SSPIOfferBasic On    
    SSPIBasicPreferred On  
    SSPIDomain YOURDOMAIN
   
    require valid-user
</Directory>

2. Configuring hgwebdir application

Create a file named public.wsgi and add the following lines to this file:

public.wsgi

1
2
3
4
5
from mercurial.hgweb.hgweb_mod import hgweb
from mercurial.hgweb.hgwebdir_mod import hgwebdir

CONFIG = 'c:/mercurial/scripts/public.config'
application = hgwebdir(CONFIG)

The script above will load the configurations setting on public.config file and then the hgwebdir application will be initialized, this application will allow us to manage multiple mercurial repositories easily, this application requires few parameters that are defined on public.config file as mentioned previously.

Create a file named public.config and add the following lines to this file:

public.config

1
2
3
[paths]
yourproject = c:/repositories/yourproject
templates = c:/mercurial/library

3. Installing mercurial

Please run the mercurial installer and install its binaries on c:mercurial folder and then extract the file library.zip inside this folder, a new folder called c:mercuriallibrary will be created, you must move c:mercurialtemplates folder to c:mercuriallibrary folder.

4. Creating our first mercurial repository

Open a console window and type the following commands:

mkdir repositories
cd c:repositories
mkdir yourproject
cd yourproject
hg init

The hg init command will prepare this folder to act as mercurial repository, now you are ready to use your mercurial repository.

5. Working with mercurial repositories

The first thing that you need to do before start to work on mercurial repositories is make a copy of remote repository, to do it you must run the following command:

hg clone http://servername:port/yourproject

A new directory called yourproject will be created, you can do any changes that you want and then you can save the changes on remote server by executing hg commit and hg push commands, all the other uses can obtaing the latest version of project sources by executing hg pull and hg update commands.

DZoneGoogle BookmarksFacebookEvernoteLinkedInDeliciousShare

1 Comment »

  1. rogerio says

    You can easily replace sspi auth with ldap auth, just follow configuration steps described here.

    October 19th, 2008 | #

Leave a comment

:mrgreen: :neutral: :twisted: :shock: :smile: :???: :cool: :evil: :grin: :oops: :razz: :roll: :wink: :cry: :eek: :lol: :mad: :sad:
*

RSS feed for these comments. | TrackBack URI

Visitors Around the World

Polls

How Is My Site?

View Results

Loading ... Loading ...

Categories

Meta

Links

hosted by easy2use.net