Sitemap

Freeradius Authentication

4 min readApr 16, 2022

--

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.
Press enter or click to view image in full size
Press enter or click to view image in full size
Network Topology

Plan

  1. Configuration of the radius server
    — “clients.conf” file
    — “users” file
  2. Authentication Test
  3. 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

Press enter or click to view image in full size

To verify if it’s installed

# freeradius -v

Press enter or click to view image in full size

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”

Press enter or click to view image in full size

We can see that both files are located in /etc/freeradius/3.0/

Press enter or click to view image in full size

# 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

Press enter or click to view image in full size

Btw, we can execute this command to test if config is OK

# sudo /usr/sbin/freeradius -Cx -lstdout

Press enter or click to view image in full size

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.

Press enter or click to view image in full size

The same goes for the user “Bob”

Press enter or click to view image in full size

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)

Press enter or click to view image in full size

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

--

--