I am working on a cgi project involving security. The server is apache on solaris. I cannot change any of the apache configuration and cannot recompile it. Nor can I change perl. (I cannot add suidperl). I cannot install sudo or similar.
Now my question: I want the user to authenticate via the web browser via cookies (f.e. via this.)
The setup is that I need to authenticate via Unix user and passwords (/etc/passwd and /etc/shadow).
But not as the apache user (this is normal as /etc/shadow is not readable as a normal user, unix perms prevents this).use strict; use Data::Dumper; use CfgTie::TieShadow; my $userid=shift || die "missing argument"; my $guess=shift || die "missing argument"; my %passwd; my %allgroup; tie %passwd, 'CfgTie::TieShadow'; die "cannot init passwd hash" if not keys %passwd; my $rc=1; if ( $passwd{$userid} ) { my $password=$passwd{$userid}->{password} ; if ( crypt($guess,$password) eq $password ) { $rc=0; my @mygroups; $mygroups[0]=getgrgid($passwd{$userid}->{groupid}); # Get the groups my $regex=qr/\b$userid\b/; while ( my ($group,$passwd,$gid,$members)= getgrent ) { if ( $members =~ $regex ) { push @mygroups, $group; } } print join(',',@mygroups); } else { warn "Authentication Failed"; } } else { warn "User $userid does not exist"; } exit $rc;
So I desided to put the suid flag on an authetication script, and call this with a system call. Since I have no suidperl I need to compile it. p2e does the trick, but this will NOT let suid scripts run.
To make a long store short. Is there a way to autheniticate unix users/groups via cgi-bin? Is there a way to compile perl code so that suid bits work?
I hope this question is clear enough.
---------------------------
Dr. Mark Ceulemans
Senior Consultant
IT Masters, Belgium
In reply to authenticate via cgi-bin by mce
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |