In this article, we’re going to learn how to integrate the Radius Server from the previous tutorial with WHMCS, in order to automatically provision orders and manage users on our network.
What is WHMCS?
WHMCS is a popular client management system ( CMS ), mostly used by hosting companies. It has been around since the early days and it is still going strong to this day. One of the features that made it so popular is the ability to bill customers and automatically set up their order. If you’re on this page, it’s a safe bet to assume that you’re already familiar with WHMCS, so I won’t go into any more details.
Table of Contents
- What is WHMCS?
- FreeRadius Provisioning Module
- Step 0 – Log into the Freeradius server with Putty
- Step 1 – Freeradius MYSQL remote connections
- Step 2 – Create Radius Profiles
- Step 3 – WHMCS Freeradius Module
- Step 4 – Add a Product Server
- Step 5 – Create a WHMCS Product
- Further Customization
FreeRadius Provisioning Module
The WHMCS module from this guide is able to Create, Suspend, Unsuspend, Change Password, and Terminate radius accounts from WHMCS, be it automatically or manually from the admin panel.
The Client Area will display basic product information and the option for Cancellation and Password Change.
Before we start, make sure that you already have a server with Freeradius + daloRadius installed. If you don’t, you can order a VPS with both installed and have it delivered in minutes.
This tutorial has been tailored and tested using DraculaServers Radius VPS.
Step 0 – Log into the Freeradius server with Putty
The first time you open an ssh session the Freeradius server ordered from draculaservers.com, the MySQL and radius password will be displayed. Please note them down as you’ll need them later in this guide.
============================================== Phpmyadmin: http://server_IP_or_domain/phpmyadmin Your Mysql root password: MTUzYzllMTljMjk5OWU5ZDYyMmViZTw ============================================ Radius Panel: http://server_IP_or_domain/radpanel User: administrator Pass: MTUzYzllMTljMjk5OWU5ZDYyMmViZTw
Step 1 – Freeradius MYSQL remote connections
By default, Mysql only allows localhost connections. That is not good for our goal as we want to allow WHMCS access to the radius database. We need to change the default settings so that MySQL will allow remote connections.
Set bind = 0.0.0.0 save and restart the MySQL service
service mysql restart
mysql -uroot -pYOURPASSWORD GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'YOURPASSWORD' WITH GRANT OPTION; FLUSH PRIVILEGES;
Although not recommended, we’re going to use the MySQL root for this tutorial. We need to grant it permission to connect remotely to the radius database. For extra security, we recommend creating a new user that is only allowed to connect from the ip address of the WHMCS server.
Step 2 – Create Radius Profiles
For each WHMCS product, you plan on selling, create a corresponding profile group in Daloradius. You can assign any radius attribute to the groups and set different bandwidth limits and simultaneous connections for each profile group.
We’re going to use profiles to differentiate between WHMCS billing plans and products.
Step 3 – WHMCS Freeradius Module
From your DraculaServers client area download the WHMCS Radius module. You can also start the download from here.
Upload the zip file to your WHMCS server, in the modules/servers/ folder.
Step 4 – Add a Product Server
From the WHMCS admin panel, go to Setup > Products/Services > Servers.
Click on the Add Server and input your radius server data.
Add the Freeradius’ MySQL database credentials in the user/password field.
Add the database name in the Access Hash field and click Test Connection. If the WHMCS server manages to establish a database connection to the radius server, a SUCCESSFUL message will be displayed.
Click OK to add the server and create a new Server Group containing the newly added server.
Step 5 – Create a WHMCS Product
Navigate to Setup > Products/Services > Products/Services and create a new product. After setting the price and the product details, go to the Module Settings tab.
Select FreeRadius DraculaServers from the dropdown and the Server Group containing the server we have created at the previous step.
In the Radius Group box add the Radius Profile we have created on Step 2. In our case, the profile is named OneDevice and contain radius attributes that limit the user to 1 connection and 12 GB of bandwidth per month.
You can customize the profile group from the Freeradius DaloRadius panel as you see fit for your service you are running.
The Radius account names will be randomly generated. Select a preferred prefix to be included in the names.
Click OK to save the product.
In WHMCS, place an order for your newly added product and click Create from the User’s Products/Services panel.
A green message should appear if the user has been successfully created on the Freeradius server.
Login into the DaloRadius Panel and go to Management > List Users to see the newly created user.
To test the Radius user you can download NTRadPing and initiate a radius connection. We’ve already done this in a past tutorial. See it here.
Don’t hesitate to reach out to our support department if you need more functionality from the WHMCS module. We can be hired to create a tailored version that fits your exact requirements.