LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-12-2011, 01:57 AM   #1
craigmyster
LQ Newbie
 
Registered: Feb 2011
Posts: 13

Rep: Reputation: 0
Red face Openldap sudoers help please...


Forum. I am still battling getting ldap running. I am running cenos5 and have openldap 2.3.43. Now I have the the users authorizing from the ldap directory over TLS without any issues. The next step is to have the sudo command consult the directory. I made the appropriate changes but I keep on getting pam_unix(sudo:auth): conversation failed. In pam.d/sudo it consults system.auth which I think is working because I am able to login using pam_ldap.so. I am concerned that sudo for pam is for some reason not able to bind to the ldap server or I have fudged up the ldif files for sudoers. I don't see any access to the sudoers ou in the server logs either. An direction anyone could give me would be awesome. To clarify. The direction is to have admin123 user be able to sudo any command and for the ldap server to look and see weather the admin123 dude is actually authorized to sudo.

Code:
-bash-3.2$ sudo bash
sudo: ldap_sasl_bind_s(): Can't contact LDAP server
[sudo] password for admin123: 
Sorry, try again.
[sudo] password for admin123: 
Sorry, try again.
[sudo] password for admin123: 
sudo: 2 incorrect password attempts
-bash-3.2$
Code:
Client Side Erors:
Mar 12 16:25:51 mail sudo: pam_unix(sudo:auth): conversation failed
Mar 12 16:25:51 mail sudo: pam_unix(sudo:auth): auth could not identify password for [admin123]
Mar 12 16:25:51 mail sudo: admin123 : 2 incorrect password attempts ; TTY=pts/1 ; PWD=/home/admin123 ; USER=root ; COMMAND=/bin/bash
Code:
##LDIF FILE FOR making the OU and defaults and a rule for wheel netgroup members to do sudo
#SUDOers, test.com
dn: ou=SUDOers,dc=test,dc=com
objectClass: top
objectClass: organizationalUnit
description: SUDO Configuration Subtree
ou: SUDOers


# defaults, SUDOers, test.com
dn: cn=defaults,ou=SUDOers,dc=test,dc=com
cn: defaults
sudoOption: ignore_dot
sudoOption: !mail_no_user
sudoOption: !root_sudo
sudoOption: log_host
sudoOption: logfile=/var/log/sudolog
sudoOption: !syslog
sudoOption: timestamp_timeout=10
sudoOption: ignore_local_sudoers
objectClass: top
objectClass: sudoRole
description: Default sudoOptions

dn: cn=%wheel,ou=SUDOers,dc=test,dc=com
objectClass: top
objectClass: sudoRole
cn: %wheel
sudoUser: %wheel
sudoHost: ALL
sudoCommand: ALL
Code:
###LDIF FILE FOR admin123 sudo authorized User###
dn: cn=%admin123,ou=sudoers,dc=test,dc=com
objectClass: top
objectClass: sudoRole
cn: %admin123
sudoHost: ALL
sudoRunAsUser: ALL
sudoCommand: ALL
#sudoOption: !authenticate
sudoUser: %admin123
sudoUser: admin123
Code:
###/etc/nsswitch.conf###
sudoers:    ldap files
Code:
####/etc/pam.d/system-auth####
auth        sufficient    pam_ldap.so use_first_pass
auth        required      pam_env.so
auth        sufficient    pam_unix.so nullok try_first_pass
auth        requisite     pam_succeed_if.so uid >= 500 quiet
auth        required      pam_deny.so

account     required      pam_ldap.so   ignore_unknown_user ignore_authinfo_unavail
account     required      pam_unix.so broken_shadow
account     sufficient    pam_succeed_if.so uid < 500 quiet
account     [default=bad success=ok user_unknown=ignore] pam_ldap.so
account     required      pam_permit.so

password    requisite     pam_cracklib.so try_first_pass retry=3
password    sufficient    pam_unix.so md5 shadow nullok try_first_pass use_authtok
password    sufficient    pam_ldap.so use_authtok
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so
session     optional      pam_ldap.so
Code:
###/etc/ldap.conf###
# The distinguished name of the search base.
base dc=test,dc=com
binddn uid=ldap-auth-user,ou=People,dc=test,dc=com
bindpw PA$$WD
timelimit 120
bind_timelimit 120
idle_timelimit 3600
pam_check_service_attr no
nss_initgroups_ignoreusers root,ldap,named,avahi,haldaemon,dbus,radvd,tomcat,radiusd,news,mailman,nscd,gdm
use_sasl no
sasl_secprops maxssf=0
uri ldaps://ldapserver/
tls_cacert      /etc/openldap/cacerts/ldapscert.pem
pam_password md5
sudoers_base    ou=sudoers,dc=test,dc=com

Last edited by craigmyster; 03-13-2011 at 06:37 PM.
 
Old 03-12-2011, 11:07 AM   #2
timetraveler
Member
 
Registered: Apr 2010
Posts: 243
Blog Entries: 2

Rep: Reputation: 31
Why is dc=jp, maybe I missed something.

# defaults, SUDOers, test.com
dn: cn=defaults,ou=SUDOers,dc=test,dc=jp
 
Old 03-13-2011, 06:38 PM   #3
craigmyster
LQ Newbie
 
Registered: Feb 2011
Posts: 13

Original Poster
Rep: Reputation: 0
It is com now. Any ideas on why this could be happening?
 
Old 03-13-2011, 07:33 PM   #4
Brocifer
Member
 
Registered: Mar 2011
Posts: 46

Rep: Reputation: 1
Quote:
Originally Posted by craigmyster View Post
It is com now. Any ideas on why this could be happening?
Just a thought, have you verified your ldap server string against the name in the TLS cert? You must use FQDN when using TLS.
 
Old 03-14-2011, 04:50 AM   #5
craigmyster
LQ Newbie
 
Registered: Feb 2011
Posts: 13

Original Poster
Rep: Reputation: 0
Yes they are the same. I removed the domain name for posting purposes but the FQDN is is the file. For client authentication over TLS is is fully functional. I am only having issues with the sudo portion. It looks to me like the sudo operation is looking for a differnent ldap server or I messed up the sudo ldif file when I imported it into my directory. I can see the traffic on the server when I execute the sudo command but none of it shows any reads on the sudoers ou. I see read request for admin123 user

Code:
<167>Mar 14 18:46:49 slapd[12422]: conn=282 op=18 SRCH base="dc=test,dc=com" scope=2 deref=0 filter="(&(objectClass=posixAccount)(uid=admin123))"
<167>Mar 14 18:46:49 slapd[12422]: conn=282 op=18 SRCH attr=uid userPassword uidNumber gidNumber cn homeDirectory loginShell gecos description objectClass
<167>Mar 14 18:46:49 slapd[12422]: conn=282 op=18 SEARCH RESULT tag=101 err=0 nentries=1 text=
But on the client
Code:
-bash-3.2$ sudo dir
sudo: ldap_sasl_bind_s(): Can't contact LDAP server
[sudo] password for admin123: 
Sorry, try again.
[sudo] password for admin123: 
Sorry, try again.
[sudo] password for admin123: 
Sorry, try again.
sudo: 3 incorrect password attempts
-bash-3.2$
 
Old 03-15-2011, 06:08 PM   #6
timetraveler
Member
 
Registered: Apr 2010
Posts: 243
Blog Entries: 2

Rep: Reputation: 31
...I would try different ldapsearch commands from that host and make sure results are consistent.
 
Old 04-07-2011, 06:43 AM   #7
craigmyster
LQ Newbie
 
Registered: Feb 2011
Posts: 13

Original Poster
Rep: Reputation: 0
Fixed: I guess sudo has a slightly different requirement in ldap.conf. I had to add
ssl on
 
  


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
[SOLVED] openldap and sudoers shuple Linux - Server 1 03-02-2011 01:07 AM
nss_ldap, openldap and openldap-server ... what is openldap for? chakkerz Linux - Server 2 08-13-2009 07:16 PM
LXer: OpenLDAP Quick Tips: OpenLDAP Logfile analysis LXer Syndicated Linux News 0 12-01-2008 04:00 PM
LXer: OpenLDAP Quick Tips: Regularly upgrade OpenLDAP! LXer Syndicated Linux News 0 11-25-2008 02:00 PM
I deleted /etc/sudoers and creates a new file call sudoers but now it doesnt for visu abefroman Linux - Software 1 11-10-2005 05:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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