1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2026-01-17 13:39:46 +00:00

disable SMTP TLS by default and add custom paths for SMTP key/cert

TLS can be enabled by setting 'smtp_server.tls_enabled' to true.
هذا الالتزام موجود في:
Adam Cooke
2017-04-28 15:12:56 +01:00
الأصل 1b58cb853b
التزام caacaa7f92
3 ملفات معدلة مع 13 إضافات و6 حذوفات

عرض الملف

@@ -54,6 +54,9 @@ workers:
quantity: 1 quantity: 1
smtp_server: smtp_server:
tls_enabled: false
tls_certificate_path: # Defaults to config/smtp.crt
tls_private_key_path: # Defaults to config/smtp.key
proxy_protocol: false proxy_protocol: false
log_connect: true log_connect: true
evented: true evented: true

عرض الملف

@@ -108,11 +108,11 @@ module Postal
end end
def self.smtp_private_key_path def self.smtp_private_key_path
config_root.join('smtp.key') config.smtp_server.tls_private_key_path || config_root.join('smtp.key')
end end
def self.smtp_certificate_path def self.smtp_certificate_path
config_root.join('smtp.cert') config.smtp_server.tls_certificate_path || config_root.join('smtp.cert')
end end
def self.smtp_certificate_data def self.smtp_certificate_data

عرض الملف

@@ -117,9 +117,13 @@ module Postal
end end
def starttls def starttls
if Postal.config.smtp_server.tls_enabled?
@start_tls = true @start_tls = true
@tls = true @tls = true
"220 Ready to start TLS" "220 Ready to start TLS"
else
"502 TLS not available"
end
end end
def ehlo(data) def ehlo(data)
@@ -127,7 +131,7 @@ module Postal
@helo_name = data.strip.split(' ', 2)[1] @helo_name = data.strip.split(' ', 2)[1]
reset reset
@state = :welcomed @state = :welcomed
["250-My capabilities are", @tls ? nil : "250-STARTTLS", "250 AUTH CRAM-MD5 PLAIN LOGIN", ] ["250-My capabilities are", Postal.config.smtp_server.tls_enabled? && !@tls ? "250-STARTTLS" : nil, "250 AUTH CRAM-MD5 PLAIN LOGIN", ]
end end
def helo(data) def helo(data)