PSK checks on client side only, PSK should not be transmitted by client.

This commit is contained in:
Sascha Spreitzer 2009-05-24 11:56:24 +02:00
parent 9fdacb611f
commit 739c7b2507

View file

@ -0,0 +1,52 @@
<?
// we need at least 4 POST data elements.
// 1. Authentication mode -> PAM_AUTH, PAM_SESS, PAM_ACCT, PAM_PASS
// 2. PSK, Pre Shared Key
// 3. USER
// 4. PASS
// DO SOURCE IP REGION CHECKS HERE, OTHERWISE BRUTEFORCE attacks might occur!!
$PSK = "hase";
if( isset($_POST["user"]) && isset($_POST["pass"]) && isset($_POST["mode"]) )
{
$ret=0;
switch($_POST["mode"])
{
case "PAM_AUTH";
// Perform authing here
break;
case "PAM_ACCT";
// Perform account aging here
break;
case "PAM_SESS";
// Perform session management here
break;
case "PAM_PASS";
// Perform password changes here
break;
}
if( 0 == $ret )
{
header("HTTP/1.1 200 OK");
echo $PSK;
}
else
{
header("HTTP/1.1 400 Bad Request");
echo "ACCESS DENIED";
}
}
else
{
header("HTTP/1.1 403 Forbidden");
echo "ACCESS DENIED";
}
?>