mce has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: authenticate via cgi-bin
by valdez (Monsignor) on Jan 07, 2003 at 11:17 UTC | |
|
Re: authenticate via cgi-bin
by submersible_toaster (Chaplain) on Jan 07, 2003 at 11:59 UTC | |
by mce (Curate) on Jan 07, 2003 at 12:23 UTC | |
by submersible_toaster (Chaplain) on Jan 07, 2003 at 12:43 UTC | |
|
Re: authenticate via cgi-bin
by mce (Curate) on Jan 07, 2003 at 12:15 UTC | |
by submersible_toaster (Chaplain) on Jan 09, 2003 at 23:17 UTC | |
|
Re: authenticate via cgi-bin
by traveler (Parson) on Jan 07, 2003 at 13:38 UTC | |
by mce (Curate) on Jan 07, 2003 at 15:30 UTC | |
by OM_Zen (Scribe) on Jan 07, 2003 at 16:19 UTC | |
|
Re: authenticate via cgi-bin
by strredwolf (Chaplain) on Jan 07, 2003 at 23:19 UTC |