PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > alt.php > HTTP Authentication in PHP -- limit retries?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
HTTP Authentication in PHP -- limit retries?

Réponse
 
LinkBack Outils de la discussion
Vieux 14/10/2007, 14h08   #1 (permalink)
David Hennessy
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut HTTP Authentication in PHP -- limit retries?

Hi! Is there any way to limit the number of retries when using HTTP
authentication in PHP?

--
TIA,
David
  Réponse avec citation
Vieux 14/10/2007, 14h57   #2 (permalink)
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: HTTP Authentication in PHP -- limit retries?

David Hennessy wrote:
> Hi! Is there any way to limit the number of retries when using HTTP
> authentication in PHP?
>


No.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 15/10/2007, 17h14   #3 (permalink)
Tom
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: HTTP Authentication in PHP -- limit retries?

On Sun, 14 Oct 2007 06:08:39 -0700, David Hennessy wrote...
>
>Hi! Is there any way to limit the number of retries when using HTTP
>authentication in PHP?
>


I've seen lots of sites more to web forms instead of the usual pop-up gray login
boxes that are normally used with HTTP authentication. IF you tried using that
method you can probably keep track of IP address information and setup
restrictions after so many retries.

Tom
--
Newsguy.com - Unlimited Accounts
Now with 32 concurrent connections

  Réponse avec citation
Vieux 16/10/2007, 03h10   #4 (permalink)
David Hennessy
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: HTTP Authentication in PHP -- limit retries?

Tom wrote:
> On Sun, 14 Oct 2007 06:08:39 -0700, David Hennessy wrote...
>> Hi! Is there any way to limit the number of retries when using HTTP
>> authentication in PHP?
>>

>
> I've seen lots of sites more to web forms instead of the usual pop-up gray login
> boxes that are normally used with HTTP authentication. IF you tried using that
> method you can probably keep track of IP address information and setup
> restrictions after so many retries.



That makes sense. Do you think it would be safe to say that HTTP
authentication is insecure, since it permits infinite retries?

--
Namaste,
David
  Réponse avec citation
Vieux 16/10/2007, 03h33   #5 (permalink)
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: HTTP Authentication in PHP -- limit retries?

David Hennessy wrote:
> Tom wrote:
>> On Sun, 14 Oct 2007 06:08:39 -0700, David Hennessy wrote...
>>> Hi! Is there any way to limit the number of retries when using HTTP
>>> authentication in PHP?
>>>

>>
>> I've seen lots of sites more to web forms instead of the usual pop-up
>> gray login
>> boxes that are normally used with HTTP authentication. IF you tried
>> using that
>> method you can probably keep track of IP address information and setup
>> restrictions after so many retries.

>
>
> That makes sense. Do you think it would be safe to say that HTTP
> authentication is insecure, since it permits infinite retries?
>


Not really. If the userid and password are sufficiently long and
random, the amount of time it will take to break them can be measured in
centuries. And if someone tries a brute force attack, you will notice
it if you're watching your logs.



--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 16/10/2007, 19h35   #6 (permalink)
Jeremy
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: HTTP Authentication in PHP -- limit retries?

David Hennessy wrote:
> Hi! Is there any way to limit the number of retries when using HTTP
> authentication in PHP?
>


Despite what everyone else says, this is possible with PHP (though not
with Apache's built-in HTTP authentication, AFAIK).

Read this:

http://us2.php.net/manual/en/features.http-auth.php

The idea is that when the user first tries to access the document, you
send an HTTP 401 header. At this point, you can also keep track of this
as an "attempt" in whatever fashion you like (local database of IP
addresses, for example). Now, each time the user types a new password
you'll check it, and if it's wrong you'll send another 401 header. Keep
track of how many times this happens, and if the number of attempts
exceeds your limit, send a 403 (forbidden) instead of a 401.

Jeremy
  Réponse avec citation
Vieux 17/10/2007, 17h52   #7 (permalink)
David Hennessy
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: HTTP Authentication in PHP -- limit retries?

Jeremy wrote:
> David Hennessy wrote:
>> Hi! Is there any way to limit the number of retries when using HTTP
>> authentication in PHP?
>>

>
> Despite what everyone else says, this is possible with PHP (though not
> with Apache's built-in HTTP authentication, AFAIK).
>
> Read this:
>
> http://us2.php.net/manual/en/features.http-auth.php
>
> The idea is that when the user first tries to access the document, you
> send an HTTP 401 header. At this point, you can also keep track of this
> as an "attempt" in whatever fashion you like (local database of IP
> addresses, for example). Now, each time the user types a new password
> you'll check it, and if it's wrong you'll send another 401 header. Keep
> track of how many times this happens, and if the number of attempts
> exceeds your limit, send a 403 (forbidden) instead of a 401.



Hi Jeremy,

Do you have a reference or an example to demonstrate this? I've
extensively consulted the URL you referenced, and don't see anything to
suggest the functionality you're describing. From my own tests, it
appears that the authentication challenge pop-up does not return to the
PHP script until the user either enters a correct password or hits
"cancel" -- so there's no place to interrupt until the authentication
bit is done. Am I misunderstanding?

--
Namaste,
David
  Réponse avec citation
Vieux 17/10/2007, 20h18   #8 (permalink)
Steve
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: HTTP Authentication in PHP -- limit retries?


"David Hennessy" <david@maidix.com> wrote in message
news:k8qdnVeMRfB-oIvanZ2dnUVZ_sbinZ2d@comcast.com...
> Jeremy wrote:
>> David Hennessy wrote:
>>> Hi! Is there any way to limit the number of retries when using HTTP
>>> authentication in PHP?
>>>

>>
>> Despite what everyone else says, this is possible with PHP (though not
>> with Apache's built-in HTTP authentication, AFAIK).
>>
>> Read this:
>>
>> http://us2.php.net/manual/en/features.http-auth.php
>>
>> The idea is that when the user first tries to access the document, you
>> send an HTTP 401 header. At this point, you can also keep track of this
>> as an "attempt" in whatever fashion you like (local database of IP
>> addresses, for example). Now, each time the user types a new password
>> you'll check it, and if it's wrong you'll send another 401 header. Keep
>> track of how many times this happens, and if the number of attempts
>> exceeds your limit, send a 403 (forbidden) instead of a 401.

>
>
> Hi Jeremy,
>
> Do you have a reference or an example to demonstrate this? I've
> extensively consulted the URL you referenced, and don't see anything to
> suggest the functionality you're describing. From my own tests, it appears
> that the authentication challenge pop-up does not return to the PHP script
> until the user either enters a correct password or hits "cancel" -- so
> there's no place to interrupt until the authentication bit is done. Am I
> misunderstanding?


that's just not true. php is right in the middle of it all. yes, you are
misunderstanding.

have fun with this:


<?
$headers = apache_request_headers();

if (!isset($headers['Authorization']))
{
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: NTLM');
exit;
}
$auth = $headers['Authorization'];
if (substr($auth,0,5) == 'NTLM ')
{
$msg = base64_decode(substr($auth, 5));
if (substr($msg, 0, 8) != "NTLMSSP\x00"){ die('error header not
recognized'); }

if ($msg[8] == "\x01")
{
$challange = "NTLMSSP\x00\x02" . "\x00\x00\x00\x00" . // target name
len/alloc
"\x00\x00\x00\x00" . // target name
offset
"\x01\x02\x81\x01" . // flags
"\x00\x00\x00\x00\x00\x00\x00\x00" . // challenge
"\x00\x00\x00\x00\x00\x00\x00\x00" . // context
"\x00\x00\x00\x00\x30\x00\x00\x00"; // target info
len/alloc/offset
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: NTLM ' . trim(base64_encode($challange)));
exit;
}
if ($msg[8] == "\x03")
{
function get_msg_str($msg, $start, $unicode = true)
{
$len = (ord($msg[$start + 1]) * 256) + ord($msg[$start]);
$off = (ord($msg[$start + 5]) * 256) + ord($msg[$start + 4]);
$msg = substr($msg, $off, $len);
return $unicode ? str_replace("\0", '', $msg) : $msg;
}
$user = get_msg_str($msg, 36);
$domain = get_msg_str($msg, 28);
$workstation = get_msg_str($msg, 44);
echo '<pre>' . print_r($msg, true) . '</pre>';

print "You are $user from $domain/$workstation";
}
}
?>


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 03h50.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,14279 seconds with 16 queries