Packet of Disconnect PHP

Marius Pesé Marius at mindspring.co.za
Wed Aug 3 08:50:12 CEST 2011


I didn't even know there were Radius functions in PHP...

Anyway, I did do my POD with PHP:

First get all the information you need from the database:

SELECT
        `radcheck`.`username`,
        `radcheck`.`attribute`,
        `radcheck`.`value`*1024*1024*1024,
        `radacct`.`framedipaddress`,
        `radacct`.`xascendsessionsvrkey`,
        `radacct`.`nasipaddress`,
        `radacct`.`acctstoptime`,
        `radacct`.`realm`
FROM
        `radcheck`
CROSS JOIN
        `radacct`
ON
        `radcheck`.`username` = `radacct`.`username`
WHERE
	.....

Then you can use this to pipe it through radclient, assuming your web server hosting this script is the same as your Radius server this is quite easy:

                $disconnect=exec('
                        echo "User-Name = '.$row[0].', Framed-IP-Address = '.$row[3].', X-Ascend-Session-Svr-Key = '.$row[4].', NAS-IP-Address = '.$row[5].'" | radclient -x NAS.IP.ADD.RESS:PORT disconnect SECRET
                ');

This way I am iterating through a list of accounts returned by the query (do some calculations) and then kick them off the network.
Maybe not the most sophisticated method but it does the trick.
Hope this helps

Kind regards

Marius Pesé
Mindspring Computing

-----Original Message-----
From: freeradius-users-bounces+marius=mindspring.co.za at lists.freeradius.org [mailto:freeradius-users-bounces+marius=mindspring.co.za at lists.freeradius.org] On Behalf Of Arran Cudbard-Bell
Sent: Wednesday, August 03, 2011 8:21 AM
To: FreeRadius users mailing list
Subject: Re: Packet of Disconnect PHP

Its possible... IIRC (and this was a long long time a go) type is just an integer value http://www.php.net/manual/en/function.radius-create-request.php and also though there are two constants defined, it can actually be *any* integer value, so just use type 40 for POD.

You'll need to make sure you have the right combination of attributes to identify the user, some NAS are *VERY* picky.

-Arran

PS I think the RADIUS stuff is an extension, so you'll need to install it using PECL.


On 3 Aug 2011, at 01:03, mark fennema wrote:

> Hello, I'm working on getting a hotspot set up, and I need the ability
> to have a user log themselves out, so that they can connect on another
> computer. I have it set up so that the user can enter their
> information and have it log them out, but it doesn't disconnect them
> from the router, so they can continue using the internet until they
> disconnect from the wireless, so I need to send a packet of
> disconnect. Is there a way to do this in php?
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
> 

Arran Cudbard-Bell
a.cudbardb at freeradius.org

RADIUS - Half the complexity of Diameter


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html




More information about the Freeradius-Users mailing list