opts to verify certificates by gun

This commit is contained in:
Alex S 2019-08-22 12:38:39 +03:00
parent 6e66bb35d1
commit d812c8bbc7
1 changed files with 11 additions and 0 deletions

View File

@ -59,9 +59,20 @@ defmodule Pleroma.HTTP.Connection do
conn ->
%{host: host, port: port} = URI.parse(url)
# verify sertificates opts for gun
tls_opts = [
verify: :verify_peer,
cacerts: :certifi.cacerts(),
depth: 20,
server_name_indication: to_charlist(host),
reuse_sessions: false,
verify_fun: {&:ssl_verify_hostname.verify_fun/3, [check_hostname: to_charlist(host)]}
]
Keyword.put(options, :conn, conn)
|> Keyword.put(:close_conn, false)
|> Keyword.put(:original, "#{host}:#{port}")
|> Keyword.put(:tls_opts, tls_opts)
end
end
end