fix(http): make Finch trust the CAStore bundle
Mint trusts the OTP CA store, which comes from the OS. Load the CAStore bundle into it when Finch starts, so Finch trusts the same roots as the other adapters.
This commit is contained in:
parent
830455d197
commit
f4ff7cb1ea
2 changed files with 11 additions and 1 deletions
|
|
@ -66,6 +66,7 @@ defmodule Pleroma.Application do
|
|||
|
||||
if match?({Tesla.Adapter.Finch, _}, adapter) do
|
||||
Logger.info("Starting Finch")
|
||||
use_castore_for_otp_cacerts()
|
||||
Finch.start_link(name: MyFinch)
|
||||
end
|
||||
|
||||
|
|
@ -304,6 +305,15 @@ defmodule Pleroma.Application do
|
|||
end
|
||||
end
|
||||
|
||||
# Mint trusts the OTP CA store, which comes from the OS. Make it the CAStore
|
||||
# bundle that the other adapters trust. OTP 24 has no such store and Mint
|
||||
# uses CAStore there anyway.
|
||||
defp use_castore_for_otp_cacerts do
|
||||
if Code.ensure_loaded?(:public_key) and function_exported?(:public_key, :cacerts_load, 1) do
|
||||
:ok = :public_key.cacerts_load(CAStore.file_path())
|
||||
end
|
||||
end
|
||||
|
||||
defp http_children_hackney do
|
||||
pools = [:federation, :media]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue