--
This mailing list is for the Grase Hotspot Project http://grasehotspot.org
---
You received this message because you are subscribed to the Google Groups "Grase Hotspot" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grase-hotspo...@grasehotspot.org.
To post to this group, send email to grase-...@grasehotspot.org.
Visit this group at https://groups.google.com/a/grasehotspot.org/group/grase-hotspot/.
To view this discussion on the web visit https://groups.google.com/a/grasehotspot.org/d/msgid/grase-hotspot/a892365d-ce49-4a1f-b689-ab8f1520bdad%40grasehotspot.org.
# chilli_query list
00:0D:XX:XX:XX:XX 10.1.0.3 dnat 46c83f70000 0 - 0/0 0/0 http://url.com
# chilli_query authorize ip 10.1.0.3 sessiontimeout 60 username me
# chilli_query list
00:0D:XX:XX:XX:XX 10.1.0.3 pass 46c83f70000 1 me 2/0 2/0 http://url.com
# chilli_query logout 00:0D:XX:XX:XX:XX
Need an extra routine or something else
chilli_query list | grep "dnat" | awk '{print $1}'
Then query your radius radacct database table to get the sessions that where not closed by the hotspot:SELECT CallingStationId, UserName, FramedIpAddress, AcctStopTime FROM radius.radacct WHERE UserName != 'CoovaChilli' and AcctStopTime is null Group BY CallingStationId
This will list of all the hotspot logins that had no StopTime, which usually means the hotspot rebooted without shutting down. When you issue the shutdown command freeradius closes all the active sessions.
You can change the query to get for instance the sessions that were created in the last day. Change the query as needed.
Cross that list of MAC addresses with the one you got from the chilli_query and for each match run the command:
chilli_query authorize mac XX-XX-XX-XX-XX-XX username USERNAME
Replacing XX-XX-XX-XX-XX-XX and USERNAME with the values you got from the chilli_query.
All connected users with data/time available will automatically connect, without user intervension. All that are already expired will still be logged out.
Note that im using the MAC parameter instead of IP on the chilli_query authorize.
This is what i use in our solution, and i call this script at every hotspot boot, you can off course have a link on your hotspot solution to run this PHP Script manually.
I like the direction of this discussion, will attempt asap, this is much needed.
--
This mailing list is for the Grase Hotspot Project http://grasehotspot.org
---
You received this message because you are subscribed to the Google Groups "Grase Hotspot" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grase-hotspo...@grasehotspot.org.
To post to this group, send email to grase-...@grasehotspot.org.
Visit this group at https://groups.google.com/a/grasehotspot.org/group/grase-hotspot/.
To view this discussion on the web visit https://groups.google.com/a/grasehotspot.org/d/msgid/grase-hotspot/29256f5f-631c-4037-86c4-deb336f9b6b6%40grasehotspot.org.
chilli_query list | grep "dnat" | awk '{print $1}'
SELECT CallingStationId, UserName, FramedIpAddress, AcctStopTime FROM radius.radacct WHERE UserName != 'CoovaChilli' and AcctStopTime is null Group BY CallingStationId
chilli_query authorize mac XX-XX-XX-XX-XX-XX username USERNAME<?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();
?>--
This mailing list is for the Grase Hotspot Project http://grasehotspot.org
---
You received this message because you are subscribed to the Google Groups "Grase Hotspot" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grase-hotspot+unsubscribe@grasehotspot.org.
To post to this group, send email to grase-...@grasehotspot.org.
Visit this group at https://groups.google.com/a/grasehotspot.org/group/grase-hotspot/.
To view this discussion on the web visit https://groups.google.com/a/grasehotspot.org/d/msgid/grase-hotspot/8a5dc0cf-a32a-4c4f-8df8-9ceadbc21922%40grasehotspot.org.
Just an observation:... WHERE UserName != 'CoovaChilli' and AcctStopTime is null ...After a reboot, you shouldn't have any session with AcctStopTime as null unless they are new sessions. The reason is that when Freeradius is cleanly shutdown, it ends all sessions. You should see the session stop reason as one of the reasons listed at http://www.juniper.net/techpubs/en_US/junos16.1/topics/concept/radius-terminate-code-app-terminate-reasons-mapping.html. I believe it'll be "Admin Reboot" or "NAS Reboot". So you'd want to look for sessions that have recently ended with a stop reason like that.Not sure why this script was working for other people, but in my experience the only reason you'd have a Null AcctStopTime after a reboot would be an unclean shutdown.
RegardsTim
To unsubscribe from this group and stop receiving emails from it, send an email to grase-hotspo...@grasehotspot.org.
To post to this group, send email to grase-...@grasehotspot.org.
Visit this group at https://groups.google.com/a/grasehotspot.org/group/grase-hotspot/.
$query = "SELECT CallingStationId, UserName, FramedIpAddress, AcctStopTime FROM radius.radacct WHERE UserName != 'CoovaChilli' and AcctStopTime is null or month(AcctStopTime) = month(now()) and CallingStationId in ('".implode("','",$macs_connected)."') Group BY CallingStationId ORDER by RadAcctId DESC";$query = "SELECT CallingStationId, UserName, FramedIpAddress, AcctStopTime FROM radius.radacct WHERE UserName != 'CoovaChilli' Group BY CallingStationId ORDER by RadAcctId DESC";