DEV Community

loading...

FreeRADIUS with the rlm_sql_oracle module

Bidhan Khatri
Linux guy
Originally published at bidhankhatri.com.np ・2 min read

We are going to build FreeRADIUS version 3.0.21 with ORACLE Module rlm_sql_oracle.

Download ORACLE Instant Client

Visit ORACLE official site and download oracle instant client. For that, you may need to log in. I'm downloading v12.2

Here is the link for oracle instant client. https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html

mkdir /opt/oracle
cp instantclient-* /opt/oracle/
unzip instantclient-basic-linux.x64-12.2.0.4.0.zip
unzip instantclient-sdk-linux.x64-12.2.0.4.0.zip
Enter fullscreen mode Exit fullscreen mode

Add below lines to file .bash_profile
vim ~/.bash_profile

export ORACLE_HOME=/usr/lib/oracle/12.2/client64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/oracle/instantclient_12_2
Enter fullscreen mode Exit fullscreen mode
source ~/.bash_profile
Enter fullscreen mode Exit fullscreen mode

Now verify the environment.

env | grep -i oracle

LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2:/usr/local/lib:/usr/local/lib64
ORACLE_HOME=/usr/lib/oracle/12.2/client64
Enter fullscreen mode Exit fullscreen mode

Create a symlink for client shared library libclntsh.so. As, while compiling FreeRADIUS look for that oracle library.

cd /opt/oracl/instantclient_12_2

ln -s libclntsh.so.12.1 libclntsh.so
Enter fullscreen mode Exit fullscreen mode

Download FreeRADIUS

Install dependency first.

yum install libtalloc-devel
Enter fullscreen mode Exit fullscreen mode
wget ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-3.0.21.tar.gz

tar xvf freeradius-server-3.0.21.tar.gz
cd freeradius-server-3.0.21
Enter fullscreen mode Exit fullscreen mode

Compile FreeRADIUS with the below parameters.

./configure --with-oracle-home-dir=/opt/oracle/instantclient_12_2 --with-oracle-lib-dir=/opt/oracle/instantclient_12_2 --with-oracle-include-dir=/opt/oracle/instantclient_12_2/sdk/include
Enter fullscreen mode Exit fullscreen mode
make
make install
Enter fullscreen mode Exit fullscreen mode

Now configure Radius with oracle module.

vim /usr/local/etc/raddb/mods-available/sql
Enter fullscreen mode Exit fullscreen mode
dialect = "oracle"
driver = "rlm_sql_oracle"

## your db credential here.
login = "wifiradius_admin"      
password = "xxxxxxxx"


radius_db = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=XXX.XXX.XXX.XXX)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=dbname)))"
Enter fullscreen mode Exit fullscreen mode
cd /usr/local/etc/raddb/mods-enabled
ln -s ../mods-available/sql sql
Enter fullscreen mode Exit fullscreen mode

Launch FreeRADIUS in debug mode and if everything looks ok then start the service.

radiusd X
Enter fullscreen mode Exit fullscreen mode

Here, you can see radius module being loaded.

rlm_sql (sql): Driver rlm_sql_oracle (module rlm_sql_oracle) loaded and linked.

systemctl start radiusd
Enter fullscreen mode Exit fullscreen mode

Now your FreeRADIUS service should be running with ORACLE module.

Discussion (0)