Manually building FreeRADIUS 3.0.21 with the rlm_sql_oracle module

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

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. LINK.

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

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
source ~/.bash_profile

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

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

Download FreeRADIUS

Install dependency first.

yum install libtalloc-devel
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

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

During configuration, you will see logs like the below if the instant client path is set properly. Now module rlm_sql_oracle will be compiled.

=== configuring in ./drivers/rlm_sql_oracle (/root/freeradius-server-3.0.21/src/modules/rlm_sql/./drivers/rlm_sql_oracle)
configure: running /bin/sh ./configure --disable-option-checking '--prefix=/usr/local' '--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' --cache-file=/dev/null --srcdir=.
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for oci.h in /opt/oracle/instantclient_12_2/sdk/include/... yes
checking for OCIInitialize in nnz19 in /opt/oracle/instantclient_12_2... no
checking for OCIInitialize in nnz18 in /opt/oracle/instantclient_12_2... no
checking for OCIInitialize in nnz12 in /opt/oracle/instantclient_12_2... yes
configure: creating ./config.status
make
make install

Now configure Radius with oracle module.

vim /usr/local/etc/raddb/mods-available/sql
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)))"
cd /usr/local/etc/raddb/mods-enabled
ln -s ../mods-available/sql sql

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

radiusd X

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

Now your FreeRADIUS service should be running with ORACLE module.

Comments