Show More
@@ -27,6 +27,7 b' Once installed you need to enable ``dav_' | |||
|
27 | 27 | |
|
28 | 28 | $ sudo a2enmod dav_svn |
|
29 | 29 | $ sudo a2enmod headers |
|
30 | $ sudo a2enmod authn_anon | |
|
30 | 31 | |
|
31 | 32 | |
|
32 | 33 | Configuring Apache Setup |
@@ -55,7 +56,7 b' permission issues could occur. To do thi' | |||
|
55 | 56 | export APACHE_RUN_GROUP=rhodecode |
|
56 | 57 | |
|
57 | 58 | 1. To configure Apache, create and edit a virtual hosts file, for example |
|
58 |
:file:`/etc/apache2/sites- |
|
|
59 | :file:`/etc/apache2/sites-enabled/default.conf`. Below is an example | |
|
59 | 60 | how to use one with auto-generated config ```mod_dav_svn.conf``` |
|
60 | 61 | from configured |RCE| instance. |
|
61 | 62 |
@@ -16,7 +16,7 b'' | |||
|
16 | 16 | # `Include` directive. See the following example snippet of a virtual host how |
|
17 | 17 | # to include this configuration file. |
|
18 | 18 | # |
|
19 |
# <VirtualHost *:80 |
|
|
19 | # <VirtualHost *:8090> | |
|
20 | 20 | # ServerAdmin webmaster@localhost |
|
21 | 21 | # DocumentRoot /var/www/html |
|
22 | 22 | # ErrorLog ${'${APACHE_LOG_DIR}'}/error.log |
@@ -38,7 +38,11 b'' | |||
|
38 | 38 | |
|
39 | 39 | # fix https -> http downgrade with DAV. It requires an header downgrade for |
|
40 | 40 | # https -> http reverse proxy to work properly |
|
41 | % if use_https: | |
|
41 | 42 | RequestHeader edit Destination ^https: http: early |
|
43 | % else: | |
|
44 | #RequestHeader edit Destination ^https: http: early | |
|
45 | % endif | |
|
42 | 46 | |
|
43 | 47 | <Location "${location_root|n}"> |
|
44 | 48 | # The mod_dav_svn module takes the username from the apache request object. |
@@ -68,7 +68,8 b' class TestModDavSvnConfig(object):' | |||
|
68 | 68 | list_parent_path=True, |
|
69 | 69 | location_root=self.location_root, |
|
70 | 70 | repo_groups=repo_groups, |
|
71 | realm=self.realm | |
|
71 | realm=self.realm, | |
|
72 | use_ssl=True | |
|
72 | 73 | ) |
|
73 | 74 | # Assert that one location directive exists for each repository group. |
|
74 | 75 | for group in repo_groups: |
@@ -79,13 +80,15 b' class TestModDavSvnConfig(object):' | |||
|
79 | 80 | self.assert_root_location_directive(generated_config) |
|
80 | 81 | |
|
81 | 82 | @pytest.mark.parametrize('list_parent_path', [True, False]) |
|
82 | def test_list_parent_path(self, list_parent_path): | |
|
83 | @pytest.mark.parametrize('use_ssl', [True, False]) | |
|
84 | def test_list_parent_path(self, list_parent_path, use_ssl): | |
|
83 | 85 | generated_config = utils._render_mod_dav_svn_config( |
|
84 | 86 | parent_path_root=self.parent_path_root, |
|
85 | 87 | list_parent_path=list_parent_path, |
|
86 | 88 | location_root=self.location_root, |
|
87 | 89 | repo_groups=self.get_repo_group_mocks(count=10), |
|
88 | realm=self.realm | |
|
90 | realm=self.realm, | |
|
91 | use_ssl=use_ssl | |
|
89 | 92 | ) |
|
90 | 93 | |
|
91 | 94 | # Assert that correct configuration directive is present. |
@@ -95,3 +98,10 b' class TestModDavSvnConfig(object):' | |||
|
95 | 98 | else: |
|
96 | 99 | assert re.search('SVNListParentPath\s+Off', generated_config) |
|
97 | 100 | assert not re.search('SVNListParentPath\s+On', generated_config) |
|
101 | ||
|
102 | if use_ssl: | |
|
103 | assert 'RequestHeader edit Destination ^https: http: early' \ | |
|
104 | in generated_config | |
|
105 | else: | |
|
106 | assert '#RequestHeader edit Destination ^https: http: early' \ | |
|
107 | in generated_config |
@@ -25,6 +25,7 b' from pyramid.renderers import render' | |||
|
25 | 25 | |
|
26 | 26 | from rhodecode.events import trigger |
|
27 | 27 | from rhodecode.lib.utils import get_rhodecode_realm, get_rhodecode_base_path |
|
28 | from rhodecode.lib.utils2 import str2bool | |
|
28 | 29 | from rhodecode.model.db import RepoGroup |
|
29 | 30 | |
|
30 | 31 | from . import config_keys |
@@ -42,7 +43,10 b' def generate_mod_dav_svn_config(registry' | |||
|
42 | 43 | repositories organized in sub folders. |
|
43 | 44 | """ |
|
44 | 45 | settings = registry.settings |
|
46 | use_ssl = str2bool(registry.settings['force_https']) | |
|
47 | ||
|
45 | 48 | config = _render_mod_dav_svn_config( |
|
49 | use_ssl=use_ssl, | |
|
46 | 50 | parent_path_root=get_rhodecode_base_path(), |
|
47 | 51 | list_parent_path=settings[config_keys.list_parent_path], |
|
48 | 52 | location_root=settings[config_keys.location_root], |
@@ -55,7 +59,8 b' def generate_mod_dav_svn_config(registry' | |||
|
55 | 59 | |
|
56 | 60 | |
|
57 | 61 | def _render_mod_dav_svn_config( |
|
58 |
parent_path_root, list_parent_path, location_root, repo_groups, realm |
|
|
62 | parent_path_root, list_parent_path, location_root, repo_groups, realm, | |
|
63 | use_ssl): | |
|
59 | 64 | """ |
|
60 | 65 | Render mod_dav_svn configuration to string. |
|
61 | 66 | """ |
@@ -72,6 +77,7 b' def _render_mod_dav_svn_config(' | |||
|
72 | 77 | 'repo_group_paths': repo_group_paths, |
|
73 | 78 | 'svn_list_parent_path': list_parent_path, |
|
74 | 79 | 'rhodecode_realm': realm, |
|
80 | 'use_https': use_ssl | |
|
75 | 81 | } |
|
76 | 82 | |
|
77 | 83 | # Render the configuration template to string. |
@@ -162,13 +162,13 b'' | |||
|
162 | 162 | </div> |
|
163 | 163 | <div class="input"> |
|
164 | 164 | ${h.text('vcs_svn_proxy_http_server_url',size=59)} |
|
165 | % if c.svn_proxy_generate_config: | |
|
166 | <span class="buttons"> | |
|
167 | <button class="btn btn-primary" id="vcs_svn_generate_cfg">${_('Generate Apache Config')}</button> | |
|
168 | </span> | |
|
169 | % endif | |
|
165 | 170 | </div> |
|
166 | 171 | </div> |
|
167 | % if c.svn_proxy_generate_config: | |
|
168 | <div class="buttons"> | |
|
169 | <button class="btn btn-primary" id="vcs_svn_generate_cfg">${_('Generate Apache Config')}</button> | |
|
170 | </div> | |
|
171 | % endif | |
|
172 | 172 | </div> |
|
173 | 173 | </div> |
|
174 | 174 | % endif |
General Comments 0
You need to be logged in to leave comments.
Login now