summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2024-12-20 08:42:07 +0000
committerGo MAEDA <maeda@farend.jp>2024-12-20 08:42:07 +0000
commit3d516456c9f5d93c5070594cbac206fbb6b177c2 (patch)
tree13949432332981d884812a89d8ab2244d28f37b6
parent02bd5c128e6455ea97395faf8301dee4c4659c62 (diff)
downloadredmine-3d516456c9f5d93c5070594cbac206fbb6b177c2.tar.gz
redmine-3d516456c9f5d93c5070594cbac206fbb6b177c2.zip
Allow IMAP4 email receiving to skip SSL certificate verification with `ssl=force` option (#41738).HEADmaster
Patch by Go MAEDA (user:maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@23415 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/redmine/imap.rb10
-rw-r--r--lib/tasks/email.rake2
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/redmine/imap.rb b/lib/redmine/imap.rb
index 79e61eb52..77b8da80f 100644
--- a/lib/redmine/imap.rb
+++ b/lib/redmine/imap.rb
@@ -25,7 +25,15 @@ module Redmine
def check(imap_options={}, options={})
host = imap_options[:host] || '127.0.0.1'
port = imap_options[:port] || '143'
- ssl = !imap_options[:ssl].nil?
+ if imap_options[:ssl]
+ if imap_options[:ssl] == 'force'
+ ssl = {verify_mode: OpenSSL::SSL::VERIFY_NONE}
+ else
+ ssl = {verify_mode: OpenSSL::SSL::VERIFY_PEER}
+ end
+ else
+ ssl = false
+ end
starttls = !imap_options[:starttls].nil?
folder = imap_options[:folder] || 'INBOX'
diff --git a/lib/tasks/email.rake b/lib/tasks/email.rake
index cdf4fc49d..4ba669510 100644
--- a/lib/tasks/email.rake
+++ b/lib/tasks/email.rake
@@ -37,6 +37,8 @@ Available IMAP options:
host=HOST IMAP server host (default: 127.0.0.1)
port=PORT IMAP server port (default: 143)
ssl=SSL Use SSL/TLS? (default: false)
+ Setting `ssl=force` disables server certificate
+ verification
starttls=STARTTLS Use STARTTLS? (default: false)
username=USERNAME IMAP account
password=PASSWORD IMAP password