How to make Subversion use Linux system accounts for authentication?

别说谁变了你拦得住时间么 提交于 2019-12-02 23:45:42

Ok! I did it! And I thought it would be very hard to find the answer!

We have to tell Apache to use an "external authentication provider", Apache won't be checking for authentication, but will delegate the task to an external authenticator, in this case, the marvellous pwauth.

So the steps I did to make it work was:

  1. Install Mod_Auth_External module for Apache2 and pwauth

    sudo apt-get install libapache2-mod-authnz-external pwauth
    
  2. Enabled the new module for Apache: sudo a2enmod authnz_external in terminal.

  3. Configured my apache.conf (or you may have httpd.conf) to add the external authenticator (based on this article):

    AddExternalAuth pwauth /usr/local/libexec/pwauth
    SetExternalAuthMethod pwauth pipe
    
  4. Edited my /etc/apache2/mods-available/dav_svn.conf to set the new external auth provider:

    ...
    AuthType Basic
    AuthName "Subversion Repository"
    AuthBasicProvider external
    AuthExternal pwauth
    Require valid-user
    ...
    
  5. Tested and worked fine!

Couldn't you use ssh to access subversion repositories instead of WebDAV?

svn checkout svn+ssh://user@server:/home/svn/repository/trunk

I can't comment yet, but wanted to add that in Ubuntu 12.04 the path of pwauth has changed so now this should be

AddExternalAuth pwauth /usr/sbin/pwauth
SetExternalAuthMethod pwauth pipe

and this can be conveniently placed in a separate file inside etc/apache2/conf.d

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!