Apache2-AuthPAM
view release on metacpan or search on metacpan
our $MODNAME = __PACKAGE__;
sub handler {
# get object request
my $r = shift;
# check first request
return OK unless $r->is_initial_req;
# get user password
my ($rc, $pw) = $r->get_basic_auth_pw;
# decline if not basic
return $rc if $rc;
# get log object
my $log = $r->log;
# get user name
my $username = $r->user;
You can select the PAM service setting the perl var PAMservice
PerlSetVar PAMservice the-pam-service-you-want
You can select different PAM services for different directories
or locations in your web server filesystem space.
Apache2::AuthPAM works as follows:
calls pam_start with the selected service.
calls pam_authenticate with the browser/apache supplied username and password.
calls pam_acct_mgmt.
calls pam_end.
If any of the PAM functions fail, Apache2::AuthPAM logs an info level message and returns C<AUTH_REQUIRED>.
If all PAM functions are succesfull, Apache2::AuthPAM logs an info level message and returns C<OK>.
Remember that if you don't use https (SSL) then your username and password is
transmitted on the network in plain text with each request. So if you are going
to use your system password database, you B<MUST> also use B<mod_ssl> or you
accounts will be easily compromised.
=head1 BUGS
Apache2::AuthPAM is running as the same user mod_perl is running
(on RedHat Linux it is apache). It is running without privileges.
=head1 AUTHOR
Tim Bunce L<http://www.tim.bunce.name> based on work by Héctor Daniel Cortés González E<lt>hdcg@cie.unam.mxE<gt>
( run in 0.742 second using v1.01-cache-2.11-cpan-49f99fa48dc )