4. Configure Free Radius to use Hotcakes

Now that you have the Hotcakes LAMP side of your 802.11 hotspot working we can continue by setting up Free Radius.

Hotcakes does not just use any version of Free Radius.

Warning

Hotcakes needs version 1.1.4 or above of Free Radius. Version 1.1.6 is recommended. Version 1.1.7 can cause problems.

I know you might be tempted by just installing the version that comes standard with Ubuntu, but then you are in for a half baked solution.

This half baked solution will not be able to do proper book keeping of quotas for time or data (bytes).

Note

As a technical note, I experienced problems with data quotas even with the latest Free Radius. Thus, this guide will show you how to use a custom Perl script to do proper book-keeping in conjunction with the latest compiled version of Free Radius.

4.1. Compiling Free Radius

Before you compile version 1.1.6 of Free Radius, ensure the following packages are installed.

They ensure that Free Radius can use the Perl and MySQL modules.

sudo apt-get install build-essential libmysqlclient15-dev libperl-dev
If you don't know how to install these packages on Ubuntu, please visit the InstallingSoftware page for more information.

You can download the latest version of Free Radius Here (version 1.1.7 as of this writing)

tar -xzvf freeradius-1.1.6.tar.gz
cd freeradius-1.1.6
./configure
make
sudo make install
This will install Free Radius in the '/usr/local' directory.

You can test to see if Free Radius works by issuing the following command:

sudo /usr/local/sbin/radiusd -X 
This will start Free Radius in debug mode ( To stop it -> Ctrl+c).

4.2. Configure Free Radius the quick way

Rather than going through the setup of Free Radius step by step, we take the shorter route.

Copy the sample files

sudo cp /var/www/cake/hotcakes/db/radius/dictionary /usr/local/etc/raddb
sudo cp /var/www/cake/hotcakes/db/radius/proxy.conf /usr/local/etc/raddb
sudo cp /var/www/cake/hotcakes/db/radius/radiusd.conf /usr/local/etc/raddb
sudo cp /var/www/cake/hotcakes/db/radius/rlm_perl.pm /usr/local/etc/raddb
sudo cp /var/www/cake/hotcakes/db/radius/sql.conf /usr/local/etc/raddb
sudo cp /var/www/cake/hotcakes/db/radius/sqlcounter.conf /usr/local/etc/raddb
sudo cp /var/www/cake/hotcakes/db/radius/users /usr/local/etc/raddb
sudo cp /var/www/cake/hotcakes/db/radius/dictionary.chillispot /usr/local/share/freeradius
Change the permissions and ownership.
sudo chown www-data. /usr/local/etc/raddb/proxy.conf
sudo chmod 644 /usr/local/etc/raddb/dictionary

4.3. Specifying the paths used by Hotcakes

Hotcakes needs to know the location of files or directories. You need to verify that they are correct.

You can change these settings by going to the following page as the Admin 'Settings -> Paths & Misc'.

Table 3. Please verify the following

ItemValue
path_to_dictionary_files/usr/local/share/freeradius/
main_dictionary_file/usr/local/etc/raddb/dictionary
location_of_radscenario/var/www/cake/hotcakes/webroot/files/radscenario_wip
radius_proxy_file/usr/local/etc/raddb/proxy.conf

Tip

When you deviate from this standard install, you may have to tweak the 'radscenario_wip' file a bit. It is a Perl script.

4.4. Testing the waters

Now you just need to restart Free Radius again, and then you can select any of the existing users in Hotcakes, click on its 'view' action (The magnifying glass), and select the 'Testing' tab.

Here you can select to test plain authentication, or authentication and accounting.

Depending on the user's profile, you will see how each time the accounting gets added, the user's 'cap' gets depleted in the feedback.

4.5. Making things permanent

We need to ensure Free Radius will start-up each time when the machine is rebooted.

sudo cp /usr/local/sbin/rc.radiusd /etc/init.d/radiusd
sudo ln -s /etc/init.d/radiusd /etc/rc2.d/S80radiusd

This brings us to the last section, which will set up ChilliSpot. After that is completed, we will have a working hotspot.