Tuesday, September 1, 2015

Ubuntu 14.04 Lts/ Freeradius / Postgresql Step-By-Step

Step past times footstep instructions for installing
FreeRadius alongside Postgresql on
Ubuntu 14.04 LTS

Why 14.04, good it is the electrical flow LTS release, together with for production environments, I tend to stick to the latest LTS.

I am non going to endure going into exceptional into how to install Ubuntu 14.04 Server, at that spot are plenty tutorials on that elsewhere. I ask yous to larn to the indicate where yous conduct keep a build clean server, alongside SSH access, together with a beginning prompt.

Installing software

First, allow us update the apt-get info:
apt-get update

Now nosotros ask to install the basic components, these include:
Freeradius, Postgresql together with it's utilities every bit good every bit the postgresql module for freeradius:
apt-get install freeradius freeradius-postgresql postgresql postgresql-contrib

This volition install all the necessary components, it is normal for the DH Parameter generation to conduct keep a duo of minutes.

Configure Postgres

The Postgres installation automatically creates a user called postgres, inwards club to configure Postgres, yous ask to log into that account.

sudo -i -u postgres

Now nosotros do the radius user together with database, when creating the user, yous volition endure prompted to do a password, larn inwards overnice together with secure, together with brand a authorities annotation for afterward use:

createuser radius --no-superuser --no-createdb --no-createrole -P
createdb radius --owner=radius exit

Change the database authentication from peer to md5 to allow login from the console:

vim /etc/postgresql/9.3/main/pg_hba.conf

Find the describe of piece of employment that matches:
local    all    postgres    peer

together with modify it to:
local    all    postgres    md5

likewise find:
local    all          peer

together with modify it to:
local    all          md5

Reload postgresql
service postgresql restart

Import the database schema using the dominance below:
cd /etc/freeradius/sql/postgresql
psql -U radius radius < schema.sql

Configure FreeRadius to utilisation Postgres

Change the sql configuration every bit follows:
cd /etc/freeradius
vim sql.conf

modify the next lines to conform your setup:
database = "postgresql"
password = "yourpassword"


You volition likewise ask to modify the login raise to leave of absence out the realm when logging in:

Change the sql configuration every bit follows:
vim radiusd.conf

modify the next line:
sql_user_name = "%{User-Name}"
To:
sql_user_name = "%{Stripped-User-Name}"
Also uncomment the describe of piece of employment that reads:
$INCLUDE sql.conf

Now uncomment the describe of piece of employment that reads "sql" nether the authorize{} section, on my default config it is describe of piece of employment 177,
likewise uncomment the "sql" describe of piece of employment nether the accounting{} section,
likewise uncomment the "sql" describe of piece of employment nether the post-auth{} section
cd /etc/freeradius/sites-available vim default

Also uncomment the describe of piece of employment that reads "sql" nether the authorize{} department of /etc/freeradius/sites-available/inner-tunnel, on my default config it is describe of piece of employment 131
vim inner-tunnel


Restart the FreeRadius server to charge the novel config, together with yous should endure practiced to go.
service freeradius restart