Skip to content
Snippets Groups Projects
Commit 0d88d793 authored by igerzog's avatar igerzog Committed by Charlie Smurthwaite
Browse files

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
parent 53475abf
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -46,7 +46,7 @@ module Postal
end
next
end
smtp_client = Net::SMTP.new(@remote_ip, port)
smtp_client = Net::SMTP.new(hostname, port)
if @source_ip_address
# Set the source IP as appropriate
smtp_client.source_address = ip_type == :aaaa ? @source_ip_address.ipv6 : @source_ip_address.ipv4
Loading
Loading
@@ -236,6 +236,8 @@ module Postal
@ssl_context_with_verify ||= begin
c = OpenSSL::SSL::SSLContext.new
c.verify_mode = OpenSSL::SSL::VERIFY_PEER
c.cert_store = OpenSSL::X509::Store.new
c.cert_store.set_default_paths
c
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment