Configure Radius Authentication for SSH login Centos 5.* Linux
Contents
Introduction
Using the plug-in modular nature of PAM we can get a linux server to use RADIUS to authenticate users connecting via SSH. This guide tells you how to setup a Centos 5.2 server as your Radius "client" and Juniper Steel-Belted as your radius server authentication "server". We are going to use the pam_radius_module from free radius to provide the mechanism of authenticating ssh logins against a radius box. For this example my environment consists of A centos 5.2 radius client called "cyclone" A Steel-Belted Radius server is called "turbo" A username of dave Of course you will change these silly names to the hostnames or ip addresses that suit your own setup.Preparation
We have to to build a radius client module for our centos linux server so some preperation is required on this box to enable us to do that. It isn't as complex as it sounds.Install the correct development tools
Since the pam_radius_auth security module is not available in mighty yum repository we have to make this ourselves using the source files. To do this we need the correct C compiler this can be installed via yum using the following commandyum install gcc-c++
After a little while the C compiler will be installed an ready for use. The next requirement is the pam development module. This is also installed via yum with this command:
yum install pam-devel
Download the pam Radius source files.
You need to download the radius pam module here ftp://ftp.freeradius.org/pub/radius/ Choose the file pam_radius-1.3.17.tar.gz This is done easily via the wget command. So from the centos machine runwget ftp://ftp.freeradius.org/pub/radius/pam_radius-1.3.17.tar.gz
download this to a temporary folder where you can build the software from
I chose a directory called pam under my root users home directory
/root/pam
gunzip /root/pam/pam_radius-1.3.17.tar.gz <return>
untar the file using the command
tar -xvf /root/pam/pam_radius-1.3.17.tar <return><code> this should then upack the contents into a directory structure like this <code>/root/pam/pam_radius-1.3.17
make <return>
cc -Wall -fPIC -c pam_radius_auth.c -o pam_radius_auth.o pam_radius_auth.c: In function âtalk_radiusâ: pam_radius_auth.c:886: warning: pointer targets in passing argument 6 of ârecvfromâ differ in signedness pam_radius_auth.c: In function âpam_sm_authenticateâ: pam_radius_auth.c:1102: warning: assignment from incompatible pointer type cc -Wall -fPIC -c -o md5.o md5.c ld -Bshareable pam_radius_auth.o md5.o -lpam -o pam_radius_auth.so
Configure the Centos Server to use radius Authentication
Create a user you wish to login as, on the centos system. I am creating one called "dave" for this example.
<span style="color:red">useradd -d /home/dave/ dave </span>Create the radius client configuration file folder structure.
Create a directory under the /etc folder called raddb. So you have a directory path which looks like /etc/raddb This is done like somkdir /etc/raddb <return> <code> <h3>. Copy the sample client configuration file pam_radius_auth.conf to /etc/raddb/server</h3> This sample file is found in the unarchived folder you downloaded earlier - in my example so I would run: <code> cp /root/pam/pam_radius-1.3.17/pam_radius_auth.conf /etc/raddb/server <return>
Edit the /etc/raddb/server to match the radius server "turbo".
open the /etc/raddb/server in an editor such as vi Under the section that looks like:# server[:port] shared_secret timeout (s) 127.0.0.1 secret 1 other-server other-secret 3
# server[:port] shared_secret timeout (s) 127.0.0.1 secret 1 turbo s3cret 3
auth include system-authauth required pam_radius_auth.so
auth sufficient pam_radius_auth.so
auth include system-authConfigure your Steel Belted Radius Server
Add a username on the radius box "turbo"
Right Click "users" Click Add
Add a native user and set a password.
Sudo ?
Sudo ?
Thanks Greg thats useful info
pam_radius package in Fedora
cool!!
I'm about to try and
great article
Thanks much!
Thank you
Thanks
GREAT THANKS!