From 38a12d96ba9b6cf7541fd141852ea62554ac6111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 26 Feb 2016 09:59:24 +0100 Subject: [PATCH] Add option to accept ssl certificates This provides a configuration option to add `--trust-server-cert` to the SVN calls made by OpenProject. Either add the `trustedssl` key to the Subversion scm configuration or set the ENV `OPENPROJECT_SCM_SUBVERSION_TRUSTEDSSL=true`. --- config/configuration.yml.example | 1 + lib/open_project/scm/adapters/subversion.rb | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/config/configuration.yml.example b/config/configuration.yml.example index 8f0a741867..c2c28ee8fc 100644 --- a/config/configuration.yml.example +++ b/config/configuration.yml.example @@ -274,6 +274,7 @@ default: # manages: /opt/repositories/git # subversion: # client_command: /usr/local/bin/svn + # trustedssl: true # disabled_types: # - :existing # manages: /opt/repositories/svn diff --git a/lib/open_project/scm/adapters/subversion.rb b/lib/open_project/scm/adapters/subversion.rb index f102ef5ebc..da22d82c76 100644 --- a/lib/open_project/scm/adapters/subversion.rb +++ b/lib/open_project/scm/adapters/subversion.rb @@ -102,8 +102,10 @@ def check_availability! return if doc.at_xpath('/info/entry/repository/uuid') - raise Exceptions::ScmUnauthorized.new if io_include?(stderr, - 'E215004: Authentication failed') + stderr.each_line do |l| + Rails.logger.error("SVN access error: #{l}") if l =~ /E\d+:/ + raise Exceptions::ScmUnauthorized.new if l.include?('E215004: Authentication failed') + end end raise Exceptions::ScmUnavailable @@ -226,6 +228,10 @@ def build_svn_cmd(args) args.push('--password', @password) if @password.present? end + if self.class.config[:trustedssl] + args.push('--trust-server-cert') + end + args.push('--no-auth-cache', '--non-interactive') end