mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-22 08:06:55 +00:00
Merge branch 'ldap-tls' into 'develop'
LDAP Auth: fix TLS certificate verification See merge request pleroma/pleroma!4259
This commit is contained in:
commit
360dd34f19
3 changed files with 13 additions and 1 deletions
1
changelog.d/ldap-tls.fix
Normal file
1
changelog.d/ldap-tls.fix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
STARTTLS certificate and hostname verification for LDAP authentication
|
|
@ -41,6 +41,7 @@ defmodule Pleroma.Web.Auth.LDAPAuthenticator do
|
||||||
port = Keyword.get(ldap, :port, 389)
|
port = Keyword.get(ldap, :port, 389)
|
||||||
ssl = Keyword.get(ldap, :ssl, false)
|
ssl = Keyword.get(ldap, :ssl, false)
|
||||||
sslopts = Keyword.get(ldap, :sslopts, [])
|
sslopts = Keyword.get(ldap, :sslopts, [])
|
||||||
|
tlsopts = Keyword.get(ldap, :tlsopts, [])
|
||||||
|
|
||||||
options =
|
options =
|
||||||
[{:port, port}, {:ssl, ssl}, {:timeout, @connection_timeout}] ++
|
[{:port, port}, {:ssl, ssl}, {:timeout, @connection_timeout}] ++
|
||||||
|
@ -54,7 +55,16 @@ defmodule Pleroma.Web.Auth.LDAPAuthenticator do
|
||||||
|
|
||||||
case :eldap.start_tls(
|
case :eldap.start_tls(
|
||||||
connection,
|
connection,
|
||||||
Keyword.get(ldap, :tlsopts, []),
|
Keyword.merge(
|
||||||
|
[
|
||||||
|
verify: :verify_peer,
|
||||||
|
cacerts: :certifi.cacerts(),
|
||||||
|
customize_hostname_check: [
|
||||||
|
fqdn_fun: fn _ -> to_charlist(host) end
|
||||||
|
]
|
||||||
|
],
|
||||||
|
tlsopts
|
||||||
|
),
|
||||||
@connection_timeout
|
@connection_timeout
|
||||||
) do
|
) do
|
||||||
:ok ->
|
:ok ->
|
||||||
|
|
1
mix.exs
1
mix.exs
|
@ -204,6 +204,7 @@ defmodule Pleroma.Mixfile do
|
||||||
{:oban_live_dashboard, "~> 0.1.1"},
|
{:oban_live_dashboard, "~> 0.1.1"},
|
||||||
{:multipart, "~> 0.4.0", optional: true},
|
{:multipart, "~> 0.4.0", optional: true},
|
||||||
{:argon2_elixir, "~> 4.0"},
|
{:argon2_elixir, "~> 4.0"},
|
||||||
|
{:certifi, "~> 2.12"},
|
||||||
|
|
||||||
## dev & test
|
## dev & test
|
||||||
{:phoenix_live_reload, "~> 1.3.3", only: :dev},
|
{:phoenix_live_reload, "~> 1.3.3", only: :dev},
|
||||||
|
|
Loading…
Reference in a new issue