LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-30-2011, 04:03 AM   #1
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013

Rep: Reputation: 30
squid custom authentication


I have so far been running squid using the basic ncsa auth.
I now need to add some custom authentication for ncsa auth and also an IP address.
I would like to do this using a PHP script.
How can I check the ncsa auth file in the script:

Code:
if (! defined(STDIN)) {
        define("STDIN", fopen("php://stdin", "r"));
}
while (!feof(STDIN)) {
        $line = trim(fgets(STDIN));
        $fields = explode(' ', $line);
        $username = rawurldecode($fields[0]); //1738
        $password = rawurldecode($fields[1]); //1738
        #I need to check the squid_passwd file here?????
        #how can PHP read the squid_passwd file, is it just a case of going through it line
        #by line
        if ($username == 'hello' 
            and $password == 'world') {
                fwrite(STDOUT, "OK\n");
        } 
        } else {
                // failed miserably
                fwrite(STDOUT, "ERR\n");
        }
}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Active directory Authentication of parent non-squid cache to child squid cache espiya7 Linux - Server 0 05-05-2009 08:04 AM
Authentication using squid mredloft Linux - Security 1 11-28-2008 07:56 AM
LDAP authentication for squid squid 2.6.STABLE16 release 2.fc8 farrukhndm Linux - Security 2 04-03-2008 01:57 AM
Writting PAM Module for custom authentication? existo Linux - Networking 0 05-05-2004 05:07 PM
Squid - Authentication TechnoBod Linux - Networking 3 06-23-2003 07:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration