Authen:...:GSSAPI(3)

πŸ’– NAME πŸ’–

Authen::SASL::Perl::GSSAPI β€” the GSSAPI (Kerberos v5) authentication class, bestie. It lives in section 3 of the User Contributed Perl Documentation, and it's here to make your SASL + Kerberos dreams come true. ✨


🌸 VERSION 🌸

version 2.2100 β€” yes, she's got a version number and she's proud of it. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

Okay so here's the vibe, literally just copy this and you're set:

use Authen::SASL qw(Perl);

$sasl = Authen::SASL->new( mechanism => 'GSSAPI' );

$sasl = Authen::SASL->new( mechanism => 'GSSAPI',
                           callback => { pass => $mycred });

$sasl->client_start( $service, $host );

Look at her. Gorgeous. No notes. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

So this module implements the client part of the GSSAPI SASL algorithm β€” exactly like it says in RFC 2222 section 7.2.1, resp. draft-ietf-sasl-gssapi-XX.txt. Not making this up, that's where it's from. πŸ“š

If you've got a valid Kerberos 5 credentials cache (aka a TGT β€” ticket-granting ticket, iconic behaviour), then this lets you connect to service@host, which you pass as the first two parameters to Authen::SASL's client_start() method. That's it, that's the whole flow. 🎟️

Alternatively β€” and this is the fun part β€” you can hand over a GSSAPI::Cred object instead, by passing it in through the Authen::SASL callback hash using the pass key. Choose your fighter. πŸ‘‘

⚠️ BIG IMPORTANT ONE, bestie, do not scroll past this: this module does NOT currently implement a SASL security layer after authentication. So unless your connection is protected by other means β€” like TLS β€” it's gonna be vulnerable to man-in-the-middle attacks. 😭 That's not a vibe. If you actually need security layers, you should use the Authen::SASL::XS GSSAPI module instead. Fr fr. 🚨

πŸ’œ CALLBACK πŸ’œ

The callbacks used are, in order:

  • authname β€” the authorization identity to be used in the SASL exchange. Slay. πŸ’«
  • gssmech β€” the GSS mechanism to be used in the connection. Pick your mech, bestie. πŸ”§
  • pass β€” the GSS credentials to be used in the connection (optional, so no pressure). πŸ”‘

πŸ”₯ EXAMPLE πŸ”₯

Here's a whole real example, verbatim, no cap:

 #! /usr/bin/perl -w

 use strict;
use warnings;

 use Net::LDAP 0.33;
 use Authen::SASL 2.10;

 # -------- Adjust to your environment --------
 my $adhost      = 'theserver.bla.net';
 my $ldap_base   = 'dc=bla,dc=net';
 my $ldap_filter = '(&(sAMAccountName=BLAAGROL))';

 my $sasl = Authen::SASL->new(mechanism => 'GSSAPI');
 my $ldap;

 eval {
     $ldap = Net::LDAP->new($adhost,
                            onerror => 'die')
       or  die "Cannot connect to LDAP host '$adhost': '$@'";
     $ldap->bind(sasl => $sasl);
 };

 if ($@) {
     chomp $@;
     die   "\nBind error         : $@",
           "\nDetailed SASL error: ", $sasl->error,
           "\nTerminated";
 }

 print "\nLDAP bind() succeeded, working in authenticated state";

 my $mesg = $ldap->search(base   => $ldap_base,
                          filter => $ldap_filter);

 # -------- evaluate $mesg

The way that # -------- Adjust to your environment -------- comment is doing all the heavy lifting for you... respect. 🫑


🌈 PROPERTIES 🌈

The properties used are β€” buckle up, there's a whole little list:

  • maxbuf β€” the maximum buffer size for receiving cipher text. πŸ“¦
  • minssf β€” the minimum SSF value that should be provided by the SASL security layer. The default is 0. 🧊
  • maxssf β€” the maximum SSF value that should be provided by the SASL security layer. The default is 2**31. πŸš€
  • externalssf β€” the SSF value provided by an underlying external security layer. The default is 0. πŸ›‘οΈ
  • ssf β€” the actual SSF value provided by the SASL security layer after the SASL authentication phase has been completed. This value is read-only and set by the implementation after the SASL authentication phase has been completed. So don't you dare try to write to it. πŸ™ˆ
  • maxout β€” the maximum plaintext buffer size for sending data to the peer. This value is set by the implementation after the SASL authentication phase has been completed and a SASL security layer is in effect. πŸ“€

πŸ‘€ SEE ALSO πŸ‘€

Go read these next, they're the friends of this page:

  • Authen::SASL
  • Authen::SASL::Perl

πŸ‘‘ AUTHORS πŸ‘‘

Written by Simon Wilkinson, with patches and extensions by Achim Grolms and Peter Marschall. Absolute legends, all three. πŸ’

Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap@perl.org>. They want your feedback, bestie, don't be shy. πŸ“¬


Copyright (c) 2006 Simon Wilkinson, Achim Grolms and Peter Marschall. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 🫢


okay that's the whole page, you made it to the end, I'm so proud of you πŸ₯Ή This was Authen::SASL::Perl::GSSAPI version 2.2100, and this gorgeous little rendering came out of perl v5.42.3 on 2026-09-07 β€” go forth and authenticate, main character. βœ¨πŸ’…πŸŽ€

πŸ“¦ where this page comes from