Skip to content

Fix LDAP tls_options not working

Stan Hu requested to merge sh-fix-ldap-tls-options-16-0 into 16-0-stable-ee

What does this MR do and why?

This backports !122789 (merged) to the 16-0-stable-ee branch.

The removal of the Settingslogic gem in !113040 (merged) created a regression when LDAP tls_options were used. It resulted in Gitlab::config.ldap.servers.main.tls_options.cert returning nil instead of the certificate.

This occurred because Gitlab::Auth::Ldap::Config#custom_tls_options attempts to duplicate the tls_options Hash and symbolize the keys, but instead it altered the internal Hash representation of GitlabSettings::Options. Since all the keys were transformed to symbols but GitlabSettings::Options converts all keys to strings, the values were inaccessible.

To fix this, implement a dup to create a copy of the internal representation. We should also consider refactoring Gitlab::Auth::Ldap::Config.

Relates to #413017 (closed)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

  • This MR is backporting a bug fix, documentation update, or spec fix, previously merged in the default branch.
  • The original MR has been deployed to GitLab.com (not applicable for documentation or spec changes).
  • This MR has a severity label assigned (if applicable).
  • This MR has been approved by a maintainer (only one approval is required).
  • Ensure the e2e:package-and-test-ee job has either succeeded or been approved by a Software Engineer in Test.

Note to the merge request author and maintainer

If you have questions about the patch release process, please:

Edited by Alessio Caiazza

Merge request reports