Saturday, 15 August 2015

Install FreeRADIUS v3 on Centos 7

Install FreeRADIUS v3 on Centos 7

Edit

Install packages

yum install mariadb-server mariadb freeradius freeradius-mysql freeradius-utils -y
sudo chkconfig --levels 235 radiusd  on
sudo chkconfig --levels 235 mariadb on
Edit

Populate MySql db

mysql -uroot -p

CREATE DATABASE radius;

GRANT ALL PRIVILEGES ON radius.* TO radius@localhost IDENTIFIED BY "YOUR PASS";

SOURCE /etc/raddb/mods-config/sql/main/mysql/schema.sql
Edit

Configure RADIUS

ln -s /etc/raddb/mods-available/sql /etc/raddb/mods-enabled

Edit

Edit radiusd.conf

modules {
$INCLUDE mods-enabled/
}
policy {
$INCLUDE sites-enabled/
}
Edit

Enable SQL configuration in the default enabled site /etc/freeradius/sites-available/default:
authorize {

sql

}
accounting {

sql

}
session {

sql

}
post-auth {

sql

}
Post-Auth-Type REJECT {
sql
}

Edit

Configure SQL module /raddb/mods-available/sql and change the database connection parameters to suite your environment:

sql {
driver = “rlm_sql_mysql”
server = “192.168.1.1”
port = 3306
login = “radius”
password = “radiuspwd”
  1. Database table configuration for everything except Oracle
    radius_db = “radius”
    }
  1. Set to ‘yes’ to read radius clients from the database (‘nas’ table)
  2. Clients will ONLY be read on server startup.
    read_clients = yes
  1. Table to keep radius client info
    client_table = “nas”
Edit

Test to see if Free Radius works by issuing the following command:

This will start FreeRadius in debug mode ( To stop it -> Ctrl+c).
radiusd -X
Edit

Install daloradius

Edit

Download daloradius and updated sql

yum install php-mysql php php-pear php-gd php-pear-DB -y
cd /tmp
wget http://sourceforge.net/projects/daloradius/files/latest/download?source=files
tar zxvf download?source=files
mysql -uradius -p radius < daloradius-0.9-9/contrib/db/fr2-mysql-daloradius-and-freeradius.sql
Edit

Config daloradius sql connection

nano daloradius-0.9-9/library/daloradius.conf.php

# $configValues['DALORADIUS_VERSION'] = '0.9-9';
# $configValues['FREERADIUS_VERSION'] = '3';
# $configValues['CONFIG_DB_ENGINE'] = 'mysql';
# $configValues['CONFIG_DB_HOST'] = 'localhost';
# $configValues['CONFIG_DB_USER'] = 'radius';
# $configValues['CONFIG_DB_PASS'] = 'radius@123';
# $configValues['CONFIG_DB_NAME'] = 'radius';
Edit

Config apache

nano /etc/httpd/conf/httpd.conf
Edit the /etc/httpd/conf/httpd.conf file and append this to the end of the file (customize to your likings):
Alias /myradius "/var/www/daloradius/"
<Directory /var/www/daloradius/>
Options None
order deny,allow
deny from all
allow from 127.0.0.1
allow from <my management system's ip which has a web-browser>
</Directory>

10 comments:

  1. Thanks for sharing. Quick question. I was able to install everything, but in the end I am getting error 500. Any ideas?

    ReplyDelete
    Replies
    1. Probably you must move all data from /tmp/daloradius-0.9.9 for /var/www/html/daloradius and don't forget disabling SELINUX.

      Delete
    2. Make sure Peral-DB is installed correctly.

      Delete
  2. I am trying this now. I will update the result. I hope for a positive project.

    ReplyDelete
  3. i have this problem in the radiusd -x The server is not configured to listen on any ports. Cannot start

    ReplyDelete
    Replies
    1. the problem solved only with this difference
      modules {
      $INCLUDE mods-enabled/
      }
      for
      modules {

      }
      $INCLUDE mods-enabled/

      Delete
  4. It seems there is another setting in the sql file which is that dialect needs to be set to mysql. It is sqllite by default.

    ReplyDelete
  5. There is no php-pear-DB in CentOS 7 default repos.

    ReplyDelete
  6. You can fix this.
    yum install epel-release
    yum install php-pear-DB
    https://fedoraproject.org/wiki/EPEL
    NOTE for CentOS users
    You can install EPEL by running yum install epel-release. The package is included in the CentOS Extras repository, enabled by default.

    ReplyDelete
  7. https://poltakjefferson.wordpress.com/2014/01/07/install-freeradius-with-web-based-management-daloradius-on-centosrhel-debian-ubuntu/

    ReplyDelete