Example #1
0
    echo "\tsetname: setname <username> <realname> - sets the real name for a user\n";
    echo "\tsettoken: settoken <username> <tokenkey> - sets the key (hex) for a token\n";
    echo "\tsettype: settype <username> <tokentype> - sets a token type for a user\n";
    echo "\tgetusers: getusers - gets a list of users\n";
    echo "\tgetotk: getotk <username> - gets the OTKID for a key\n";
    echo "\tradauth: radauth <username> <pin> - for radius, only returns a code\n";
    echo "\tsynctoken: synctoken <username> <tokenone> <tokentwo> - resync's a hotp token based on two token codes\n";
    echo "\ttokentype: tokentype <username> - gets the token type for a user\n";
    echo "\taddradclient: addradclient <client_name> <client_ip> <client_secret> \"<description>\"- adds a radius client\n";
    echo "\trmradclient: rmradclient <client_name> - removes a radius client with the name <client_name>\n";
    echo "\tgetradclients: getradclients - returns a list of radius clients\n";
    return 0;
}
switch ($argv[1]) {
    case "rmradclient":
        $msg = $myAC->deleteRadiusClient($argv[2]);
        if ($msg) {
            echo "Successfully deleted\n";
        }
        break;
    case "getradclients":
        $msg = $myAC->getRadiusClients();
        foreach ($msg as $client) {
            if ($client["desc"] == "") {
                $desc = "no description set";
            } else {
                $desc = $client["desc"];
            }
            echo $client["name"] . " is " . $client["ip"] . ", {$desc}\n";
        }
        break;
Example #2
0
require_once "../lib/authClient.php";
$myAC = new GAAuthClient();
session_start();
if (isset($_SESSION["loggedin"])) {
    if ($_SESSION["loggedin"]) {
        $loggedin = true;
    } else {
        $loggedin = false;
    }
}
if (isset($_REQUEST["action"])) {
    switch ($_REQUEST["action"]) {
        case "deleteradclient":
            $clientname = $_REQUEST["clientname"];
            $ret = $myAC->deleteRadiusClient($clientname);
            header("Location: ?message=" . urlencode("Client Deleted"));
            exit(0);
            break;
        case "addradclient":
            $clientname = $_REQUEST["clientname"];
            $clientip = $_REQUEST["clientip"];
            $clientsecret = $_REQUEST["clientsecret"];
            $clientdesc = $_REQUEST["clientdesc"];
            $ret = $myAC->addRadiusClient($clientname, $clientip, $clientsecret, $clientdesc);
            if ($ret === true) {
                header("Location: ?message=" . urlencode("Client Added"));
            } else {
                if ($ret == "name") {
                    header("Location: ?error=" . urlencode("Client Name Already Existed"));
                } else {