#!/usr/bin/perl -w use strict; use warnings; use Authen::Simple::PAM; use CGI qw( :standard :html3 ); use CGI::Carp qw(fatalsToBrowser); my $cgi = new CGI; my $pam = Authen::Simple::PAM->new( service => 'sshd', ); print $cgi->header(); print $cgi->start_html(); print $cgi->start_form(); print $cgi->textfield(-name=>'username'); print $cgi->password_field(-name=>'passwd'); print $cgi->submit(-name=>'submit',-value=>'submit'); if($cgi->param('submit')) { my $password = $cgi->param('passwd'); my $username = $cgi->param('username'); if( $pam->authenticate( $username, $password) ) { print "Authentication Succesfull
"; } else { print "Authentication failed
"; } } print $cgi->end_html();