Freeradius + MySQL + WHMCS + Mikrotik (Step 3)

Running v7 whmcs.

Installing freeradius whmcs module from

https://github.com/eksoverzero/whmcs-freeradius/tree/refactor

WHMCS FreeRADIUS
Gitter

A FreeRADIUS provisioning/server module for WHMCS

Installing
The files
whmcs-freeradius/
  |- whmcs/                  <--- All the files for the WHMCS server
    |- freeradius/           <--- All the files required to create FreeRADIUS accounts
      |- lib/
      |- templates/
      |- tests/
      |  hooks.php
      |  logo.png
      |  freeradius.php
    |- api                   <--- All the files required for FreeRADIUS to speak to WHMCS
      | freeradiusapi.php
  |- freeradius/             <--- All the files for the FreeRADIUS server
    | cron.php
    | config.php.example
  | README.md
WHMCS
Copy the whmcs/freeradius folder to the WHMCSROOT/modules/servers/ folder
Copy the whmcs/api/freeradiusapi.php file into the WHMCSROOT/include/api/ folder
FreeRADIUS servers
Copy the freeradius folder to anywhere on the FreeRADIUS server.

Rename config.php.example to config.php

Edit config.php with your database and WHMCS server details

Create a Cron task for the cron.php file. If you want it to run every 5 minutes:

*/5 * * * * /PATH/TO/php -q /PATH/TO/whmcs-freeradius/freeradius/cron.php
On Linux, you can find the PATH/TO by running which php

For using hotspot with time limit from first login, enable sqlcounter mod on free radius

cd /etc/freeradius/3.0/mods-enabled
sudo ln -s ../mods-available/sqlcounter sqlcounter

add code in authorize section on sites-available default file:

authorize {
expire_on_login
}

For hotspot login:

on whmcs, login, add product, select module freeradius, add radiusgroup, ex.hs-1d (hotspot 1day active). Goto freeradius database > radgroupcheck table, insert ‘groupname,attribute,op,value’ > ‘hs-1d,Expire-After,:=,86400’. then Goto freeradius database > radgroupreply table, insert ‘groupname,attribute,op,value’ > ‘hs-1d,Mikrotik-Group,:=,hs-1d‘.

on mikrotik goto hotspot > user-profiles > add hs-1d (hotspot setup must be done before).

For ppp:

on whmcs, login, add product, select module freeradius, add radiusgroup, ex.upto (broadband connection). Goto freeradius database > radgroupreply table, insert ‘groupname,attribute,op,value’ > ‘upto,Mikrotik-Group,:=,upto‘.

on mikrotik goto ppp > profiles > add upto

NOTE: ‘groupname’ refer to radius group value on product’s module setting. ‘value’ refer to profiles name on mikrotik.