Net::S...::LDAP(3pm)

πŸ“¦
version 1.058 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Net::S...::LDAP β€” the manual, but make it make sense πŸ’–

okay bestie, so this is the User Contributed Perl Documentation page for Net::S...::LDAP, section 3pm. sit down, grab a strawberry πŸ“, we're doing TLS certificate validation and we're doing it correctly.


✨ NAME ✨

Net::SSLGlue::LDAP β€” proper certificate checking for ldaps in Net::LDAP. that's it, that's the whole vibe. no cap. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

use Net::SSLGlue::LDAP;
local %Net::SSLGlue::LDAP = ( SSL_verifycn_name => $hostname_in_cert );
my $ldap = Net::LDAP->new( $hostname, capath => ... );
$ldap->start_tls;

look at her. four lines. iconic. πŸ’…


πŸ’… DESCRIPTION πŸ’…

so here's the tea, bestie: Net::SSLGlue::LDAP modifies Net::LDAP so that it does proper certificate checking using the "ldap" SSL_verify_scheme from IO::Socket::SSL. yes, the real thing. the certificate check that actually checks. we love to see it. 🫢

the reason this module even exists? because Net::LDAP does not have a mechanism to forward arbitrary parameters for the construction of the underlying socket. so rude of it honestly. 😭 so instead, those parameters can be set globally when including the package, or with local settings of the %Net::SSLGlue::LDAP::SSLopts variable.

and literally all of the "SSL_*" parameters from IO::Socket::SSL can be used here. every single one. but one of them is the main character and it's this one:

  • SSL_verifycn_name β€” usually the name you handed over as the hostname in the constructor is the one used to verify the identity of the certificate. but if you wanna check that cert against a different name instead, you specify it with this parameter. lowkey a lifesaver. 🌸

also, heads up on the naming situation, because it's giving confusing: "SSL_ca_path" and "SSL_ca_file" from IO::Socket::SSL can be set with the "capath" and "cafile" parameters of Net::LDAP::new, and "SSL_verify_mode" can be set with "verify" β€” but the meaning of the values differs. "none" is 0, e.g. disable certificate verification. πŸ‘€ ma'am. that is the opposite of verification. know what you're setting, fr fr.


🌈 SEE ALSO 🌈

go read these too, bestie:

  • IO::Socket::SSL
  • LWP
  • Net::LDAP

This module is copyright (c) 2008, Steffen Ullrich. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.


and that's the whole page, babe πŸ’– this beauty comes to you from perl v5.36.0, dated 2022-12-06, and yeah the title got cropped to Net::S...::LDAP(3pm) because apparently even man pages have a character limit. stay verified, stay valid, go check those certs. 🧚✨🫢

πŸ“¦ where this page comes from