3 * This is the web component of the GA4PHP radius server. This web app should be able to configure freeradius and itself.
5 * This app will try to do the following:
7 * 2) pull accounts from some backend (such as AD)
8 * 3) allow users to self-enroll.
10 * I wonder if we can store data in the backend database itself? that would be interesting
11 * then user admin would be less disconnected. I.e. if a user was deleted from AD, their token
12 * data should disappear with them.
14 require_once("admin_actions.php");
16 // the logged in component
20 Welcome to the Google Authenticator Authentication Server Manager Application - <a href="?showhelp">Show Help</a><br>
23 if(isset($_REQUEST["message"])) {
24 echo "<font color=\"green\">".$_REQUEST["message"]."</font>";
26 if(isset($_REQUEST["error"])) {
27 echo "<font color=\"red\">".$_REQUEST["error"]."</font>";
31 if(isset($_REQUEST["showhelp"])) {
34 On this page, you create users and manage their tokens and passwords. A few notes,<br>
35 <li> Passwords are *ONLY* for this page, if you assign a password to a user they can login here
36 and edit anyone, including you
37 <li> OTK/One-Time-Keys are the QRcode for provisioning a GA token, it can only be viewed once
38 and once viewed is deleted. If you need a new one, you need to re-create a key.
39 <li> TOTP tokens are time based tokens that change every 30 seconds, HOTP tokens are event tokens
40 that change everytime they are used or generated
41 <li> In the OTK, the "Get (User URL)" link is a link you can send to a user to retrieve their key
45 if(isset($_REQUEST["edituser"])) {
46 $username = $_REQUEST["edituser"];
49 <h2>Editing user, <?php echo $username ?></h2><br>
50 <form method="post" action="?action=edituser&username=<?php echo $username ?>">
51 <input type="hidden" name="original_real" value="<?php echo $_REQUEST["realname"] ?>">
53 <tr><td>Real Name:</td><td><input type="text" name="realname" value="<?php echo $_REQUEST["realname"] ?>"></td></tr>
54 <tr><td>Password:</td><td><input type="password" name="password"></td></tr>
55 <tr><td>Confirm Password:</td><td><input type="password" name="password_conf"></td></tr>
57 <input type="submit" value="Update">
60 if($myAC->getUserTokenType($username)=="HOTP") {
62 <form method="post" action="?action=synctoken&username=<?php echo $username?>">
63 <h3>Resync Tokens</h3>
65 <tr><td>Token One</td><td><input type="text" name="tokenone"></td></tr>
66 <tr><td>Token Two</td><td><input type="text" name="tokentwo"></td></tr>
68 <input type="submit" value="Sync">
74 <form method="post" action="?action=customtoken&username=<?php echo $username ?>">
75 <h3>Custom Tokens - doesnt work yet</h3><br>
76 For assiging in a user-created or hardware tokens<br>
77 Token Key (hex) <input type="text" name="tokenkey"><br>
79 <select name="tokentype">
80 <option value="HOTP">HOTP</option>
81 <option value="TOTP">TOTP</option>
83 <input type="submit" value="Set">
90 <tr><th>Username</th><th>RealName</th><th>Has Password?</th><th>Has Token?</th><th>One Time Key</th><th>Delete</th></tr>
92 $users = $myAC->getUsers();
93 foreach($users as $user) {
94 $username = $user["username"];
96 if($user["realname"] == "") $realname = "";
97 else $realname = $user["realname"];
99 if($user["haspass"]) $haspass = "Yes <a href=\"?action=deletepass&username=$username\">Delete Password</a>";
100 else $haspass = "No";
102 if($user["otk"]=="deleted") $otk = "OTK Was Not Picked Up";
103 else if($user["otk"]!="") $otk = "<a href=\"?action=getotk&username=$username&otk=".$user["otk"]."\">Get (admin)</a> <a href=\"index.php?gettoken&username=$username&otkid=".$user["otk"]."\">Get (User URL)</a>";
104 else $otk = "Already Claimed";
106 if($user["hastoken"]) $hastoken = "Yes <a href=\"?action=recreatehotptoken&username=$username\">Re-Create (HOTP)</a> <a href=\"?action=recreatetotptoken&username=$username\">Re-Create (TOTP)</a> <a href=\"?action=deletetoken&username=$username\">Delete</a>";
108 $hastoken = "No <a href=\"?action=recreatehotptoken&username=$username\">Create (HOTP)</a> <a href=\"?action=recreatetotptoken&username=$username\">Create (TOTP)</a>";
109 if($user["otk"]!="deleted")$otk = "No Token Exists";
112 $delete = "<a href=\"?action=delete&username=$username\">Delete</a>";
115 echo "<td><a href=\"?edituser=$username&realname=$realname\">$username</a></td><td>$realname</td><td>$haspass</td>";
116 echo "<td>$hastoken</td><td>$otk</td><td>$delete</td><tr></form>";
120 <form method="post" action="?action=createuser">Create User(s) - Enter a comma seperated list of usernames: <input type="text" name="username" size="120"> <input type="submit" value="Create"></form>
125 if(isset($_REQUEST["action"])) if($_REQUEST["action"] == "getotk") {
126 $username = $_REQUEST["username"];
127 $otk = $_REQUEST["otk"];
128 echo "<hr>Got One Time Key for user $username, this one-time-key can only be retrieved once, after that it is deleted<br>";
129 echo "<img src=\"?action=getotkimg&username=$username&otk=$otk\" alt=\"one time key error\"><br>";
133 <hr><h2>Radius Clients</h2>
136 <hr><a href="?action=logout">Logout</a> <a href="admin.php">Home</a>
154 <h1>GAAS Manager Login</h1>
156 if(isset($_REQUEST["message"])) {
157 echo "<font color=\"green\">".$_REQUEST["message"]."</font>";
159 if(isset($_REQUEST["error"])) {
160 echo "<font color=\"red\">".$_REQUEST["error"]."</font>";
163 <form method="post" action="?action=login">
165 <tr><td>Username</td><td><input type="text" name="username"></td></tr>
166 <tr><td>Password</td><td><input type="password" name="password"></td></tr>
167 <tr><td><input type="submit" value="Go"></td></tr>