Helper doent authentify

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Helper doent authentify

Edwin Quijada

Hi!
I am trying to do a helper for use with Squid. I did my helper but it doesnt authentify

<?php

$f = fopen("php://stdin", "r");
while (!(feof($f)))
{
    $line = fgets($f);
    if ($line)
     {
        $fields = explode(' ', trim($line));
        $username = rawurldecode($fields[0]);
        $password = rawurldecode($fields[1]);

        if ($username=="edwin" &&  $password=="1234")
         fwrite(STDOUT, "OK\n");
        else
         fwrite(STDOUT, "ERR\n");
    }
}
?>

when I put the values it continues asked me user/password



_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: Helper doent authentify

Antony Stone
On Monday 11 December 2017 at 22:19:53, Edwin Quijada wrote:

> Hi!
> I am trying to do a helper for use with Squid. I did my helper but it
> doesnt authentify
>
> <?php
>
> $f = fopen("php://stdin", "r");
> while (!(feof($f)))
> {
>     $line = fgets($f);
>     if ($line)
>      {
>         $fields = explode(' ', trim($line));
>         $username = rawurldecode($fields[0]);
>         $password = rawurldecode($fields[1]);
>
>         if ($username=="edwin" &&  $password=="1234")
>          fwrite(STDOUT, "OK\n");
>         else
>          fwrite(STDOUT, "ERR\n");
>     }
> }
> ?>
>
> when I put the values it continues asked me user/password

I think "$f" might be your problem.

See http://freesoftwaremagazine.com/articles/authentication_with_squid/ for
what might be a clue (sorry, I'm not really a PHP coder).


Antony.

--
Why is "dylexia" so difficult to spell, and why can I never remember "aphasia"
when I want to?

                                                   Please reply to the list;
                                                         please *don't* CC me.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: Helper doent authentify

Edwin Quijada





From: squid-users <[hidden email]> on behalf of Antony Stone <[hidden email]>
Sent: Monday, December 11, 2017 9:27 PM
To: [hidden email]
Subject: Re: [squid-users] Helper doent authentify
 
On Monday 11 December 2017 at 22:19:53, Edwin Quijada wrote:

> Hi!
> I am trying to do a helper for use with Squid. I did my helper but it
> doesnt authentify
>
> <?php
>
> $f = fopen("php://stdin", "r");
> while (!(feof($f)))
> {
>     $line = fgets($f);
>     if ($line)
>      {
>         $fields = explode(' ', trim($line));
>         $username = rawurldecode($fields[0]);
>         $password = rawurldecode($fields[1]);
>
>         if ($username=="edwin" &&  $password=="1234")
>          fwrite(STDOUT, "OK\n");
>         else
>          fwrite(STDOUT, "ERR\n");
>     }
> }
> ?>
>
> when I put the values it continues asked me user/password

I think "$f" might be your problem.

See http://freesoftwaremagazine.com/articles/authentication_with_squid/ for


I copied my example from this page. 😞
If I run the script it works fine , returns OK or ERR that is suppose to receive


what might be a clue (sorry, I'm not really a PHP coder).


Antony.

--
Why is "dylexia" so difficult to spell, and why can I never remember "aphasia"
when I want to?

                                                   Please reply to the list;
                                                         please *don't* CC me.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users


_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: Helper doent authentify

Edwin Quijada
In reply to this post by Antony Stone

This is my squid3.conf

#Recommended minimum configuration:

#acl manager proto cache_object
http_port 3128
cache_dir ufs /var/spool/squid3 2048 16 256
maximum_object_size 100 MB
cache_swap_low 90
cache_swap_high 95

#--------------- Reglas de Autorizacion -------------
auth_param basic program  /usr/bin/php /root/squid_helper2.php
auth_param basic children 20
auth_param basic realm Proxy Quijada Usuario Y Clave
auth_param basic credentialsttl 5 hours
#----------------------------------------------------
acl AuthenticatedUsers proxy_auth REQUIRED
http_access allow AuthenticatedUsers
#-------------------- ACL Puertos --------------------
acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http

acl CONNECT method CONNECT

#---------------------- HTTP ACCES DEFAULT-------------
#http_access allow manager localhost
#http_access deny manager
#http_access deny !Safe_ports

#http_access deny to_localhost
#icp_access deny all
#htcp_access deny all







From: squid-users <[hidden email]> on behalf of Antony Stone <[hidden email]>
Sent: Monday, December 11, 2017 9:27 PM
To: [hidden email]
Subject: Re: [squid-users] Helper doent authentify
 
On Monday 11 December 2017 at 22:19:53, Edwin Quijada wrote:

> Hi!
> I am trying to do a helper for use with Squid. I did my helper but it
> doesnt authentify
>
> <?php
>
> $f = fopen("php://stdin", "r");
> while (!(feof($f)))
> {
>     $line = fgets($f);
>     if ($line)
>      {
>         $fields = explode(' ', trim($line));
>         $username = rawurldecode($fields[0]);
>         $password = rawurldecode($fields[1]);
>
>         if ($username=="edwin" &&  $password=="1234")
>          fwrite(STDOUT, "OK\n");
>         else
>          fwrite(STDOUT, "ERR\n");
>     }
> }
> ?>
>
> when I put the values it continues asked me user/password

I think "$f" might be your problem.

See http://freesoftwaremagazine.com/articles/authentication_with_squid/ for

what might be a clue (sorry, I'm not really a PHP coder).


Antony.

--
Why is "dylexia" so difficult to spell, and why can I never remember "aphasia"
when I want to?

                                                   Please reply to the list;
                                                         please *don't* CC me.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users


_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: Helper doent authentify

Antony Stone
In reply to this post by Edwin Quijada
On Monday 11 December 2017 at 22:56:16, Edwin Quijada wrote:

> From: squid-users <[hidden email]> on behalf of
> Antony Stone <[hidden email]> Sent: Monday, December
> 11, 2017 9:27 PM
> To: [hidden email]
> Subject: Re: [squid-users] Helper doent authentify
>
> On Monday 11 December 2017 at 22:19:53, Edwin Quijada wrote:
> > Hi!
> > I am trying to do a helper for use with Squid. I did my helper but it
> > doesnt authentify

....

> I think "$f" might be your problem.
>
> See http://freesoftwaremagazine.com/articles/authentication_with_squid/ for
>
> I copied my example from this page. 😞

Well, no, you didn't.

You may have used it as an example, but you changed it, and I think that
change may be significant.

Try replacing "$f" in your script with "STDIN" as shown in the example, and
see if this helps.

Incidentally, please reply only to the list and do not CC me (see my sigs).

Thanks,


Antony.

--
Normal people think "If it ain't broke, don't fix it".
Engineers think "If it ain't broke, it doesn't have enough features yet".

                                                   Please reply to the list;
                                                         please *don't* CC me.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users