FreeRadius Addon Module

From WHMCS Documentation

About this Addon Module

FreeRADIUS is the popular open source RADIUS server solution and is the most widely deployed RADIUS server in the world. It supports all common authentication protocols, and the server comes with a PHP-based web user administration tool, called dialupadmin. It is the basis for many commercial RADIUS products and services, like embedded systems, RADIUS appliances that support Network Access Control and WiMAX. Source: Wikipedia:FreeRADIUS

Typically, we find users of WHMCS utilizing FreeRadius to offer Dial Up Internet & Broadband Services. We have created an addon module to integrate with FreeRadius that supports the following:

  • account creation
  • suspensions
  • unsuspension
  • terminations
  • password resets
  • upgrading/downgrading of accounts between FreeRADIUS groups

Usage statistics for the current billing cycle/period will be displayed to end users inside the WHMCS client area. This provides statistics on their upload and download usage, number of logins and total login time. The output, styling and content of this can be customized via the freeradius_ClientArea function within the module.

The module will provision a new account to a specific group, but is not capable of provisioning an account with specific resources. You must define the resources for a given account on the FreeRADIUS system itself.

Addon Name Latest Release Current Version Compatible With Included in WHMCS
FreeRadius Addon Module N/A N/A WHMCS No

Activating FreeRadius Addon Module

Because WHMCS does not include this addon by default, you must purchase and upload it before configuring it in the Admin Area.

This addon does not require activation at Configuration () > System Settings > Addon Modules or, prior to WHMCS 8.0, Setup > Addon Modules.

To do this:

  1. Purchase the addon from WHMCS. You will receive an email with a download link.
  2. Download the files.
  3. In your WHMCS installation, create the /modules/servers/freeradius/ directory.
  4. Upload the addon files to the directory.
  5. Go to Configuration () > System Settings > Servers or, prior to WHMCS 8.0, Setup > Products/Services > Servers.
  6. Create a server for the FreeRadius accounts using the following details:
    • Name — A name for the server.
    • IP Address — The SQL hostname.
    • Server Type — Choose Freeradius.
    • Username — The SQL username.
    • Password — The SQL password.
    • Access Hash — The SQL database name.
  7. Go to Configuration () > System Settings > Products/Services or, prior to WHMCS 8.0, Setup > Products/Services > Product/Services.
  8. Create a product. In the Module Settings tab, select Freeradius and enter the appropriate Group Name from Radius.

FAQs

  1. Does this module work with PostgreSQL?
    • At this time the module only works with MySQL. As the module is provided as plain source code, you may however modify the code so that it works with a PostgreSQL system instead.
  2. I can't see a users stats when logged into the admin area?
    • The stats are only shown on the client area side. You'll need to 'Login as...' to view the stats for a particular account.
  3. I keep getting this error - "FreeRadius Database Query Error: Access denied for user 'vivieqsg_whmcs'@'localhost' to database 'radius'".
    • The MySQL user does not have permissions to access your FreeRADIUS database. If you're hosting WHMCS and FreeRADIUS on different system (which isn't unusual), then you must make sure the MySQL user and host from which the MySQL user is connecting from, have permissions to access the database.
  4. I keep getting this error - "ERROR 2003 (HY000): Can't connect to MySQL server on 'ip.add.res.s' (110)".
    • This usually means MySQL is not set to listen to outside connections or there is a firewall blocking the connections. Please ensure the IP address from which the module is connecting from is whitelisted in your firewall or that MySQL is set to allow external connections to it.
  5. I get this error when trying to use the Module Commands - "FreeRadius Database Query Error: Table 'radius.usergroup' doesn't exist".
    • This means the module is trying to get or put data into your FreeRADIUS MySQL database, but the table either doesn't exist or is named something else. If this happens, you should get a list of the tables in your FreeRADIUS database and compare them with the error you've gotten. It may be necessary at this point to review and adjust the code of the module so that the module uses the names of tables in your database.
  6. How does the module configure usernames?
    • The module will provision accounts and setup usernames based on the email address of the client. It will attempt to use the full email address as the username though if the username is already in use it will use the email address plus some numbers so each username is unique.
  7. How can I sync the name and contact information between WHMCS and FreeRADIUS?
    • This information can be synced between WHMCS and FreeRADIUS by locating and uncommenting the following code in the freeradius.php file. This will allow the name and contact details of the client in WHMCS to sync over to the users FreeRADIUS account.
 /*
 * For the name and contact details of the client in WHMCS to sync over to the users FreeRADIUS account,
 * use the following code snippet:
 *
 
 $freeradiussql
 ->from('userinfo')
 ->insert(array(
 'username' => $username,
 'name' => $params["clientsdetails"]["firstname"] . ' ' . $params["clientsdetails"]["lastname"],
 'mail' => $email,
 'department' => '',
 'homephone' => $params["clientsdetails"]["phonenumber"],
 'workphone' => '',
 'mobile' => '',
 ));
 */


  1. How do I specify additional radius configuration parameters for new accounts?
    • To apply additional radius parameters to new accounts, simply locate and uncomment the following code in the freeradius.php file, adjusting the values given for the attribute, value and op in the MySQL query on the first of those lines as required for your additional configuration parameter.
/*
 * To apply additional radius parameters to new accounts, use the following code snippet
 * for each additional parameter:
 *
 
 $freeradiussql
 ->from('radcheck')
 ->insert(array(
 'username' => $username,
 'attribute' => '<attribute-name>',
 'value' => '<attribute-value>',
 'op' => ':=',
 ));
 
 */

Troubleshooting

N/A

Change Log

N/A