LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-02-2011, 04:44 AM   #1
chesschi
Member
 
Registered: May 2011
Posts: 41

Rep: Reputation: 0
Integrating PAM into SSH


Hello!

I try to authenticate ssh users locally via PAM using FreeRadius. So the configuration files for radius server and radius client are stored at the same machine.

On my CentOS v5.50, I have the following setup:

In /usr/local/etc/raddb/radiusd.conf:
Code:
modules { 
  ... 
  pam { 
    pam_auth = radiusd 
  } 
}
In /usr/local/etc/raddb/users:
Code:
sshuser Cleartext-Password := "hello", Auth-Type := Pam, NAS-IP-Address == 127.0.0.1 
  Service-Type = Framed-User, 
  Framed-Protocol = PPP, 
  Framed-IP-Address = 127.0.0.1, 
  Framed-IP-Netmask = 255.255.255.0, 
  Framed-Routing = Broadcast-Listen, 
  Framed-Filter-Id = "std.ppp", 
  Framed-MTU = 1500, 
  Framed-Compression = Van-Jacobsen-TCP-IP
In /usr/local/etc/raddb/clients.conf:
Code:
client localhost { 
  ipaddr = 127.0.0.1 
  secret = testing123 
}
In /usr/local/etc/raddb/pam_radius_auth.conf and servers.conf
Code:
# server[:port] shared_secret      timeout (s)
127.0.0.1       testing123         1
other-server    other-secret       3
In /usr/local/etc/raddb/sites-available/default:
Code:
authenticate { 
  ... 
  pam 
}
In /etc/pam.d/radiusd:
Code:
#%PAM-1.0 
auth            sufficient      /lib/security/pam_radius_auth.so 
auth            required        /lib/security/pam_unix_auth.so shadow md5 nullok 
auth            required        /lib/security/pam_nologin.so 
account         required        /lib/security/pam_unix_acct.so 
password        required        /lib/security/pam_cracklib.so 
password        required        /lib/security/pam_unix_passwd.so shadow md5 nullok use_authok 
session         required        /lib/security/pam_unix_session.so
In /etc/pam.d/sshd:
Code:
#%PAM-1.0 
auth       sufficient   pam_radius_auth.so debug 
auth       include      system-auth 
account    required     pam_nologin.so 
account    include      system-auth 
password   include      system-auth 
session    optional     pam_keyinit.so force revoke 
session    include      system-auth 
session    required     pam_loginuid.so
In /etc/sshd/sshd_config:
Code:
... 
UsePAM yes 
ChallengeResponseAuthentication yes 
PasswordAuthentication yes
In /etc/passwd:
Code:
sshuser::636:636::/home/sshuser:/bin/bash
When I run the radius server, it is ok. i.e.
/usr/local/sbin/radiusd -X

However, when I try to ssh locally, it seems that it acts as normal ssh login (not via PAM). i.e.
ssh sshuser@127.0.0.1

Please could you tell me what steps I am missing?

Thanks!!!

Last edited by chesschi; 08-02-2011 at 05:15 AM.
 
Old 08-02-2011, 01:52 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
PAM support is compiled into sshd(8) by default on CentOS5. If there's any doubt, try:
Code:
$ ldd /usr/sbin/sshd | grep pam
Which leaves us with a (likely) configuration problem. Check /var/log/secure and /var/log/messages for clues.
 
1 members found this post helpful.
Old 08-04-2011, 03:12 AM   #3
chesschi
Member
 
Registered: May 2011
Posts: 41

Original Poster
Rep: Reputation: 0
Thanks anomie.

Quote:
Originally Posted by anomie View Post
Check /var/log/secure and /var/log/messages for clues.
I found from the log that SSH cannot locate /etc/raddb/server file. It is because FreeRadius and SSH are installed into two different directories (i.e. /etc prefix and /usr/local/etc prefix respectively). I reconfigure the module and install them on /etc prefix and it works!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help: Weirdness with ssh/pam when trying to ssh in Nabana Linux - Security 1 04-01-2010 08:17 PM
SSH + PAM + two-factor authentication tdnnash25 Linux - Security 21 06-18-2009 04:47 PM
ssh and pam isuck@linux Linux - Security 2 11-15-2006 11:58 AM
ssh-pam module configuration thobias.reaper Linux - Security 1 07-16-2006 10:24 AM
SSH Problems with PAM stocks29 Linux - Software 0 06-25-2004 08:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration