Would you like to learn how to configure PostgreSQL Radius authentication using Freeradius? In this tutorial, we are going to show you how to authenticate PostgreSQL users using the Radius protocol and the Freeradius service on a computer running Ubuntu Linux.

• Ubuntu 19.10
• PostgreSQL 12.1

PostgreSQL Related Tutorial:

On this page, we offer quick access to a list of tutorials related to PostgreSQL.

Tutorial - FreeRadius Server Installation on Ubuntu Linux

• IP - 192.168.15.10.
• Operacional System - Ubuntu 19
• Hostname - UBUNTU

On the Linux console, use the following commands to install the FreeRadius service.

Copy to Clipboard

Now, we need to add FreeRadius clients to the clients.conf;.

Locate and edit the clients.conf.

Copy to Clipboard

Add the following lines at the end of the clients.conf file.

Copy to Clipboard

In our example, we are adding 1 client device:

The device was named POSTGRESQL and has the IP address 192.168.15.11.

Now, we need to add FreeRadius users to the USERS configuration file.

Locate and edit the Freeradius users configuration file.

Copy to Clipboard

Add the following lines at the end of the file

Copy to Clipboard

Restart the Freeradius server.

Copy to Clipboard

Test your radius server configuration file.

Copy to Clipboard

You have finished the Freeradius installation on Ubuntu Linux.

Tutorial PostgreSQL - Radius Authentication using Freeradius

• IP - 192.168.15.11
• Operacional System - Ubuntu 19
• Hostname - POSTGRESQL

On the Linux console, use the following commands to check your Ubuntu codename.

Copy to Clipboard

In our example, Ubuntu 19.10 codename is eoan.

Take note of this information.

On the Linux console, use the following commands to add the PostgreSQL APT repository

Copy to Clipboard

Install the PostgreSQL service.

Copy to Clipboard

Use the following commands to create a new account named admin.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Locate and edit the pg_hba.conf configuration file.

Copy to Clipboard

Add the following line at the beginning of this file.

Copy to Clipboard

Here is our pg_hba.conf file content:

Copy to Clipboard

We performed the following configuration:

• Radius Server IP - 34.221.44.138
• Radius Secret - kamisama123
• Radius Port - 1812

You need to change the IP address to your Freeradius server IP.

You need to change the Raidius secres to your radius password.

Restart the PostgreSQL service.

Copy to Clipboard

Connect to the PostgreSQL server using the admin account and the password set on the Active directory.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Congratulations! You have configured the PostgreSQL authentication to use a Radius database.