##// END OF EJS Templates
vcs: expose SSL certificate path over the wire to the vcsserver....
ergo -
r3337:32bd6215 default
parent child Browse files
Show More
@@ -67,8 +67,7 b' def get_storage_size(storage_path):'
67 67 try:
68 68 sizes.append(os.path.getsize(storage_file))
69 69 except OSError:
70 log.exception('Failed to get size of storage file %s',
71 storage_file)
70 log.exception('Failed to get size of storage file %s', storage_file)
72 71 pass
73 72
74 73 return sum(sizes)
@@ -81,6 +80,16 b' def get_resource(resource_type):'
81 80 return 'NOT_SUPPORTED'
82 81
83 82
83 def get_cert_path(ini_path):
84 default = '/etc/ssl/certs/ca-certificates.crt'
85 control_ca_bundle = os.path.join(
86 os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(ini_path)))),
87 '.rccontrol-profile/etc/ca-bundle.crt')
88 if os.path.isfile(control_ca_bundle):
89 default = control_ca_bundle
90
91 return default
92
84 93 class SysInfoRes(object):
85 94 def __init__(self, value, state=None, human_value=None):
86 95 self.value = value
@@ -604,6 +613,7 b' def rhodecode_config():'
604 613 import rhodecode
605 614 path = rhodecode.CONFIG.get('__file__')
606 615 rhodecode_ini_safe = rhodecode.CONFIG.copy()
616 cert_path = get_cert_path(path)
607 617
608 618 try:
609 619 config = configparser.ConfigParser()
@@ -615,10 +625,6 b' def rhodecode_config():'
615 625 log.exception('Failed to read .ini file for display')
616 626 parsed_ini = {}
617 627
618 cert_path = os.path.join(
619 os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(path)))),
620 '.rccontrol-profile/etc/ca-bundle.crt')
621
622 628 rhodecode_ini_safe['server:main'] = parsed_ini
623 629
624 630 blacklist = [
@@ -35,7 +35,9 b' import msgpack'
35 35 import requests
36 36 from requests.packages.urllib3.util.retry import Retry
37 37
38 from . import exceptions, CurlSession
38 import rhodecode
39 from rhodecode.lib.system_info import get_cert_path
40 from rhodecode.lib.vcs import exceptions, CurlSession
39 41
40 42
41 43 log = logging.getLogger(__name__)
@@ -121,6 +123,8 b' class RemoteRepo(object):'
121 123 if log.isEnabledFor(logging.DEBUG):
122 124 self._call = self._call_with_logging
123 125
126 self.cert_dir = get_cert_path(rhodecode.CONFIG.get('__file__'))
127
124 128 def __getattr__(self, name):
125 129 def f(*args, **kwargs):
126 130 return self._call(name, *args, **kwargs)
@@ -132,6 +136,8 b' class RemoteRepo(object):'
132 136 # config object is being changed for hooking scenarios
133 137 wire = copy.deepcopy(self._wire)
134 138 wire["config"] = wire["config"].serialize()
139
140 wire["config"].append(('vcs', 'ssl_dir', self.cert_dir))
135 141 payload = {
136 142 'id': str(uuid.uuid4()),
137 143 'method': name,
@@ -80,14 +80,12 b' function registerRCRoutes() {'
80 80 pyroutes.register('admin_settings_search', '/_admin/settings/search', []);
81 81 pyroutes.register('admin_settings_labs', '/_admin/settings/labs', []);
82 82 pyroutes.register('admin_settings_labs_update', '/_admin/settings/labs/update', []);
83 pyroutes.register('admin_settings_automation', '/_admin/_admin/settings/automation', []);
84 83 pyroutes.register('admin_permissions_application', '/_admin/permissions/application', []);
85 84 pyroutes.register('admin_permissions_application_update', '/_admin/permissions/application/update', []);
86 85 pyroutes.register('admin_permissions_global', '/_admin/permissions/global', []);
87 86 pyroutes.register('admin_permissions_global_update', '/_admin/permissions/global/update', []);
88 87 pyroutes.register('admin_permissions_object', '/_admin/permissions/object', []);
89 88 pyroutes.register('admin_permissions_object_update', '/_admin/permissions/object/update', []);
90 pyroutes.register('admin_permissions_branch', '/_admin/permissions/branch', []);
91 89 pyroutes.register('admin_permissions_ips', '/_admin/permissions/ips', []);
92 90 pyroutes.register('admin_permissions_overview', '/_admin/permissions/overview', []);
93 91 pyroutes.register('admin_permissions_auth_token_access', '/_admin/permissions/auth_token_access', []);
@@ -106,8 +104,6 b' function registerRCRoutes() {'
106 104 pyroutes.register('user_delete', '/_admin/users/%(user_id)s/delete', ['user_id']);
107 105 pyroutes.register('user_force_password_reset', '/_admin/users/%(user_id)s/password_reset', ['user_id']);
108 106 pyroutes.register('user_create_personal_repo_group', '/_admin/users/%(user_id)s/create_repo_group', ['user_id']);
109 pyroutes.register('edit_user_auth_tokens', '/_admin/users/%(user_id)s/edit/auth_tokens', ['user_id']);
110 pyroutes.register('edit_user_auth_tokens_add', '/_admin/users/%(user_id)s/edit/auth_tokens/new', ['user_id']);
111 107 pyroutes.register('edit_user_auth_tokens_delete', '/_admin/users/%(user_id)s/edit/auth_tokens/delete', ['user_id']);
112 108 pyroutes.register('edit_user_ssh_keys', '/_admin/users/%(user_id)s/edit/ssh_keys', ['user_id']);
113 109 pyroutes.register('edit_user_ssh_keys_generate_keypair', '/_admin/users/%(user_id)s/edit/ssh_keys/generate', ['user_id']);
@@ -139,9 +135,7 b' function registerRCRoutes() {'
139 135 pyroutes.register('channelstream_connect', '/_admin/channelstream/connect', []);
140 136 pyroutes.register('channelstream_subscribe', '/_admin/channelstream/subscribe', []);
141 137 pyroutes.register('channelstream_proxy', '/_channelstream', []);
142 pyroutes.register('login', '/_admin/login', []);
143 138 pyroutes.register('logout', '/_admin/logout', []);
144 pyroutes.register('register', '/_admin/register', []);
145 139 pyroutes.register('reset_password', '/_admin/password_reset', []);
146 140 pyroutes.register('reset_password_confirmation', '/_admin/password_reset_confirmation', []);
147 141 pyroutes.register('home', '/', []);
@@ -236,8 +230,6 b' function registerRCRoutes() {'
236 230 pyroutes.register('edit_repo_advanced_hooks', '/%(repo_name)s/settings/advanced/hooks', ['repo_name']);
237 231 pyroutes.register('edit_repo_caches', '/%(repo_name)s/settings/caches', ['repo_name']);
238 232 pyroutes.register('edit_repo_perms', '/%(repo_name)s/settings/permissions', ['repo_name']);
239 pyroutes.register('edit_repo_perms_branch', '/%(repo_name)s/settings/branch_permissions', ['repo_name']);
240 pyroutes.register('edit_repo_perms_branch_delete', '/%(repo_name)s/settings/branch_permissions/%(rule_id)s/delete', ['repo_name', 'rule_id']);
241 233 pyroutes.register('edit_repo_maintenance', '/%(repo_name)s/settings/maintenance', ['repo_name']);
242 234 pyroutes.register('edit_repo_maintenance_execute', '/%(repo_name)s/settings/maintenance/execute', ['repo_name']);
243 235 pyroutes.register('edit_repo_fields', '/%(repo_name)s/settings/fields', ['repo_name']);
@@ -246,7 +238,6 b' function registerRCRoutes() {'
246 238 pyroutes.register('repo_edit_toggle_locking', '/%(repo_name)s/settings/toggle_locking', ['repo_name']);
247 239 pyroutes.register('edit_repo_remote', '/%(repo_name)s/settings/remote', ['repo_name']);
248 240 pyroutes.register('edit_repo_remote_pull', '/%(repo_name)s/settings/remote/pull', ['repo_name']);
249 pyroutes.register('edit_repo_remote_push', '/%(repo_name)s/settings/remote/push', ['repo_name']);
250 241 pyroutes.register('edit_repo_statistics', '/%(repo_name)s/settings/statistics', ['repo_name']);
251 242 pyroutes.register('edit_repo_statistics_reset', '/%(repo_name)s/settings/statistics/update', ['repo_name']);
252 243 pyroutes.register('edit_repo_issuetracker', '/%(repo_name)s/settings/issue_trackers', ['repo_name']);
@@ -258,7 +249,6 b' function registerRCRoutes() {'
258 249 pyroutes.register('edit_repo_vcs_svn_pattern_delete', '/%(repo_name)s/settings/vcs/svn_pattern/delete', ['repo_name']);
259 250 pyroutes.register('repo_reviewers', '/%(repo_name)s/settings/review/rules', ['repo_name']);
260 251 pyroutes.register('repo_default_reviewers_data', '/%(repo_name)s/settings/review/default-reviewers', ['repo_name']);
261 pyroutes.register('repo_automation', '/%(repo_name)s/settings/automation', ['repo_name']);
262 252 pyroutes.register('edit_repo_strip', '/%(repo_name)s/settings/strip', ['repo_name']);
263 253 pyroutes.register('strip_check', '/%(repo_name)s/settings/strip_check', ['repo_name']);
264 254 pyroutes.register('strip_execute', '/%(repo_name)s/settings/strip_execute', ['repo_name']);
@@ -295,8 +285,6 b' function registerRCRoutes() {'
295 285 pyroutes.register('my_account_update', '/_admin/my_account/update', []);
296 286 pyroutes.register('my_account_password', '/_admin/my_account/password', []);
297 287 pyroutes.register('my_account_password_update', '/_admin/my_account/password/update', []);
298 pyroutes.register('my_account_auth_tokens', '/_admin/my_account/auth_tokens', []);
299 pyroutes.register('my_account_auth_tokens_add', '/_admin/my_account/auth_tokens/new', []);
300 288 pyroutes.register('my_account_auth_tokens_delete', '/_admin/my_account/auth_tokens/delete', []);
301 289 pyroutes.register('my_account_ssh_keys', '/_admin/my_account/ssh_keys', []);
302 290 pyroutes.register('my_account_ssh_keys_generate', '/_admin/my_account/ssh_keys/generate', []);
@@ -333,4 +321,35 b' function registerRCRoutes() {'
333 321 pyroutes.register('debug_style_home', '/_admin/debug_style', []);
334 322 pyroutes.register('debug_style_template', '/_admin/debug_style/t/%(t_path)s', ['t_path']);
335 323 pyroutes.register('apiv2', '/_admin/api', []);
324 pyroutes.register('admin_settings_license', '/_admin/settings/license', []);
325 pyroutes.register('admin_settings_license_unlock', '/_admin/settings/license_unlock', []);
326 pyroutes.register('login', '/_admin/login', []);
327 pyroutes.register('register', '/_admin/register', []);
328 pyroutes.register('repo_reviewers_review_rule_new', '/%(repo_name)s/settings/review/rules/new', ['repo_name']);
329 pyroutes.register('repo_reviewers_review_rule_edit', '/%(repo_name)s/settings/review/rules/%(rule_id)s', ['repo_name', 'rule_id']);
330 pyroutes.register('repo_reviewers_review_rule_delete', '/%(repo_name)s/settings/review/rules/%(rule_id)s/delete', ['repo_name', 'rule_id']);
331 pyroutes.register('plugin_admin_chat', '/_admin/plugin_admin_chat/%(action)s', ['action']);
332 pyroutes.register('edit_user_auth_tokens', '/_admin/users/%(user_id)s/edit/auth_tokens', ['user_id']);
333 pyroutes.register('edit_user_auth_tokens_add', '/_admin/users/%(user_id)s/edit/auth_tokens/new', ['user_id']);
334 pyroutes.register('admin_settings_scheduler_show_tasks', '/_admin/settings/scheduler/_tasks', []);
335 pyroutes.register('admin_settings_scheduler_show_all', '/_admin/settings/scheduler', []);
336 pyroutes.register('admin_settings_scheduler_new', '/_admin/settings/scheduler/new', []);
337 pyroutes.register('admin_settings_scheduler_create', '/_admin/settings/scheduler/create', []);
338 pyroutes.register('admin_settings_scheduler_edit', '/_admin/settings/scheduler/%(schedule_id)s', ['schedule_id']);
339 pyroutes.register('admin_settings_scheduler_update', '/_admin/settings/scheduler/%(schedule_id)s/update', ['schedule_id']);
340 pyroutes.register('admin_settings_scheduler_delete', '/_admin/settings/scheduler/%(schedule_id)s/delete', ['schedule_id']);
341 pyroutes.register('admin_settings_scheduler_execute', '/_admin/settings/scheduler/%(schedule_id)s/execute', ['schedule_id']);
342 pyroutes.register('admin_settings_automation', '/_admin/settings/automation', []);
343 pyroutes.register('admin_settings_automation_update', '/_admin/settings/automation/%(entry_id)s/update', ['entry_id']);
344 pyroutes.register('admin_permissions_branch', '/_admin/permissions/branch', []);
345 pyroutes.register('admin_permissions_branch_update', '/_admin/permissions/branch/update', []);
346 pyroutes.register('my_account_auth_tokens', '/_admin/my_account/auth_tokens', []);
347 pyroutes.register('my_account_auth_tokens_add', '/_admin/my_account/auth_tokens/new', []);
348 pyroutes.register('my_account_external_identity', '/_admin/my_account/external-identity', []);
349 pyroutes.register('my_account_external_identity_delete', '/_admin/my_account/external-identity/delete', []);
350 pyroutes.register('repo_automation', '/%(repo_name)s/settings/automation', ['repo_name']);
351 pyroutes.register('repo_automation_update', '/%(repo_name)s/settings/automation/%(entry_id)s/update', ['repo_name', 'entry_id']);
352 pyroutes.register('edit_repo_remote_push', '/%(repo_name)s/settings/remote/push', ['repo_name']);
353 pyroutes.register('edit_repo_perms_branch', '/%(repo_name)s/settings/branch_permissions', ['repo_name']);
354 pyroutes.register('edit_repo_perms_branch_delete', '/%(repo_name)s/settings/branch_permissions/%(rule_id)s/delete', ['repo_name', 'rule_id']);
336 355 }
General Comments 0
You need to be logged in to leave comments. Login now