I recently needed to find a RADIUS server for use in a project where I could stick profile data into Oracle. I remembered seeing FreeRADIUS a while back so I checked to see if it was active and supported Oracle. Sure enough it did. It was a little tricky to set up because some of the documentation is out of sync with the latest version so here is what you need to know to get it working.
I'm using FreeRADIUS version 2.0.3 so some of these issues may be fixed down the road. The first thing you should do is compile FreeRADIUS and get it working using the normal users file. After you have done that and successfully tested queries to the server you can recompile to build Oracle in.
I used the Oracle Instant client again. I've used the Oracle instant client a number of times now and I can't believe it took them so long to release their SDK in this type of paired down package.
This should be all you need to add to the configure command to enable the Oracle driver:
However that didn't work for me. Instead I had to go into the RLM Oracle driver directory and run the configure command from there:
ORACLE_HOME=<path to oracle instant client> CFLAGS=-I<path to oracle instant client>/sdk/include/ LDFLAGS=-L<path to oracle instant client> ./configure
This created the Makefile but then that still wasn't correct. I had to modify the includes and libraries so they matched the correct location:
RLM_SQL_LIBS = -L<path to oracle instant client> -lclntsh -lm
After making these changes I could then do a make and make install. You can verify that the module is installed by looking for the module file named rlm_sql_oracle.a in your lib directory (in my case /usr/local/lib/). After you have verified that the module is compiled and in place you are ready to move on to the configuration.
The first thing to do is load the provided Oracle schema. That schema can be found in: freeradius-server-2.0.3/raddb/sql/oracle
Next read over the RLM SQL configuration information to get a general idea of what is going on in the configuration files and how FreeRADIUS uses the queries to find the correct information for a given request.
The following steps are needed to configure the Oracle access and have FreeRADIUS use that configuration for data (I assume that you have installed with a base of /usr/local):
- Edit /usr/local/etc/raddb/sql.conf set database = "oracle", set the server, login, password, and radius_db values. The following is an example of the connection information needed:
# Connection info:
server = "127.0.0.1"
login = "username"
password = "password"
# Database table configuration for everything except Oracle
#radius_db = "radius"
# If you are using Oracle then use this instead
radius_db = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=MYDB01)))"
- Search for the following and uncomment the SQL load line in the file /usr/local/etc/raddb/sites-enabled/default as follows:
# See "Authorization Queries" in sql.conf
Note: This is something that I didn't find in the documentation. I believe that is due to the documentation being for an older version and this being a new requirement.
- Load sample data into the database:
INSERT INTO radusergroup VALUES(radusergroup_seq.NEXTVAL, 'dynamic', 'fredf');
INSERT INTO radcheck VALUES(radcheck_seq.NEXTVAL, 'fredf', 'Cleartext-Password', ':=', 'wilma');
INSERT INTO radreply VALUES(radreply_seq.NEXTVAL, 'fredf', 'Framed-IP-Address', ':=', '184.108.40.206');
INSERT INTO radgroupreply VALUES(radgroupreply_seq.NEXTVAL, 'dynamic', 'Framed-Compression', ':=', 'Van-Jacobsen-TCP-IP');
- Start the daemon in debug mode:
If you don't have the oracle libraries in your path you will need to start radius with the correct LD path entry like this:LD_LIBRARY_PATH=<path to oracle instant client> radiusd -X
- Send a test query:
radtest fredf wilma localhost 0 radpassword
On the console for radius -X you will see debug and you should receive a valid response from the test that looks like this:User-Name = "fredf"
User-Password = "wilma"
NAS-IP-Address = 127.0.0.1
NAS-Port = 0
Framed-IP-Address = 220.127.116.11
At this point you are ready to load your data into FreeRADIUS via Oracle.
Depending on how large your configuration values are the provided schema may not give you enough room to store everything. You may need to alter the tables to increase the space available for values like this: