NAME
GSSAPI - Perl extension providing access to the GSSAPIv2 library
SYNOPSIS
use GSSAPI;my $targethostname = '[email protected]';my $status;TRY: {my ($target, $tname, $ttl );$status = GSSAPI::Name->import( $target,$server,GSSAPI::OID::gss_nt_hostbased_service)or last;$status = $target->display($tname) or last;print "\n using Name $tname";my $ctx = GSSAPI::Context->new();my $imech = GSSAPI::OID::gss_mech_krb5;my $iflags = 0 ;my $bindings = GSS_C_NO_CHANNEL_BINDINGS;my $creds = GSS_C_NO_CREDENTIAL;my $itime = 0;my $itoken = q{};my $otoken;$status = $ctx->init($creds,$target,$imech,$iflags,$itime,$bindings,$itoken,undef, $otoken,undef,undef) or last;$status = $ctx->valid_time_left($ttl) or last;print "\n Security context's time to live $ttl secs";}unless ($status->major == GSS_S_COMPLETE ) {print "\nErrors: ", $status;} else {print "\n seems everything is fine, type klist to see the ticket\n";
DESCRIPTION
This module gives access to the routines of the GSSAPI library, as described in rfc2743 and rfc2744 and implemented by the Kerberos-1.2 distribution from MIT.
Since 0.14 it also compiles and works with Heimdal. Lacks of Heimdal support are gss_release_oid(), gss_str_to_oid() and fail of some tests. Have a look at the tests in t/ directory too see what tests fail on Heimdal ( the *.t tests are just skipping them at the moment)
The API presented by this module is a mildly object oriented reinterpretation of the C API, where opaque C structures are Perl objects, but the style of function call has been left mostly untouched. As a result, most routines modify one or more of the parameters passed to them, reflecting the C call-by-reference (or call-by-value-return) semantics.
All users of this module are therefore strongly advised to localize all usage of these routines to minimize pain if and when the API changes.
USAGE
This module wraps the GSSAPI C-Bindings. If you are new to GSSAPI it is a good idea to read RFC2743 and RFC2744, the documentation requires you to be familiar with the concept and the wordings of GSSAPI programming.
the examples directory holds some working examples of usage:
- getcred_hostbased.pl
-
gets a GSSAPI Token for a service specified on commandline. (like kgetcred on Heimdal or kvno on MIT)
- gss-client.pl
-
a simple GSSAPI TCP client.
- gss-server.pl
-
a simple GSSAPI TCP server. Use both as templates if you need quickhacking GSSAPI enabeled GSSAPI TCP services.
GSSAPI::Name
GSSAPI internal representation of principalname
Methods
- import( $gssapinameobj, $servicename, $mechnism_oid );
-
converts stringrepresentation
$servicenameof service into a GSSAPI internal format and stores it in$gssapiservicename.- input
-
- servicename
-
Scalar value, like '[email protected]'.
- mechnism_oid
-
Chose one of the predefines mechanism OIDs from GSSAPI::OID
- output
-
- $gssapinameobj
-
GSSAPI internal representation of servicename
- return value
-
returns GSSAPI::Status Object
- Example:
-
$status = GSSAPI::Name->import( $gssapinameobj,'[email protected]',GSSAPI::OID::gss_nt_hostbased_service);
- display($tname);
-
converts the GSSAPI internal format into a humanreadable string and stores it into
$tname.- output
-
humanreadable string will be stored into
$tname.
- return value
-
returns GSSAPI::Status Object
- Example:
-
my $tname;$status = $gssapinameobj->display($tname);die 'hmm, error...' if($status->major != GSS_S_COMPLETE );print "\n Name is $tname";
- compare( nameobj, ret)
-
Wraps gss_compare_name().
- Input
-
- nameobj
-
the 2nd GSSAPI::Name to be compared to
- output
-
- ret
-
- value is non-zero
-
names refer to same entity
- value is zero
-
names refer to different entities.
- return value
-
returns GSSAPI::Status Object
EXPORT
GSS_C_ACCEPTGSS_C_AF_APPLETALKGSS_C_AF_BSCGSS_C_AF_CCITTGSS_C_AF_CHAOSGSS_C_AF_DATAKITGSS_C_AF_DECnetGSS_C_AF_DLIGSS_C_AF_DSSGSS_C_AF_ECMAGSS_C_AF_HYLINKGSS_C_AF_IMPLINKGSS_C_AF_INETGSS_C_AF_LATGSS_C_AF_LOCALGSS_C_AF_NBSGSS_C_AF_NSGSS_C_AF_NULLADDRGSS_C_AF_OSIGSS_C_AF_PUPGSS_C_AF_SNAGSS_C_AF_UNSPECGSS_C_AF_X25GSS_C_ANON_FLAGGSS_C_BOTHGSS_C_CALLING_ERROR_MASKGSS_C_CALLING_ERROR_OFFSETGSS_C_CONF_FLAGGSS_C_DELEG_FLAGGSS_C_EMPTY_BUFFERGSS_C_GSS_CODEGSS_C_INDEFINITEGSS_C_INITIATEGSS_C_INTEG_FLAGGSS_C_MECH_CODEGSS_C_MUTUAL_FLAGGSS_C_NO_BUFFERGSS_C_NO_CHANNEL_BINDINGSGSS_C_NO_CONTEXTGSS_C_NO_CREDENTIALGSS_C_NO_NAMEGSS_C_NO_OIDGSS_C_NO_OID_SETGSS_C_PROT_READY_FLAGGSS_C_QOP_DEFAULTGSS_C_REPLAY_FLAGGSS_C_ROUTINE_ERROR_MASKGSS_C_ROUTINE_ERROR_OFFSETGSS_C_SEQUENCE_FLAGGSS_C_SUPPLEMENTARY_MASKGSS_C_SUPPLEMENTARY_OFFSETGSS_C_TRANS_FLAGGSS_S_BAD_BINDINGSGSS_S_BAD_MECHGSS_S_BAD_NAMEGSS_S_BAD_NAMETYPEGSS_S_BAD_QOPGSS_S_BAD_SIGGSS_S_BAD_STATUSGSS_S_CALL_BAD_STRUCTUREGSS_S_CALL_INACCESSIBLE_READGSS_S_CALL_INACCESSIBLE_WRITEGSS_S_COMPLETEGSS_S_CONTEXT_EXPIREDGSS_S_CONTINUE_NEEDEDGSS_S_CREDENTIALS_EXPIREDGSS_S_CRED_UNAVAILGSS_S_DEFECTIVE_CREDENTIALGSS_S_DEFECTIVE_TOKENGSS_S_DUPLICATE_ELEMENTGSS_S_DUPLICATE_TOKENGSS_S_FAILUREGSS_S_GAP_TOKENGSS_S_NAME_NOT_MNGSS_S_NO_CONTEXTGSS_S_NO_CREDGSS_S_OLD_TOKENGSS_S_UNAUTHORIZEDGSS_S_UNAVAILABLEGSS_S_UNSEQ_TOKEN
Exportable functions
$status = indicate_mechs($oidset)
Example
use GSSAPI qw(:all);my $oidset;my $isin = 0;my $status = indicate_mechs( $oidset );$status->major == GSS_S_COMPLETE || die 'error';$status = $oidset->contains( gss_mech_krb5_old, $isin );$status->major == GSS_S_COMPLETE || die 'error';if ( $isin ) {print 'Support of Kerberos 5 old mechtype';} else {print 'No Support of Kerberos 5 old mechtype';}
Constant OIDs provided:
# Constant OIDs provided:$oid = gss_nt_user_name;$oid = gss_nt_machine_uid_name;$oid = gss_nt_string_uid_name;$oid = gss_nt_service_name;$oid = gss_nt_exported_name;$oid = gss_nt_service_name_v2;$oid = gss_nt_krb5_name;$oid = gss_nt_krb5_principal;$oid = gss_mech_krb5;$oid = gss_mech_krb5_old;$oid = gss_mech_spnego;
All other functions are class or instance methods.
SEE ALSO
GSSAPI::Status(3p) GSSAPI::OID(3p) GSSAPI::OID::Set(3p)
- RFC2743
-
Generic Security Service API Version 2 : C-bindings
- RFC2744
-
Generic Security Service Application Program Interface
- LWP::Authen::Negotiate
-
GSSAPI based Authentication plugin for LWP
- Authen::SASL::Perl::GSSAPI
-
A SASL adapter, implementing the Authen::SASL interface, using GSSAPI.pm
- http://perlgssapi.sourceforge.net/
-
Holds an actual list of GSSAPI.pm authentication using modules
BUGS
More documentation how to use the module has to be added.
SUPPORT
See our project home at <http://perlgssapi.sourceforge.net/>
Mailinglist [email protected]
AUTHOR
The module ist maintained by Achim Grolms <[email protected]>
originally written by Philip Guenther <[email protected]>
THANKS TO
- Philip Guenther
- Leif Johansson
- Merijn Broeren
- Harald Joerg
- Christopher Odenbach
- Dax Kelson
- Marc Lehmann
- David Leonard
- Florian Ragwitz
-
maintainer of Debian package
- Markus Moeller
-
Solaris 10 / OpenSolaris support
COPYRIGHT
Copyright (c) 2006,2008 Achim Grolms. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Copyright (c) 2000,2001,2005 Philip Guenther. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.