##// END OF EJS Templates
Mail Handler: option for specifying a custom CA bundle (#19182)....
Jean-Philippe Lang -
r13907:9e39ad471994
parent child
Show More
@@ -30,6 +30,9 module Net
30 30 request.basic_auth url.user, url.password if url.user
31 31 http = new(url.host, url.port)
32 32 http.use_ssl = (url.scheme == 'https')
33 if options[:certificate_bundle]
34 http.ca_file = options[:certificate_bundle]
35 end
33 36 if options[:no_check_certificate]
34 37 http.verify_mode = OpenSSL::SSL::VERIFY_NONE
35 38 end
@@ -42,7 +45,7 class RedmineMailHandler
42 45 VERSION = '0.2.3'
43 46
44 47 attr_accessor :verbose, :issue_attributes, :allow_override, :unknown_user, :default_group, :no_permission_check,
45 :url, :key, :no_check_certificate, :no_account_notice, :no_notification
48 :url, :key, :no_check_certificate, :certificate_bundle, :no_account_notice, :no_notification
46 49
47 50 def initialize
48 51 self.issue_attributes = {}
@@ -64,6 +67,7 class RedmineMailHandler
64 67 "you don't want the key to appear in the command",
65 68 "line)") {|v| read_key_from_file(v)}
66 69 opts.on("--no-check-certificate", "do not check server certificate") {self.no_check_certificate = true}
70 opts.on("--certificate-bundle FILE", "certificate bundle to use") {|v| self.certificate_bundle = v}
67 71 opts.on("-h", "--help", "show this help") {puts opts; exit 1}
68 72 opts.on("-v", "--verbose", "show extra information") {self.verbose = true}
69 73 opts.on("-V", "--version", "show version information and exit") {puts VERSION; exit}
@@ -129,7 +133,7 class RedmineMailHandler
129 133
130 134 debug "Posting to #{uri}..."
131 135 begin
132 response = Net::HTTPS.post_form(URI.parse(uri), data, headers, :no_check_certificate => no_check_certificate)
136 response = Net::HTTPS.post_form(URI.parse(uri), data, headers, :no_check_certificate => no_check_certificate, :certificate_bundle => certificate_bundle)
133 137 rescue SystemCallError, IOError => e # connection refused, etc.
134 138 warn "An error occured while contacting your Redmine server: #{e.message}"
135 139 return 75 # temporary failure
General Comments 0
You need to be logged in to leave comments. Login now