daloRADIUS on Ubuntu 20.04 for Captive Portal

DaloRADIUS is an open source RADIUS client and server implementation for Unix-like systems, and it can be used as a frontend or backend to authenticate remote users against FreeRADIUS. Today I am going to be installing daloRADIUS on Ubuntu 20.04.

My end goal is to use this as a radius based captive portal for Mikrotik, Ubiquiti, and pfSense devices. In this article, I will cover:

How to install DaloRadius on Ubuntu 20.04

Credit:This is a guide I created for myself and anyone who finds it useful. I am not claiming to be an expert or anything like that. If you find any errors, please let me know so I can fix it 🙂 .

I will be using a server with the following specifications for this tutorial:

Operating System : Ubuntu 20.04 minimal install, fully updated as of 25 May 2021, running on Vmware 4 cores, 8 GB ram, and a 500 GB SSD, I picked these specs as a starting point; they were overkill.

What is daloRadius?

DaloRadius is a RADIUS client program written in PHP and Javascript aimed at managing hotspots and ISP deployments. It has a very modular design and each module is separated into its own directory, which makes it a very easy to deploy.

A screenshot of DaloRadius.

DaloRadius benefits:

It’s open source and free!

Graphical interface makes it easy to use and manage

Small footprint for install, and install process.

Pretty and powerful GIS (geographical information system) client

It can function as both a backend and frontend for authentication. It can list users, authenticate and search, update policies, and even edit or delete policies! Plus all of those features are available via a GUI rather than having to do it through the command line.

Let’s start by updating packages

sudo apt update
sudo apt -y upgrade
sudo reboot
 

Now let’s get started installing daloRADIUS by installing Apache web server

sudo apt -y install apache2
sudo apt -y install php libapache2-mod-php php-{gd,common,mail,mail-mime,mysql,pear,db,mbstring,xml,curl}

Check the version of php installed:


cody@dalo2:~$ php -v
PHP 7.4.3 (cli) (built: Oct  6 2020 15:47:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

Now we will install MariaDB and create the database.

sudo apt install -y mariadb-server
sudo mysql_secure_installation
sudo mysql -u root -p 
CREATE DATABASE radius; 
GRANT ALL ON radius.* TO radius@localhost IDENTIFIED BY "YOUR_PASSWORD"; 
FLUSH PRIVILEGES; 
QUIT;

Now it is time to install Freeradius; keeping its namesake it is a free version of radius and is very easy to set up!

sudo apt -y install freeradius freeradius-mysql freeradius-utils
sudo su
mysql -u root -p radius < /etc/freeradius/3.0/mods-config/sql/main/mysql/schema.sql

Now we want to check the schema, you should see something resembling below.

root@dalo2:/home/cody# mysql -u root -p -e "USE radius ; SHOW TABLES;"
Enter password:
+------------------+
| Tables_in_radius |
+------------------+
| nas              |
| radacct          |
| radcheck         |
| radgroupcheck    |
| radgroupreply    |
| radpostauth      |
| radreply         |
| radusergroup     |
+------------------+

Now lets get out of the root account

exit

Now lets setup the SQL module. We will first create a softlink and then edit the settings

 sudo ln -s /etc/freeradius/3.0/mods-available/sql /etc/freeradius/3.0/mods-enabled/
sudo nano /etc/freeradius/3.0/mods-enabled/sql

Set your connection info, mysql, port, username, and password and then save.

Then add freeradius to the group for that file

sudo chgrp -h freerad /etc/freeradius/3.0/mods-enabled/sql
sudo chown -R freerad:freerad /etc/freeradius/3.0/mods-enabled/sql
sudo systemctl restart freeradius.service

Now we will install daloRADIUS from the Git repository.

wget https://github.com/lirantal/daloradius/archive/master.zip
unzip master.zip
mv daloradius-master /var/www/html/daloradius
cd /var/www/html/daloradius
 mysql -u root -p radiusdb < contrib/db/fr2-mysql-daloradius-and-freeradius.sql
 mysql -u root -p radiusdb < contrib/db/mysql-daloradius.sql

Permissions will need to be given to the dalo directory as follows

chown -R www-data:www-data /var/www/html/daloradius/
chmod 664 /var/www/html/daloradius/library/daloradius.conf.php

Now open the .conf file and make the changes necessary for your installation.

nano /var/www/html/daloradius/library/daloradius.conf.php

Restart free radius and apache 2 now

systemctl restart freeradius
systemctl restart apache2

Now you are free to go to http://{your_host}/daloradius/login.php to setup the installation!

I will attach some screenshots from the GUI Below. Going through them you will see how this GUI for freeradius can help get the ball moving on any project requiring RADIUS. Rich reporting, accounting, and graphs could help any ISP or MSP truly own their networks.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: