2016-08-17 - Re: Power Off and User Re-Login

Header Data

From: Hotspotuser <jo***s@algardata.pt>
Message Hash: 91a9caa00df6a1e4cf75da6c9800837c1a8f2f4f74a5309e8b9c4b12fb65ba93
Message ID: <c31ad6bd-08e3-4e6b-8847-bcfa8bc06893@grasehotspot.org>
Reply To: <da8c8f86-7828-4670-95ef-d0617e98c1c1@grasehotspot.org>
UTC Datetime: 2016-08-17 03:01:35 UTC
Raw Date: Wed, 17 Aug 2016 03:01:35 -0700

Raw message

Wheres one possible implementation that i did just to show that it's 
possible:

<?php 
 
 # GET ALL DEVICES CONNECTED TO HOTSPOT WITHOUT LOGIN
 $result = str_replace("\n", "|", trim(shell_exec("sudo chilli_query list | 
grep 'dnat' | awk '{print $1}'"))); 
 $macs_connected = explode("|",$result);
 echo "<h1>Connected devices without login</h1>";
 echo "<pre>";
 print_r($macs_connected);
 echo "</pre>";
 
 # GET ALL UNCLOSED SESSIONS FROM DATABASE THAT MATCH THE CURRENTLY 
CONNECTED DEVICES WITHOUT LOGIN
 $link = mysqli_connect("127.0.0.1", "YOUR_MYSQL_PASSWORD", 
"YOUR_MYSQL_PASSWORD", "radius");
 $query = "SELECT CallingStationId, UserName, FramedIpAddress, AcctStopTime 
FROM radius.radacct WHERE UserName != 'CoovaChilli' and AcctStopTime is 
null and CallingStationId in ('".implode("','",$macs_connected)."') Group 
BY CallingStationId ORDER by RadAcctId DESC";
 if ($result = $link->query($query)) 
 {
    $loggedin = array();
    while ($device= $result->fetch_assoc()) {
        shell_exec("sudo chilli_query authorize mac ".$device[
'CallingStationId']." username ".$device['UserName']);
        $loggedin[]=$row['CallingStationId'];
    }
    $result->free();
    echo "<h1>Devices we auto-logged in</h1>";
    var_dump($loggedin);
 }
 $mysqli->close();
?>


quarta-feira, 17 de Agosto de 2016 às 07:34:06 UTC+1, Eliot Ness escreveu:
>
> I have to install phpmyadmin to make my life easier.
> So, lets see 1 more time :
>
> chilli_query list | grep "dnat" | awk '{print $1}' 
>
>
> It print out all connected users in this time....ok till now
>
> Then, 
>
> SELECT CallingStationId, UserName, FramedIpAddress, AcctStopTime FROM radius.radacct WHERE UserName != 'CoovaChilli' and AcctStopTime is null Group BY CallingStationId
>
>
> I have to search the above records on phpmyadmin or there is a command 
> that i can extend ?
>
> chilli_query authorize mac *XX**-XX-XX-XX-XX-**XX* username *USERNAME*
>
>
> Last step is to call this on every boot....crontab or init,d actions ?
>
> Beta tests made on Pi2 as i write on a previous post
>
> On Thursday, June 2, 2016 at 9:40:51 AM UTC+3, Eliot Ness wrote:
>>
>> At least one Pi2 comes yesterday in my hands, and ....grase run again.
>> Detailed tutorial steps install on next days.
>>
>> As simple question : On power off or reboot, user have login again, 
>> except if admin store mac adr.
>>
>> Is there any way on grase to remember users after reboot ? So no need 
>> user to login again....
>>
>> Anyone?
>>
>

Thread