Authen-Simple-PAM-0.2/ 0040755 0000765 0000765 00000000000 10361333660 014300 5 ustar chansen chansen Authen-Simple-PAM-0.2/Build.PL 0100644 0000765 0000765 00000000532 10361333660 015571 0 ustar chansen chansen use strict;
use Module::Build;
my $build = Module::Build->new(
license => 'perl',
module_name => 'Authen::Simple::PAM',
requires => {
'Authen::Simple' => 0,
'Authen::PAM' => 0,
},
create_makefile_pl => 'traditional',
create_readme => 1
);
$build->create_build_script;
Authen-Simple-PAM-0.2/Changes 0100644 0000765 0000765 00000000260 10361333660 015566 0 ustar chansen chansen Revision history for Perl extension Authen::Simple::PAM
0.2 2006-01-12 00:00
- Cleaned up error messages. No functional changes.
0.1 2006-01-03 00:00
- First release
Authen-Simple-PAM-0.2/lib/ 0040755 0000765 0000765 00000000000 10361333660 015046 5 ustar chansen chansen Authen-Simple-PAM-0.2/lib/Authen/ 0040755 0000765 0000765 00000000000 10361333660 016272 5 ustar chansen chansen Authen-Simple-PAM-0.2/lib/Authen/Simple/ 0040755 0000765 0000765 00000000000 10361333660 017523 5 ustar chansen chansen Authen-Simple-PAM-0.2/lib/Authen/Simple/PAM.pm 0100644 0000765 0000765 00000006421 10361333660 020476 0 ustar chansen chansen package Authen::Simple::PAM;
use strict;
use warnings;
use base 'Authen::Simple::Adapter';
use Authen::PAM qw[:constants];
use Params::Validate qw[];
our $VERSION = 0.2;
__PACKAGE__->options({
service => {
type => Params::Validate::SCALAR,
default => 'login',
optional => 1
}
});
sub check {
my ( $self, $username, $password ) = @_;
my $service = $self->service;
my $handler = sub {
my @response = ();
while (@_) {
my $code = shift;
my $message = shift;
my $answer = undef;
if ( $code == PAM_PROMPT_ECHO_ON ) {
$answer = $username;
}
if ( $code == PAM_PROMPT_ECHO_OFF ) {
$answer = $password;
}
push( @response, PAM_SUCCESS, $answer );
}
return ( @response, PAM_SUCCESS );
};
my $pam = Authen::PAM->new( $service, $username, $handler );
unless ( ref $pam ) {
my $error = Authen::PAM->pam_strerror($pam);
$self->log->error( qq/Failed to authenticate user '$username' using service '$service'. Reason: '$error'/ )
if $self->log;
return 0;
}
my $result = $pam->pam_authenticate;
unless ( $result == PAM_SUCCESS ) {
my $error = $pam->pam_strerror($result);
$self->log->debug( qq/Failed to authenticate user '$username' using service '$service'. Reason: '$error'/ )
if $self->log;
return 0;
}
$result = $pam->pam_acct_mgmt;
unless ( $result == PAM_SUCCESS ) {
my $error = $pam->pam_strerror($result);
$self->log->debug( qq/Failed to authenticate user '$username' using service '$service'. Reason: '$error'/ )
if $self->log;
return 0;
}
$self->log->debug( qq/Successfully authenticated user '$username' using service '$service'./ )
if $self->log;
return 1;
}
1;
__END__
=head1 NAME
Authen::Simple::PAM - Simple PAM authentication
=head1 SYNOPSIS
use Authen::Simple::PAM;
my $pam = Authen::Simple::PAM->new(
service => 'login'
);
if ( $pam->authenticate( $username, $password ) ) {
# successfull authentication
}
# or as a mod_perl Authen handler
PerlModule Authen::Simple::Apache
PerlModule Authen::Simple::PAM
PerlSetVar AuthenSimplePAM_service "login"
PerlAuthenHandler Authen::Simple::PAM
AuthType Basic
AuthName "Protected Area"
Require valid-user
=head1 DESCRIPTION
PAM authentication.
=head1 METHODS
=over 4
=item * new
This method takes a hash of parameters. The following options are
valid:
=over 8
=item * service
PAM service. Defaults to C.
service => 'sshd'
=item * log
Any object that supports C, C, C and C.
log => Log::Log4perl->get_logger('Authen::Simple::PAM')
=back
=item * authenticate( $username, $password )
Returns true on success and false on failure.
=back
=head1 SEE ALSO
L.
L.
=head1 AUTHOR
Christian Hansen C
=head1 COPYRIGHT
This program is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
Authen-Simple-PAM-0.2/Makefile.PL 0100644 0000765 0000765 00000000674 10361333660 016256 0 ustar chansen chansen # Note: this file was auto-generated by Module::Build::Compat version 0.03
use ExtUtils::MakeMaker;
WriteMakefile
(
'NAME' => 'Authen::Simple::PAM',
'VERSION_FROM' => 'lib/Authen/Simple/PAM.pm',
'PREREQ_PM' => {
'Authen::PAM' => '0',
'Authen::Simple' => '0'
},
'INSTALLDIRS' => 'site',
'PL_FILES' => {}
)
;
Authen-Simple-PAM-0.2/MANIFEST 0100644 0000765 0000765 00000000212 10361333660 015421 0 ustar chansen chansen Build.PL
Changes
lib/Authen/Simple/PAM.pm
Makefile.PL
MANIFEST This list of files
README
t/01use.t
t/02pod.t
t/03podcoverage.t
META.yml
Authen-Simple-PAM-0.2/META.yml 0100644 0000765 0000765 00000000473 10361333660 015552 0 ustar chansen chansen ---
name: Authen-Simple-PAM
version: 0.2
author:
- 'Christian Hansen C'
abstract: Simple PAM authentication
license: perl
requires:
Authen::PAM: 0
Authen::Simple: 0
provides:
Authen::Simple::PAM:
file: lib/Authen/Simple/PAM.pm
version: 0.2
generated_by: Module::Build version 0.2611
Authen-Simple-PAM-0.2/README 0100644 0000765 0000765 00000002653 10361333660 015163 0 ustar chansen chansen NAME
Authen::Simple::PAM - Simple PAM authentication
SYNOPSIS
use Authen::Simple::PAM;
my $pam = Authen::Simple::PAM->new(
service => 'login'
);
if ( $pam->authenticate( $username, $password ) ) {
# successfull authentication
}
# or as a mod_perl Authen handler
PerlModule Authen::Simple::Apache
PerlModule Authen::Simple::PAM
PerlSetVar AuthenSimplePAM_service "login"
PerlAuthenHandler Authen::Simple::PAM
AuthType Basic
AuthName "Protected Area"
Require valid-user
DESCRIPTION
PAM authentication.
METHODS
* new
This method takes a hash of parameters. The following options are
valid:
* service
PAM service. Defaults to "login".
service => 'sshd'
* log Any object that supports "debug", "info", "error" and
"warn".
log => Log::Log4perl->get_logger('Authen::Simple::PAM')
* authenticate( $username, $password )
Returns true on success and false on failure.
SEE ALSO
Authen::Simple.
Authen::PAM.
AUTHOR
Christian Hansen "ch@ngmedia.com"
COPYRIGHT
This program is free software, you can redistribute it and/or modify it
under the same terms as Perl itself.
Authen-Simple-PAM-0.2/t/ 0040755 0000765 0000765 00000000000 10361333660 014543 5 ustar chansen chansen Authen-Simple-PAM-0.2/t/01use.t 0100644 0000765 0000765 00000000073 10361333660 015662 0 ustar chansen chansen use Test::More tests => 1;
use_ok('Authen::Simple::PAM');
Authen-Simple-PAM-0.2/t/02pod.t 0100644 0000765 0000765 00000000276 10361333660 015656 0 ustar chansen chansen use Test::More;
eval "use Test::Pod 1.14";
plan skip_all => 'Test::Pod 1.14 required' if $@;
plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
all_pod_files_ok();
Authen-Simple-PAM-0.2/t/03podcoverage.t 0100644 0000765 0000765 00000000365 10361333660 017372 0 ustar chansen chansen use Test::More;
eval "use Test::Pod::Coverage 1.04";
plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
all_pod_coverage_ok( { trustme => [ qr/^check$/ ] } );