Difference between revisions of "FreeRadius Addon Module"

From WHMCS Documentation

(Installing & Using FreeRadius with WHMCS)
(Activating FreeRadius Addon Module)
 
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
'''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.
+
== About this Addon Module ==
(Description taken from http://en.wikipedia.org/wiki/FreeRADIUS)
 
  
Typically we find users of WHMCS utilising FreeRadius to offer Dial Up Internet & Broadband Services. And so an addon module has been created to integrate with FreeRadius that supports '''automatic account creations, suspensions, unsuspension, terminations, password resets and upgrading/downgrading of accounts''' on the FreeRadius Server. Usage stats for the current billing period are also displayed within the WHMCS client area.
+
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: [http://en.wikipedia.org/wiki/FreeRADIUS Wikipedia:FreeRADIUS]
  
==Buying the Addon==
+
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:
  
The FreeRadius Addon Module is available for $150 and can be purchased via the link below.
+
*account creation
 +
*suspensions
 +
*unsuspension
 +
*terminations
 +
*password resets
 +
*upgrading/downgrading of accounts between FreeRADIUS groups
  
https://www.whmcs.com/members/cart.php?a=add&pid=160
+
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.
  
==Installing & Using FreeRadius with WHMCS==
+
<table class="table" style="text-align:center;margin:1em 1em 1em 0;background:#F9F9F9;border:1px #AAA solid;border-collapse:collapse;width:100%;">
 +
<tr>
 +
<th style="border:1px #AAA solid;padding:0.2em;background:#F2F2F2;text-align:center;">Addon Name</th>
 +
<th style="border:1px #AAA solid;padding:0.2em;background:#F2F2F2;text-align:center;">Latest Release</th>
 +
<th style="border:1px #AAA solid;padding:0.2em;background:#F2F2F2;text-align:center;">Current Version</th>
 +
<th style="border:1px #AAA solid;padding:0.2em;background:#F2F2F2;text-align:center;">Compatible With</th>
 +
<th style="border:1px #AAA solid;padding:0.2em;background:#F2F2F2;text-align:center;">Included in WHMCS</th>
 +
</tr>
 +
<tr>
 +
<td style="border:1px #AAA solid;padding:0.2em;">FreeRadius Addon Module</td>
 +
<td style="border:1px #AAA solid;padding:0.2em;">N/A</td>
 +
<td style="border:1px #AAA solid;padding:0.2em;">N/A</td>
 +
<td style="border:1px #AAA solid;padding:0.2em;">WHMCS</td>
 +
<td style="border:1px #AAA solid;padding:0.2em;color:darkred;">No</td>
 +
</tr>
 +
</table>
  
Once you've purchased the FreeRadius addon, you will receive an email once activated directing you where to download the addon from.  Once downloaded, the freeradius module folder simply needs to be uploaded to the '''/modules/servers/''' folder of your WHMCS installation.
+
== 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 FreeRadius module interacts directly with the Radius database system and so once installed, you then need to go to '''Setup > Servers''' and create a server for the FreeRadius accounts entering the details as follows:
+
<div class="docs-alert-info"><i class="fa fa-info-circle"></i>
 +
This addon does not require activation at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Addon Modules]]''' or, prior to WHMCS 8.0, '''Setup > Addon Modules'''.
 +
</div>
 +
 +
To do this:
 +
 +
# [https://www.whmcs.com/members/cart.php?a=add&pid=160 Purchase the addon from WHMCS]. You will receive an email with a download link.
 +
# Download the files.
 +
# In your WHMCS installation, create the '''/modules/servers/freeradius/''' directory.
 +
# Upload the addon files to the directory.
 +
# Go to '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Servers]]''' or, prior to WHMCS 8.0, '''Setup > Products/Services > Servers'''.
 +
# 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.
 +
# Go to '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Products_and_Services|Products/Services]]''' or, prior to WHMCS 8.0, '''Setup > Products/Services > Product/Services'''.
 +
# Create a product. In the '''Module Settings''' tab, select '''Freeradius''' and enter the appropriate '''Group Name''' from Radius.
  
*'''Name''' - Anything you choose
+
==FAQs==
*'''IP Address''' - SQL Hostname
 
*'''Server Type''' - Freeradius
 
*'''Username''' - SQL Username
 
*'''Password''' - SQL Password
 
*'''Access Hash''' - SQL Database Name
 
  
Next it's time to create a product, this is done under '''Setup > Products & Services''' as with any product in WHMCS. From there select the Add New Product option, specify a name, description & pricing, etc... all as desired, and then on the Module Settings tab, select the '''Freeradius''' module option and enter the '''Group Name''' defined in Radius to control the permissions/limitations of the account this product should setup.
+
#'''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.
 +
#'''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.
 +
#'''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.
 +
#'''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.
 +
#'''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.
 +
#'''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.
 +
#'''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.
  
That's all there is to it. You can then begin using the module in WHMCS as with any module, either manually invoking via the Module Command buttons displayed on a clients instance of the product, using the automated setup options of instantly upon order, after first payment or after manual admin review, and with the automated actions of overdue suspension, reactivations, late terminations, etc...
+
<source lang="php">
 +
/*
 +
* 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' => '',
 +
));
 +
*/
 +
</source>
  
  
==FAQ's==
+
#'''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.
  
;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.
+
<source lang="php">
  
; 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.
+
/*
 +
* 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' => ':=',
 +
));
 +
 +
*/
 +
</source>
  
; 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.
+
== Troubleshooting ==
 
+
; 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.
+
''N/A''
 
+
; 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.
+
== Change Log ==
 
+
; 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.
+
''N/A''
 
 
; How can I sync the name and contact information between WHMCS and FreeRADIUS? : This information can be synced between WHMCS and FreeRADIUS by uncommenting line 167 through line 173 of the module. This will allow the name and contact details of the client in WHMCS to sync over to the users FreeRADIUS account.
 
 
 
; How do I specify additional radius configuration parameters for new accounts? : To apply additional radius parameters to new accounts, simply duplicate lines 153 to 159 in the freeradius.php file within the freeradius_CreateAccount function, 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.
 

Latest revision as of 19:01, 22 April 2022

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