مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-12-01 05:43:04 +00:00
Fix peer verification (#336)
Fixes the problem with `SSL_connect returned=1 errno=0 state=error: certificate verify failed` and solves hostname mismatch when use ip address instead of hostname
هذا الالتزام موجود في:
ملتزم من قبل
Charlie Smurthwaite
الأصل
53475abf55
التزام
0d88d79319
@@ -46,7 +46,7 @@ module Postal
|
|||||||
end
|
end
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
smtp_client = Net::SMTP.new(@remote_ip, port)
|
smtp_client = Net::SMTP.new(hostname, port)
|
||||||
if @source_ip_address
|
if @source_ip_address
|
||||||
# Set the source IP as appropriate
|
# Set the source IP as appropriate
|
||||||
smtp_client.source_address = ip_type == :aaaa ? @source_ip_address.ipv6 : @source_ip_address.ipv4
|
smtp_client.source_address = ip_type == :aaaa ? @source_ip_address.ipv6 : @source_ip_address.ipv4
|
||||||
@@ -236,6 +236,8 @@ module Postal
|
|||||||
@ssl_context_with_verify ||= begin
|
@ssl_context_with_verify ||= begin
|
||||||
c = OpenSSL::SSL::SSLContext.new
|
c = OpenSSL::SSL::SSLContext.new
|
||||||
c.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
c.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
||||||
|
c.cert_store = OpenSSL::X509::Store.new
|
||||||
|
c.cert_store.set_default_paths
|
||||||
c
|
c
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم