Freeradius Authentication
Radius (Remote Authentication Dial-In User Service) is an authentication server, which allows us to filter access to a resource in order to keep track of a record of who does what and when.
Radius is a network protocol that controls user network access through authentication and accounting. Commonly used by Internet service providers. It performs three main functions :
- Authenticates users or devices to access a network.
- Authorizes users or devices for specific network services.
- Create accounts for the use of these services.
Plan
- Configuration of the radius server
— “clients.conf” file
— “users” file - Authentication Test
- Client configuration
So, lets start, and as always with
# sudo apt update && sudo apt upgrade
Then, to install Freeradius, we have the line, then we can add the option “mlocate” to make it easier to locate Freeradius’s configuration files.
# sudo apt install freeradius mlocate
To verify if it’s installed
# freeradius -v
1. Configuration of the radius server
We need to edit two files : “clients.conf” and “users”. First we locate ’em using the command mlocate with grep as shown below (in root mode)
# mlocate clients.conf | grep “freeradius”
#mlocate users | grep “freeradius”
We can see that both files are located in /etc/freeradius/3.0/
# nano /etc/freeradius/3.0/clients.conf
The “clients.conf” file contains the parameters of the Radius clients, each entry in this file has the following form
client Client_Name {
ipaddr : A required field, represents the IP address of the client, which can be the Router’s address.
secret : A required field , represents the password used for communication between the client and the Radius server.
shortname : An optional field, represents a short alias that can be used instead of IP address or hostname.
}
So, we will add a new client the way explained above
client RadiusClient{
ipaddr = 192.168.0.25
secret = xjllrk
}
The “users” file, is a configuration file for Freeradius server, it contains a series of configuration directives to decide how to authorize and authenticate each user.
# sudo -i
# nano /etc/freeradius/3.0/users
Lets add two users “Alice” and “Bob”
Alice Cleartext-Password := “alice”
Reply-Message := “Hello, %{User-Name}”Bob Cleartext-Password := “bob”
Reply-Message := “Hello, %{User-Name}”
We can now, restart Freeradius server
# sudo systemctl restart freeradius.service
Btw, we can execute this command to test if config is OK
# sudo /usr/sbin/freeradius -Cx -lstdout
2. Freeradius authentication test
#radtest Alice alice localhost 0 testing123
In this command, we try to connect with “Alice”, one of the users created above.
Get Redouane OTMANI’s stories in your inbox
Join Medium for free to get updates from this writer.
Note that “testing123” is a default device password included in the “clients.conf” file.
The same goes for the user “Bob”
3. Client configuration
On the client side configuration, which means Router’s configuration, we need to access our Router then “Wireless Security”. We choose “WPA2-entreprise” with “AES Encryption” then we insert the IP address of Radius server, the port should be 1812 by default (Radius port number), and the password is “xjllrk” (the random password used above in “clients.conf” file :D) (the attached capture is from packet tracer and it’s just for illustration purposes)
To conclude, Radius allows unique credentials for each user, since there is no unified password shared among a number of people it can prevent the threat of hackers infiltrating our network.
If you enjoy my stories, you can follow me on Twitter









