diff options
author | Alex S <alex.strizhakov@gmail.com> | 2019-08-22 12:38:39 +0300 |
---|---|---|
committer | Alex S <alex.strizhakov@gmail.com> | 2019-08-22 12:38:39 +0300 |
commit | d812c8bbc7ed5605650e7baca3397617a86fc154 (patch) | |
tree | 9093c82b2d1c45b0a6545d1af2aefb660c074b5c | |
parent | 6e66bb35d1c2ab87e65e3249fbb427b80ca5b015 (diff) | |
download | pleroma-d812c8bbc7ed5605650e7baca3397617a86fc154.tar.gz |
opts to verify certificates by gun
-rw-r--r-- | lib/pleroma/http/connection.ex | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/pleroma/http/connection.ex b/lib/pleroma/http/connection.ex index ef2ee918d..fbf135bf9 100644 --- a/lib/pleroma/http/connection.ex +++ b/lib/pleroma/http/connection.ex @@ -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 |