FreeRADIUS Installation and Basic Configuration on CentOS 7

FreeRADIUS is a modular, high performance and highly customizable open source RADIUS server. Anyone can use FreeRADIUS without any charge and can customize his RADIUS server according to his organizational requirements. In my previous article, I discussed how to install and configure user manager RADIUS server developed by MikroTik. The main disadvantage of user manager RADIUS server is ‘it is not customizable and not suitable for medium or large organization’. On the other hand, FreeRADIUS is giving facility to customize your RADIUS server according to your organization requirements. But you have to customize your FreeRADIUS server by yourself. So, in this article I will show how to install and configure FreeRADIUS server on CentOS 7 and in my few next articles I will also show how to connect FreeRADIUS server with MikroTik Router and manage MikroTik PPP and Hotspot user with FreeRADIUS server.

FreeRADIUS Server Installation on CentOS 7

We will now install freeRADIUS on CentOS 7 Linux Server. We will install freeRADIUS from YUM repository. So, before going to start freeRADIUS installation, you should have CentOS 7 ready so that it can access CentOS Yum repository. In my previous article, I discussed how to install CentOS 7 and how to configure CentOS 7 network from very beginning. If you are new in CentOS Linux distribution, feel free to visit those articles and make ready your CentOS 7 to install freeRADIUS server. The next section is assumed that your CentOS 7 server is ready to install freeRADIUS suit from YUM repository.

Before going to start freeRADIUS installation, we will first check the available freeRADIUS packages in CentOS YUM repository. For this, issue the following command from your CentOS 7 command prompt with root user privilege.

[root@freeradius ~]#  yum search freeradius

Loaded plugins: fastestmirror, langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast

Loading mirror speeds from cached hostfile

* base: mirror.dhakacom.com

* epel: mirror.xeonbd.com

* extras: mirror.dhakacom.com

* updates: mirror.dhakacom.com

====================== N/S matched: freeradius ===========================

freeradius-devel.i686 : FreeRADIUS development files

freeradius-devel.x86_64 : FreeRADIUS development files

freeradius-doc.x86_64 : FreeRADIUS documentation

freeradius-krb5.x86_64 : Kerberos 5 support for freeradius

freeradius-ldap.x86_64 : LDAP support for freeradius

freeradius-mysql.x86_64 : MySQL support for freeradius

freeradius-perl.x86_64 : Perl support for freeradius

freeradius-postgresql.x86_64 : Postgresql support for freeradius

freeradius-python.x86_64 : Python support for freeradius

freeradius-sqlite.x86_64 : SQLite support for freeradius

freeradius-unixODBC.x86_64 : Unix ODBC support for freeradius

freeradius-utils.x86_64 : FreeRADIUS utilities

freeradius.x86_64 : High-performance and highly configurable free RADIUS server

radcli-compat-devel.x86_64 : Development files for compatibility with radiusclient-ng and freeradius-client

The search command will show you the available packages that can be installed like the above output. Among the listed packages, we will only install freeradius, freeradius-utils, freeradius-mysql and freeradius-perl packages. So, issue the following command from your CentOS command prompt to install these packages.

[root@freeradius ~]# yum install freeradius freeradius-utils freeradius-mysql freeradius-perl –y

Within few moments, your desired freeRADIUS packages will be installed and you will get an installation complete message. To ensure your packages installation, issue the following command that will show installed freeRADIUS packages.

[root@freeradius ~]# rpm -qa | grep freeradius

freeradius-utils-3.0.13-9.el7_5.x86_64

freeradius-perl-3.0.13-9.el7_5.x86_64

freeradius-3.0.13-9.el7_5.x86_64

freeradius-mysql-3.0.13-9.el7_5.x86_64

If you get the above message, your freeRADIUS suit and required packages have been installed successfully. The above message is also informed you that you are using freeRADIUS version 3. Now we will check whether our freeRADIUS server is working or not with the following command.

[root@freeradius ~]# radiusd –X

Listening on auth address * port 1812 bound to server default

Listening on acct address * port 1813 bound to server default

Listening on auth address :: port 1812 bound to server default

Listening on acct address :: port 1813 bound to server default

Listening on auth address 127.0.0.1 port 18120 bound to server inner-tunnel

Listening on proxy address * port 47697

Listening on proxy address :: port 60842

Ready to process requests

If you got the above message, your freeRADIUS server is ready to accept RADIUS client request and provide reply.

Before going to start configuration, we will now check whether our RADIUS server is running or not with the following command where radiusd is freeRADIUS daemon in CentOS Linux Distribution.

[root@freeradius ~]# systemctl status radiusd

If you found that your radius daemon (radiusd) is not running, issue the following command to start radius daemon.

[root@freeradius ~]# systemctl start radiusd

Now you will find that your RADIUS server in running if you issue the status command again. Also issue the following command so that your radius daemon can run at the time of system restart.

[root@freeradius ~]# systemctl enable radiusd

Whenever you update your radius configuration, you have to restart your radius daemon otherwise your configuration will not be applied. To restart or reload your configuration, issue the following command from your CentOS 7 command prompt.

[root@freeradius ~]# systemctl restart radiusd

RADIUS Server listen Authentication request on UDP port 1812 and Accounting request on UDP port 1813. So, you have to allow these ports from your CentOS 7 Firewall. To allow these ports, issue the following command from your CentOS 7 command prompt.

[root@freeradius ~]# firewall-cmd –zone=public –add-port=1812/udp
[root@freeradius ~]# firewall-cmd –zone=public –add-port=1813/udp

To make this configuration permanent, issue the following command.

[root@freeradius ~]# firewall-cmd –zone=public –permanent –add-port=1812/udp
[root@freeradius ~]# firewall-cmd –zone=public –permanent –add-port=1813/udp

Here, it is assumed that your active firewall zone is public. If you use another zone as your active firewall zone, change the zone name accordingly.

If you wish not to add ports manually, you can add radius service that will allow these ports for you. Issue the following commands to allow radius service in your active firewall zone.

[root@freeradius ~]# firewall-cmd –zone=public –add-service=radius
[root@freeradius ~]# firewall-cmd –zone=public –permanent –add-service=radius

Among these two firewall methods, choose one firewall method which is suitable for you .

FreeRADIUS Server Basic Configuration

After successful freeRADIUS installation, we will now do a basic configuration where localhost will be defined as a NAS device (RADIUS client) and bob will be defined a test user. After we have defined the client and the test user, we will use the radtest program to fill the role of a RADIUS client and test the authentication of bob.

FreeRADIUS is set up by modifying configuration files. The default location of freeRADIUS configuration file in CentOS 7 is /etc/raddb. So, go to this directory and issue ls command to view available configuration files and directories.

[root@freeradius raddb]# cd /etc/raddb
[root@freeradius raddb]# ls

fireeRADIUS Configuration Files and Directories

For the basic configuration, the important files are client.conf where RADIUS clients are defined and users where RADIUS users are defined. The following instructions will show how to define radius client and user in client and user configuration file.

  • Ensure that your working directory is /etc/radddb.
  • FreeRADIUS includes a default client called localhost. This client can be used by
    RADIUS client programs on the localhost to help with troubleshooting and testing.
    Open client.conf file with vim editor (vim client.conf) and confirm that the following entry exists in the clients.conf

     

    client localhost {
    ipaddr = 127.0.0.1
    secret = testing123
    require_message_authenticator = no
    nas_type = other
    }
  • Define bob as a FreeRADIUS test user. Open users file with vim editor (vim users) and add the following lines at the top of the users file. Make sure that the second and third lines are indented by a single tab character.
    “bob” Cleartext-Password := “password”
         Framed-IP-Address = 192.168.10.10,
         Reply-Message = “Hello, %{User-Name}”
  • Reload the freeRADIUS server with the restart command.
    [root@freeradius ~]# systemctl restart radiusd
  • Authenticate bob user using the following radtest command where bob is a test user and password is the password of bob user defined in users file. 127.0.0.1 (localhost) is IP address of NAS device, 100 is NAS port and testing123 is the NAS password defined in client.conf file.

    [root@freeradius raddb]# radtest bob password 127.0.0.1 100 testing123

    Sent Access-Request Id 118 from 0.0.0.0:52494 to 127.0.0.1:1812 length 75

         User-Name = “bob”

         User-Password = “password”

         NAS-IP-Address = 192.168.40.10

         NAS-Port = 100

         Message-Authenticator = 0x00

         Cleartext-Password = “password”

    Received Access-Accept Id 118 from 127.0.0.1:1812 to 0.0.0.0:0 length 40

         Framed-IP-Address = 192.168.10.10

         Reply-Message = “Hello, bob”

Radtest will show the response of the FreeRADIUS server like the above output. That means, your freeRADIUS server is completely ready to accept RADIUS clients and users request. In my next article, I will show how to add MikroTik Router as a RADIUS client of your freeRADIUS server and how to authenticate MikroTik login user with RADIUS users.

If you face any confusion to follow above steps properly, follow the video about freeRADIUS installation and configuration on CentOS 7. I hope it will reduce your confusion.

How to install and configure freeRADIUS server on CentOS 7 has been discussed in this article. I hope you are now be able to install and configure freeRADIUS server without any confusion following the above steps properly. However, if you face any confusion, feel free to discuss in comment or contact with me from Contact page. I will try my best to stay with you.

Why not a Cup of COFFEE if the solution?

freeradius-installation-and-basic-configuration-on-centos-7

ABU SAYEED

I am a system administrator and like to share knowledge that I am learning from my daily experience. I usually work on MikroTik, Redhat/CentOS Linux, Windows Server, physical server and storage, virtual technology and other system related topics. Follow Me: Facebook, Twitter and Linkedin.

Your name can also be listed here. Have an IT topic? Submit it here to become a System Zone author.

4 comments

Leave a Reply

Your email address will not be published. Required fields are marked *

*