LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 09-17-2018, 05:52 PM   #1
satish.kumar.yarru
LQ Newbie
 
Registered: Sep 2018
Posts: 3

Rep: Reputation: Disabled
PAM module authentication fails


Hi,

I am working on redhat 7.3 linux server box and trying to configure PAM to use my service module (libradpam.so) for authencation during ssh connection.

I did configuration in /etc/pam.d/password-auth file as follows:

auth required pam_env.so
auth sufficient pam_unix.so nullok try_first_pass
auth requisite pam_succeed_if.so uid >= 500 quiet_success
auth sufficient libradpam.so
auth required pam_deny.so


But when I see the logs in libradpam.so, it appears like pam service APIs are not getting called when I try to do ssh with external user id and password.

I have kept the libradpam.so in /usr/lib64/security path of linux file system.

Is there anything wrong with my PAM configuration?


From the /var/log/secure i see the following logs from sshd

======
Sep 17 18:29:07 masaml101 sshd[39642]: Invalid user yarrusa from xxx.xxx.xxx.xxx
Sep 17 18:29:07 masaml101 sshd[39642]: input_userauth_request: invalid user yarrusa [preauth]
Sep 17 18:29:07 masaml101 sshd[39642]: Postponed keyboard-interactive for invalid user yarrusa from xxx.xxx.xxx.xxx port 64579 ssh2 [preauth]
Sep 17 18:29:25 masaml101 sshd[39649]: pam_unix(sshd:auth): check pass; user unknown
Sep 17 18:29:25 masaml101 sshd[39649]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=xxx.xxx.xxx.xxx
Sep 17 18:29:27 masaml101 sshd[39642]: error: PAM: User not known to the underlying authentication module for illegal user yarrusa from xxx.xxx.xxx.xxx
Sep 17 18:29:27 masaml101 sshd[39642]: Failed keyboard-interactive/pam for invalid user yarrusa from 139.49.219.93 port 64579 ssh2
Sep 17 18:29:27 masaml101 sshd[39642]: Postponed keyboard-interactive for invalid user yarrusa from xxx.xxx.xxx.xxx port 64579 ssh2 [preauth]
Sep 17 18:29:47 masaml101 sshd[39642]: error: Received disconnect from xxx.xxx.xxx.xxx: 13: Unable to authenticate [preauth]
==========
 
Old 09-18-2018, 05:16 PM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
My thinking: pam_succeed_if fails because there is no uid, issuing the message User not known to the underlying authentication module. The requisite keyword then fails the whole stack and stops processing.

Last edited by berndbausch; 09-18-2018 at 05:22 PM. Reason: addition
 
Old 09-18-2018, 08:27 PM   #3
satish.kumar.yarru
LQ Newbie
 
Registered: Sep 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
My thinking: pam_succeed_if fails because there is no uid, issuing the message User not known to the underlying authentication module. The requisite keyword then fails the whole stack and stops processing.
I have commented the line in password-auth file

#auth requisite pam_succeed_if.so uid >= 500 quiet_success

but still same error comes. I still don't see any calls to pam_sm_authenticate() in libradpam.so
 
Old 09-18-2018, 11:17 PM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Even without the pam_succeed_if, you get user not found?

Well, I have never written a PAM module and won’t be able to help, but there may well be bugs in your code that prevent it from correctly executing the authentication function.

Last edited by berndbausch; 09-18-2018 at 11:21 PM.
 
Old 09-19-2018, 03:28 AM   #5
satish.kumar.yarru
LQ Newbie
 
Registered: Sep 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
Even without the pam_succeed_if, you get user not found?

Well, I have never written a PAM module and won’t be able to help, but there may well be bugs in your code that prevent it from correctly executing the authentication function.
Yes I get the same error. The same PAM module works in RHEL 6.x servers. It is failing only for 7.x machines. I suspect something wrong with PAM configurations only.
Is there any difference in PAM configurations when compared to redhat 6 and 7?
 
  


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
ftp : loacl and LDAP users authentication / PAM module pankajd Linux - Software 2 01-02-2014 10:39 PM
[SOLVED] Failed to Implement Password Complexity using PAM ( Pluggable Authentication Module ) Rahil Parikh Linux - Security 4 11-30-2010 06:17 PM
openldap pam : User not known to the underlying authentication module piaf666 Linux - General 5 10-22-2008 02:11 AM
Writting PAM Module for custom authentication? existo Linux - Networking 0 05-05-2004 05:07 PM

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

All times are GMT -5. The time now is 04:47 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