4

I have the project to set up a git server for my school with a web interface to create repositories and display them. This web part will be handled by Django, which knows the users.

Now the problem: I want authentication to pull and push private repositories but I can't use SSH to handle that part (the IT guys don't want to do support on that). The HTTP protocol is read-only without "complexe WebDAV" (according to the official doc) and use .htaccess as authentication. The problem with .htaccess is to manage them with Django: I tried to use a Django user's hash in it but it didn't work. And, finally, the Git protocol is read-write but it lacks authentication.

Summing up:

  • I want authentication linked with Django's users database. (To avoid having multiple places with same data)
  • No SSH
  • Avoid WebDAV and .htaccess

With these constraints I found that rewriting the git daemon (code on github) to handle authentication would be an idea but I don't know for sure how a Git client would react to that.

If you guys have another idea or want to tell me how better it would be to use WebDAV/.htaccess/..., I will be glad to hear it !

1 Answer 1

3

You could setup an Apache server (even one with https like I do in my config!), except you would ask your wsgi application to handle the authentication.

See "Access Control Mechanisms", in the mod_wsgi:

AuthType Basic
AuthName "Top Secret"
AuthBasicProvider wsgi
WSGIAuthUserScript /usr/local/wsgi/scripts/auth.wsgi
Require valid-user

The auth.wsgi script can check the credentials against your Django users database.

That solution means calling the git-http-backend (smart http transport), which is ore efficient than WebDAV.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks ! Seems to be exactly what I wanted, let's try to implements it. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.