The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Authen::Krb5::Effortless - This module is a subclass to Authen::Krb5, adding 'Effortless' ways to authenticate against a Kerberos Domain Controller.


Version 0.02


Authen::Krb5::Effortless is more then a 'Simple' module, as it supports both pass-phrase and key-tab based authorization.


new() - Initializes Authen::Krb5 and returns a Authen::Krb5::Effortless object.
fetch_TGT_KEYTAB() - Uses a keytab file to get a Kerberos credential.
fetch_TGT_PW() - Will use a password to get and cache a Kerberos credential.
clear_cache() - Will clear your local cache of all stored principals.
read_cache() - Will read your Kerberos cache and return the following values from the cache:
cache_present: returns 0 or 1 if the cache is present
starttime: epoch time when ticket is good from
authtime: epoch time when authentication occured
endtime: epoch time when the ticket expires
principal: name of the principal contained in the cache


A keytab example:

  use Authen::Krb5::Effortless;
  my $username  =  getlogin();                            
  my $keytab    =  "/path/to/my/keytab";
  my $krb5      =  Authen::Krb5::Effortless->new();
  $krb5->fetch_TGT_KEYTAB($keytab, $username);

A password example:

  use Authen::Krb5::Effortless;
  my $username = getlogin();
  my $krb5   = Authen::Krb5::Effortless->new();
  $krb5->fetch_TGT_PW('sekret_phss_wurd', $username);

A example for reading cache:

  use Authen::Krb5::Effortless;
  my $krb5  = Authen::Krb5::Effortless->new();
  if ($krb5->{'cache_present'}) { 
    print $krb5->{'principal'}, "\n";

A example for deleting the cache:

  use Authen::Krb5::Effortless;
  my $krb5  = Authen::Krb5::Effortless->new();


Authen::Krb5 needs to be installed for this module to work. In addition, because I'm using a pragma introduced with perl 5.10.1, I am requireing the use of perl 5.10.1 or newer.


Adam Faris, <authen-krb5-effortless at mekanix dot org>


Bugs are tracked at github. Please report any bugs to


You can find documentation for this module with the perldoc command.

    perldoc Authen::Krb5::Effortless

You can also look for information at:


I would like to acknowledge Jeff Horwitz, Doug MacEachern, Malcolm Beattie, and Scott Hutton for their work on Authen::Krb5.


Copyright 2013 Adam Faris.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.