Merge remote-tracking branch 'origin/develop' into fork

This commit is contained in:
marcin mikołajczak 2024-09-11 22:09:18 +02:00
commit 4cee86756c
3 changed files with 13 additions and 1 deletions

1
changelog.d/ldap-tls.fix Normal file
View file

@ -0,0 +1 @@
STARTTLS certificate and hostname verification for LDAP authentication

View file

@ -41,6 +41,7 @@ defp ldap_user(name, password) do
port = Keyword.get(ldap, :port, 389)
ssl = Keyword.get(ldap, :ssl, false)
sslopts = Keyword.get(ldap, :sslopts, [])
tlsopts = Keyword.get(ldap, :tlsopts, [])
options =
[{:port, port}, {:ssl, ssl}, {:timeout, @connection_timeout}] ++
@ -54,7 +55,16 @@ defp ldap_user(name, password) do
case :eldap.start_tls(
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
) do
:ok ->

View file

@ -209,6 +209,7 @@ defp deps do
{:icalendar, "~> 1.1"},
{:geospatial, "~> 0.3.1"},
{:argon2_elixir, "~> 4.0"},
{:certifi, "~> 2.12"},
## dev & test
{:phoenix_live_reload, "~> 1.3.3", only: :dev},