This is a discussion on Please Help With mod_auth_external within the Linux Web Servers forums, part of the Web Server and Related Forums category; Hi I am using mod_auth_external-2.1.16 for password authentication, with an external script, it works fine for password ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi
I am using mod_auth_external-2.1.16 for password authentication, with an external script, it works fine for password authentication, I world like to start using it also for groups authentication, but I don't rely see how I could find out which group is in my .htaccess file. I will explain my self I am trying to use mod auth for Apache NIS group and password authentication, to require users supply logins and passwords before accessing pages in some directories. 1) I would like to check if the password given is correct for a user 2) I would like to check if the user given is in the group that I entered in the .htaccess file (which my script will check if the user given and the group allowed in .htaccess file match the NIS user group entry) For password authentication it works fine, look my example below, but for group authentication not, I don't know how I could find out what groups are in the .htaccess file to be able to match it up with the my NIS groups I know that mod_auth_external gives you back the user as USER, password as PASS, and group as GROUP, for user and password its simple because this is user entry's but for groups this is something in the ..htaccess file, for GROUP variable what to what group is it set, not the group that is in my .htaccess file Any help is greatly appreciate Thanks Morrisbend elikju@bhphotovideo.com ------------------------------------------------------ This how I installed it and set it up example of my changes to httpd.conf below ==================================== apxs -c mod_auth_external.c apxs -i -a mod_auth_external.so ==================================== LoadModule external_auth_module libexec/mod_auth_external.so AddModule mod_auth_external.c ==================================== # ## This is for Password authentication Program # AddExternalAuth test_user /var/apache/cgi-bin/test.pipe SetExternalAuthMethod test_user pipe # AddExternalGroup test_group /var/apache/cgi-bin/test.pipe SetExternalGroupMethod test_group pipe ==================================== # AllowOverride None AllowOverride AuthConfig ==================================== This is example of .htaccess file ==================================== AuthType Basic AuthName "Enter Login" AuthExternal test_user require user samh AuthType Basic AuthName "Enter group" #AuthExternal test_group GroupExternal test_group require group it ==================================== This is my test.pipe script ==================================== # more /var/apache/cgi-bin/test.pipe #!/usr/local/bin/perl # Get the user name $user= <STDIN>; chomp $user; # print STDERR "$user: This is user \n"; # Get the password name $pass= <STDIN>; chomp $pass; # print STDERR "$pass: This is password \n"; # Accept the login if the user name and the password matchs $cmd = "/usr/bin/ypmatch $user passwd"; $line = `$cmd`; @words = split /:/,$line; $un = $words[0]; if(!$un) # username is invalid { $error = "User Name or Password is not valid"; exit 1; } else { $name = $words[4]; @tmp = split /-/,$name; $name = $tmp[0]; $dpt = $words[3]; $pwd = $words[1]; if(crypt($pass,$pwd) eq $pwd) { print STDERR "$prog: login matches password - Accepted\n"; exit 0; } else { print STDERR "$prog: login doesn't match password - Rejected\n"; exit 1; } } ============================== |
| Thread Tools | |
| Display Modes | |
|
|