Friday, 7 June 2013

Git and (gitweb) and SVN both over HTTPS at same time

Git and (gitweb) and SVN both over HTTPS at same time

I'm trying to run both a Git server over http and I already have SVN running over http as well. I'm runnning centos 6
My git.conf (located in /etc/httpd/conf.d/) file looks like
LoadModule authnz_ldap_module modules/mod_authnz_ldap_module.so LoadModule ldap_module modules/mod_ldap.so
ServerName blahblah/git/repos DocumentRoot /var/www/git/repos
SSLEngine on

SSLCertificateFile /etc/ssl/server.crt
SSLCertificateKeyFile /etc/ssl/server.key
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown

ErrorLog /var/log/httpd/git-error.log
CustomLog /var/log/httpd/git-access.log combined

# Enable cgi-bin scripts
Options ExecCGI FollowSymLinks
AddHandler cgi-script cgi


 # Configure Git HTTP Backend
SetEnv GIT_PROJECT_ROOT /var/www/git
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv GITWEB_CONFIG /etc/gitweb.conf

# Note: Serve static files directly
AliasMatch ^/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$          /var/www/git/$1
AliasMatch ^/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/www/git/$1
# Note: Serve repository objects with Git HTTP backend
ScriptAliasMatch \
      "(?x)^/(.*/(HEAD | \
                  info/refs | \
                  objects/info/[^/]+ | \
                  git-(upload|receive)-pack))$" \
      /usr/libexec/git-core/git-http-backend/$1
# Note: Serve HTML with Gitweb
ScriptAlias / gitweb/gitweb.cgi


# Turning on mod rewrite
RewriteEngine on

# Make the front page an internal rewrite to the gitweb script
RewriteRule ^/$  /gitweb/gitweb.cgi [L]

# Make shortcut for a repostitory, so URL like http://git.example.com/my_repository.git
# loads proper repository in Gitweb
RewriteRule ^/(\w+\.git)$  /?p=$1 [L,P]

# Route Git-Http-Backend
ScriptAlias / /usr/lib/git-core/git-http-backend/

# Require Acces for all resources
<Location /var/www/git/repos>
 AuthLDAPURL ldap://blah:3268/dc=blah,dc=blah?sAMAccountName?sub NONE
    AuthzLDAPAuthoritative off
    AuthzGroupFileAuthoritative off
    AuthzUserAuthoritative off
    AuthLDAPBindDN blah@blah
    AuthLDAPBindPassword "blah"
    AuthType Basic
    AuthName "blah"
    AuthBasicProvider ldap

    # Important, otherwise "(9)Bad file descriptor: Could not open password file: (null)"
    AuthUserFile /dev/null

    Require valid-user
</Location>
My subversion.conf file looks like this (located in /etc/httpd/conf.d/subversion.conf)
<Location /repos>
   DAV svn
   SVNPath /var/www/svn/repos

    # search user (192.168.1.1 is the IP address of the Active Directory server)
    AuthLDAPURL ldap://blah:3268/dc=blah,dc=blah?sAMAccountName?sub NONE
    AuthzLDAPAuthoritative off
    AuthzGroupFileAuthoritative off
    AuthzUserAuthoritative off
    AuthLDAPBindDN blah@blah
    AuthLDAPBindPassword blah
    AuthType Basic
    AuthName "blah"
    AuthBasicProvider ldap

    # Important, otherwise "(9)Bad file descriptor: Could not open password file: (null)"
    AuthUserFile /dev/null

    Require valid-user
</Location>

No comments:

Post a Comment