Skip to main content

ldap_auth

Function ldap_auth 

Source
pub async fn ldap_auth(options: &Options) -> Result<Ldap, Box<dyn Error>>
Expand description

Connect to the Domain Controller and authenticate, returning a ready ldap3::Ldap session. The method is chosen from options:

  • certificate : pfx or crt/key present (Pass-the-Certificate)
  • pass-the-hash: hashes present (NTLM)
  • Kerberos : kerberos == true (ccache from KRB5CCNAME)
  • simple bind : otherwise (username / password)

Certificate auth uses LDAP 389 + StartTLS by default, or LDAPS 636 with options.ldaps. Returns Err on failure (no process::exit), and never unbinds — the caller owns the returned session.