fix(mailer): keep certificate checks for Swoosh HTTP adapters
The TLS version override replaced all Hackney TLS defaults. On OTP 26+ this fails with cacerts: :undefined; on older OTP it skipped certificate checks. Closes #7962 on the public tracker.
This commit is contained in:
parent
d8c880e494
commit
830455d197
5 changed files with 19 additions and 3 deletions
1
changelog.d/mailer-tls-options.fix
Normal file
1
changelog.d/mailer-tls-options.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fix Swoosh HTTP mail adapters failing with `cacerts: :undefined` on OTP 26+
|
||||
|
|
@ -39,7 +39,9 @@ defmodule Pleroma.Emails.Mailer do
|
|||
# temporary hackney fix until hackney max_connections bug is fixed
|
||||
# https://git.pleroma.social/pleroma/pleroma/-/issues/2101
|
||||
email =
|
||||
Swoosh.Email.put_private(email, :hackney_options, ssl_options: [versions: [:"tlsv1.2"]])
|
||||
Swoosh.Email.put_private(email, :hackney_options,
|
||||
ssl_options: Pleroma.HTTP.TLS.ssl_options(versions: [:"tlsv1.2"])
|
||||
)
|
||||
|
||||
case enabled?() do
|
||||
true -> Swoosh.Mailer.deliver(email, parse_config(config))
|
||||
|
|
|
|||
|
|
@ -52,4 +52,13 @@ defmodule Pleroma.Emails.MailerTest do
|
|||
subject: "Pleroma test email"
|
||||
)
|
||||
end
|
||||
|
||||
test "keeps certificate checks for HTTP API adapters" do
|
||||
Mailer.deliver(@email)
|
||||
|
||||
assert_received {:email, %Swoosh.Email{private: %{hackney_options: hackney_options}}}
|
||||
|
||||
assert hackney_options[:ssl_options] ==
|
||||
Pleroma.HTTP.TLS.ssl_options(versions: [:"tlsv1.2"])
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -533,7 +533,9 @@ defmodule Pleroma.UserTest do
|
|||
Pleroma.Emails.UserEmail.account_confirmation_email(registered_user)
|
||||
# temporary hackney fix until hackney max_connections bug is fixed
|
||||
# https://git.pleroma.social/pleroma/pleroma/-/issues/2101
|
||||
|> Swoosh.Email.put_private(:hackney_options, ssl_options: [versions: [:"tlsv1.2"]])
|
||||
|> Swoosh.Email.put_private(:hackney_options,
|
||||
ssl_options: Pleroma.HTTP.TLS.ssl_options(versions: [:"tlsv1.2"])
|
||||
)
|
||||
|> assert_email_sent()
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1044,7 +1044,9 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
|||
Pleroma.Emails.UserEmail.account_confirmation_email(first_user)
|
||||
# temporary hackney fix until hackney max_connections bug is fixed
|
||||
# https://git.pleroma.social/pleroma/pleroma/-/issues/2101
|
||||
|> Swoosh.Email.put_private(:hackney_options, ssl_options: [versions: [:"tlsv1.2"]])
|
||||
|> Swoosh.Email.put_private(:hackney_options,
|
||||
ssl_options: Pleroma.HTTP.TLS.ssl_options(versions: [:"tlsv1.2"])
|
||||
)
|
||||
|> assert_email_sent()
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue