SVN Server on CentOS 5.8 [closed] - apache

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am tring to setup a subversion server on CentOS 5.8 (CentOS release 5.8 (Final)). I have only a little experience with CentOS. I only have worked with SuSE and Ubuntu so far.
The problem I have is, when I try to access my SVN repository via http://domain.tld/svn I get "Forbidden, You don't have permission to access /svn/ on this server.".
These are the steps for my setup:
yum install mod_dav_svn subversion
Content of /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn>
DAV svn
SVNParentPath /var/www/svn
</Location>
Create related paths
mkdir -p /var/www/svn && cd /var/www/svn
svnadmin create repos
chown -R apache:apache repos
service httpd restart
I cant figure out, whats wrong...
Other sources on CentOS 5.7 suggested this as an additional step:
chcon -R -t httpd_sys_content_t /var/www/svn/repos
chcon -R -t httpd_sys_rw_content_t /var/www/svn/repos
When I execute this, I get chcon: can't apply partial context to unlabeled file /var/www/svn/repos
So I looked around and found a User that said, I should use
chcon -h system_u:object_r:httpd_sys_content_t /var/www/svn/repos
chcon -R -h apache:object_r:httpd_sys_content_t /var/www/svn/repos/*
instead of
chcon -R -t httpd_sys_content_t /var/www/svn/repos
so I added also 2 lines for httpd_sys_rw_content_t:
chcon -h system_u:object_r:httpd_sys_content_t /var/www/svn/repos
chcon -R -h apache:object_r:httpd_sys_content_t /var/www/svn/repos/*
chcon -h system_u:object_r:httpd_sys_rw_content_t /var/www/svn/repos
chcon -R -h apache:object_r:httpd_sys_rw_content_t /var/www/svn/repos/*
Problem still remains...
service httpd restart
Problem still remains...
EDIT
I also have added authentication rules to the subversion.conf:
<LimitExcept GET PROPFIND OPTIONS REPORT>
AuthzSVNAccessFile /etc/subversion/svn-access
# Require SSL connection for password protection.
# SSLRequireSSL
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /etc/subversion/svn-passwd
Require valid-user
</LimitExcept>
These configuration rules are copied from a previous running installation under SuSE. The files have valid content. Problem still remains...
EDIT
I have removed the <LimitExcept GET PROPFIND OPTIONS REPORT> and </LimitExcept> lines, so that the authentication always applies. When I now access svn from the browser, I get an HTTP-Basic-Auth windows. After I have entered existing and correct credentials, the "Forbidden" message comes up again. Problem still remains...
EDIT
I finally got it running. I have set the repository path via SVNPath /var/www/svn/repos instead of SVNParentPath /var/www/svn. Now everything is fine...

You have to instruct Apache to perform authentication (so that Subversion will have a user to use with the rules
In you location add something like this to you <Location> directive:
SSLRequireSSL
AuthType Basic
AuthPAM_Enabled on
AuthName "Subversion"
AuthUserFile /etc/shadow
Require valid-user
This example uses PAM but there are many other possibilities: refer to the Apache httpd manual

Try this:
<Location /svn>
DAV svn
SVNPath /var/www/svn
</Location>

Related

Access to /svn is forbidden

I set up SVN on Ubuntu using the tutorial How to set up a Subversion (SVN) server on GNU/Linux - Ubuntu, but when I try access the repository from other machine using CMD it says Access to /SVN is forbidden.
I changed the permission of the folder and tried other methods to resolve the issue like configuration of the Apache server, but that did not solve my problem.
How can I fix this problem?
Apache can read and write the repository, but its user (www-data) needs to be given ownership of it:
sudo chown -R www-data:www-data /var/svn/repositories/your_repo
To be able to authenticate users who access the repository a password file is needed:
sudo htpasswd -c /etc/subversion/passwd your_user_name
Enter a password for the user your_user_name. For additional users repeat the command without the -c option to make sure the existing file is appended to rather than replaced.
Then edit the Apache configuration file:
sudo gedit /etc/apache2/apache2.conf
Add the following to the end of the file:
#svn users
<Location /svn>
DAV svn
SVNParentPath /var/svn/repositories/
SVNListParentPath On
AuthType Basic
AuthName "Test"
AuthUserFile /etc/subversion/passwd
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>
Save the configuration file and restart Apache:
sudo /etc/init.d/apache2 restart
The test repository can now be accessed via:
http://localhost/svn/your_repo
Make sure you have your virtual host set up like this for Apache:
<VirtualHost *:80>
DocumentRoot /home/svn/html
ServerName svn.domainname
ErrorLog logs/svn.domain.com-error_log
CustomLog logs/svn.domain.com-access_log common
<Directory "/home/svn/html">
Order allow,deny
Allow from all
AllowOverride all
</Directory>
<Location /repos>
DAV svn
SVNParentPath /home/svn/repos
Require valid-user
SVNListParentPath on
AuthType Basic
AuthName "Your Super SVN"
AuthUserFile /home/svn/svn-passwords-file-to-be-used-only-when-AuthType-is-used
AuthzSVNAccessFile /home/svn/svn-repos-acl-file-but-optional
</Location>
</VirtualHost>
And make sure Apache can access the repos folder mentioned in SVNParentPath. This issue is mostly because of permissions. Try chmod -R 0777 repos-folder and try again.
This might help someone if they are troubleshooting a setup that had previously been working. Today the new guy at our company inadvertently introduced a typo in the file used by AuthzSVNAccessFile and that caused all of us to experience the dreaded E175013

SVN Repo gives 404 not Found

I have installed svn, version 1.6.17 (r1128011) on to Ubuntu 12-04
I made my repo here:
$ sudo mkdir /home/2nd-disk/svn
Set up my /etc/apache2/mods-enabled/dav_svn.conf
<Location /svn>
DAV svn
SVNParentPath /home/2nd-disk/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
</Location>
Created an account:
sudo htpasswd -cm /etc/apache2/dav_svn.passwd myusername
Created a test repo
$ cd /home/2nd-disk/svn
$ sudo svnadmin create test_repo
Ran a chown:
$ sudo chown -R www-data:www-data /home/2nd-disk/svn
Insured a2enmod & dav_svn are loaded and restarted apache2:
$ sudo a2enmod dav_svn && sudo service apache2 restart
Considering dependency dav for dav_svn:
Module dav already enabled
Module dav_svn already enabled
* Restarting web server apache2
... waiting
I then try to browse to http://mydomain.com/svn/test_repo and I get a 404 not found.
The same happens with http://mydomain.com/svn/test_repo
Going to http://mydomain.com shows the default 'It Works!' apache page.
Do I need to change virtual hosts here? I followed this tutorial below to the T and so assumed not:
http://rbgeek.wordpress.com/2012/05/01/svn-server-on-ubuntu-12-04-lts-with-web-access/
I have this problem sovled just now .
prep. I set up my /etc/apache2/http.conf
LoadModule dav_module /usr/lib/apache2/mod_dav.so
LoadModule dav_svn_module /usr/lib/apache2/mod_dav_svn.so
LoadModule authz_svn_module /usr/lib/apache2/mod_authz_svn.so
It works for a period without 404 while I then try to browse to http://mydomain.com/svn/test_repo .But after I reboot my Linux, I get a 404 not found.
Try to add the lines to /etc/apache2/conf.d.subversion.conf
LoadModule dav_module /usr/lib/apache2/mod_dav.so
LoadModule dav_svn_module /usr/lib/apache2/mod_dav_svn.so
LoadModule authz_svn_module /usr/lib/apache2/mod_authz_svn.so
My SVN works well now! I wish these recommendations can help you.
add the reference to your vhost instead of dav_svn.conf:
<Location /svn>
DAV svn
SVNPath /var/local/svn
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /etc/apache2/dav_svn.passwd
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>
good tutorial is here: http://wiki.ubuntuusers.de/Subversion
don't forget to restart apache to apply changes:
sudo /etc/init.d/apache2 restart

Configuring SVN server on Apache on Ubuntu 12.04

I'm trying to access an existing Subversion server over HTTP. My dav_svn.conf file looks like:
<Location /svn>
DAV svn
SVNParentPath /home/svn/repos
SVNListParentPath on
AuthType Basic
AuthName "Restricted Access"
AuthUserFile /home/svn/passwdfile
Require valid-user
AuthzSVNAccessFile /home/svn/accessfile
</Location>
But when I'm trying to access "some-site/svn", I'm getting the following error:
The requested URL /svn/ was not found on this server.
The Apache error log shows "file does not exist: /var/www/svn"
How do I resolve this?
Run this:
a2enmod dav_svn
service apache2 restart
as super user (root), e.g. sudo a2enmod dav_svn && sudo service apache2 restart.
This assumes that you are using the proper method (Debian+Ubuntu) of editing the two files: /etc/apache2/mods-available/dav_svn.{conf,load}, not some homebrew method.

Set up user access per git repo on Apache on Windows

I'm setting up git repos to be served by Apache on windows. Httpd.conf is pretty straight forward - it forwards requests to git-http-backend and tells Apache to allow access for authenticated users only. It works fine. However what is needed is the ability to specify different AuthUserFile for each repo - for RepoOne.git user usersOneGroup, for RepoTwo.git usersTwoGroup.
I tried specifying different folders within Directory (DirectoryMatch etc) directives but couldn't get it working. Is there a way to set it up? If so how?
The relevant httpd.conf section (borrowed from this post mainly):
<Directory />
AuthType Basic
AuthName "git repos"
AuthUserFile "c:\CommittersPasswords"
Require valid-user
</Directory>
SetEnv GIT_PROJECT_ROOT C:/Repositories
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAliasMatch \
"(?x)^/(.*/(HEAD | \
info/refs | \
objects/(info/[^/]+ | \
[0-9a-f]{2}/[0-9a-f]{38} | \
pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
git-(upload|receive)-pack))$" \
"C:/Program Files (x86)/git/libexec/git-core/git-http-backend.exe/$1"
Thanks
If you can live without Apache (or if you are willing to use Apache as a reverse proxy) you might see if Gitblit would work for you. Gitblit was written to be an integrated pure Java Git solution for small workgroups.

Subversion (svn) integration with Apache?

I am running a website on my server with Apache, and I have also setup SVN with Apache.
The problem arises when I make changes in httpd.conf to setup SVN and restart Apache. It starts to serve files as SVN, but it stops my website. Then every user can see my source code.
I want to make my server as development server and production server. How can I run Apache for SVN and host my website?
First install dav svn:
apt-get install libapache2-svn
root#example:/var# mkdir svn
root#example:/var# cd svn
root#example:/var/svn# svnadmin create repo
a2enmod dav_svn
Change permissions for Apache:
chown -R root.www-data /var/svn
chmod -R g+rw /var/svn
Add the repository to a virtual host
<Location /svn/myrepo>
DAV svn
SVNPath /var/svn/repo
AuthType Basic
AuthName "My Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
</Location>
htpasswd2 /etc/apache2/dav_svn.passw user