Setting up LDAP with OpenLDAP server, Solaris 10, AIX 6.1 and Linux clients.

This article is still a work in progress, more chapters will be added during the following days.

During the last couple of weeks I’ve been working on getting a central directory setup for my client, running on OpenLDAP 2.4. Not having worked with LDAP a lot before it proved quite a challenge, especially getting Solaris 10 to work with the LDAP server without any glitches.
In this document I’ll try and describe how this setup was made, because I have been unable to find a single consistent document describing all the intricate details.
At this time I have all my problems fixed (AFAIK), but during the setup phase I experienced various problems:

  • Solaris 10 not seeing any users from LDAP
  • Solaris seeing users, but not letting them log in
  • Log-in working from console, but not ssh
  • Passwordless login (pubkey) not working in SUN-SSH
  • Users being able to hack extra permissions for themselves
  • etc…. etc….etc…

Document Information

Information that’s relevant for the LDAP server is in sections with background color light orange
Information that’s relevant for a Solaris 10 client is in sections with background color light purple
Information that’s relevant for a AIX 6.1 client is in sections with background color blue
Information that’s relevant for a Linux client is in sections with background color light yellow

Information against a white background is general information, or valid for multiple guest operating systems.


Setting up the OpenLDAP server

I won’t go into too much detail here, as this part is fairly straight-forward. Basically, download and compile OpenLDAP 2.4.x with the options that you like, optionally create a package, and then install OpenLDAP.
I used the following configure options:

BDBDIR=/usr/local/BerkeleyDB.4.2 ; export BDBDIR
LD_LIBRARY_PATH=${BDBDIR}/lib:/usr/sfw/lib \
CPPFLAGS="-I${BDBDIR}/include/ -I/usr/sfw/include" \
LDFLAGS="-L${BDBDIR}/lib -L/usr/sfw/lib" \
./configure --with-tls=openssl --enable-overlays --enable-crypt \
--enable-modules --enable-monitor --prefix=/opt/openldap \
--enable-syslog --enable-proctitle --without-subdir

make clean && make depend && make

After installing OpenLDAP you will probably want to add some schema’s. For solaris you need solaris.schema and I prefer to have my SUDO config in LDAP, so I also include it’s schema:

These schema files should be installed in <openldap-dir>/etc/schemas/


This is an example config for <openldap-dir>/etc/slapd.conf

include /opt/openldap/etc/schema/core.schema
include /opt/openldap/etc/schema/cosine.schema
include /opt/openldap/etc/schema/nis.schema
include /opt/openldap/etc/schema/inetorgperson.schema
include /opt/openldap/etc/schema/solaris.schema
include /opt/openldap/etc/schema/duaconf.schema
include /opt/openldap/etc/schema/ppolicy.schema
include /opt/openldap/etc/schema/sudo.schema

# TLS Certificate
TLSCACertificateFile /opt/openldap/etc/cacert.pem
TLSCertificateFile /opt/openldap/etc/server..pem
TLSCertificateKeyFile /opt/openldap/etc/server..pem
TLSVerifyClient allow
#TLSVerifyClient demand | allow | never

# ACL’s
access to dn.subtree=”ou=People,dc=domain,dc=tld” attrs=userPassword,shadowLastChange
by dn=”cn=proxyagent,ou=profile,dc=domain,dc=tld” write
by self write
by anonymous auth
by * read

# Do not allow users so change their uid/gid/groupmembership
access to attrs=uid,uidNumber,gidNumber,memberUid
by * read

access to dn.base=””
by dn=”cn=proxyagent,ou=profile,dc=domain,dc=tld” read
by * read

access to dn.base=”cn=Subschema”
by anonymous none
by * read

access to dn.subtree=”ou=People,dc=domain,dc=tld”
by self write
by * read

access to dn.subtree=”ou=Group,dc=domain,dc=tld”
by * read

# Sudo rules are only readable by the dedicated sudoers account
access to dn.subtree=”ou=SUDOers,dc=domain,dc=tld”
by dn=”cn=sudoagent,ou=profile,dc=domain,dc=tld” read
by * none

access to *
by * read

# MirrorMode Replication
serverID 1

database bdb
suffix “dc=domain,dc=tld”
rootdn “cn=Manager,dc=domain,dc=tld”


# Synchronisation/Replication
overlay syncprov
syncprov-checkpoint 100 10
syncprov-sessionlog 100

syncrepl rid=001
retry=”60 +”

# 2-Master mode
mirrormode on

# Indices to maintain

index objectClass,uid,uidNumber,gidNumber,ou eq
index cn,mail,surname,givenname eq,subinitial
index memberUid eq
index nisDomain eq
index uniqueMember pres
index sudoUser eq,sub

# OVERLAY definitions: NEED TO BE __AFTER__ database definition they work on
overlay ppolicy
ppolicy_default “cn=default,ou=policies,dc=domain,dc=tld”
ppolicy_hash_cleartext on

overlay unique
unique_uri ldap:///ou=People,dc=domain,dc=tld?uidNumber,uid?sub
unique_uri ldap:///ou=Group,dc=domain,dc=tld?gidNumber,cn?sub

# Performance tuning directives
sizelimit 5000
threads 16
idletimeout 14400
cachesize 10000
checkpoint 256 15
password-hash {SSHA}

# Monitor
database monitor
access to dn.subtree=”cn=Monitor”
by dn=”cn=Manager,dc=domain,dc=tld” write
by users read
by * none

Filling the LDAP Directory

Next step is to fill the LDAP directory with some starting content…
Below you will find an example ldif file that can be used to jumpstart your LDAP directory. It creates a test user, group and people entries, a skeleton sudo infrastructure, configuration profiles and a password policy template.

dn: dc=domain,dc=tld
associatedDomain: domain.tld
dc: ux
objectClass: top
objectClass: dcObject
objectClass: domain
objectClass: domainRelatedObject
objectClass: nisDomainObject
nisDomain: domain.tld
o: Organisation Name

dn: cn=Manager, dc=domain,dc=tld
objectClass: organizationalRole
cn: Manager

dn: ou=profile, dc=domain,dc=tld
ou: profile
objectClass: top
objectClass: organizationalUnit

dn: ou=SUDOers, dc=domain,dc=tld
ou: SUDOers
objectClass: top
objectClass: organizationalUnit

dn: cn=defaults,ou=SUDOers, dc=domain,dc=tld
objectClass: top
objectClass: sudoRole
description: Default sudoOption’s go here
sudoOption: ignore_dot
sudoOption: !mail_no_user
sudoOption: root_sudo
sudoOption: log_host
sudoOption: logfile=/var/log/sudolog
sudoOption: timestamp_timeout=5
cn: defaults

dn: cn=Global_Allowed_NOPASS,ou=SUDOers, dc=domain,dc=tld
sudoUser: ALL
sudoCommand: /some/
sudoHost: ALL
objectClass: top
objectClass: sudoRole
sudoOption: !authenticate
cn: Global_Allowed_NOPASS

dn: ou=People, dc=domain,dc=tld
ou: People
objectClass: top
objectClass: organizationalUnit

dn: ou=Group, dc=domain,dc=tld
ou: Group
objectClass: top
objectClass: organizationalUnit
dn: cn=Users,ou=Group, dc=domain,dc=tld
gidNumber: 1000
objectClass: top
objectClass: posixGroup
cn: Users

dn: cn=proxyagent,ou=profile, dc=domain,dc=tld
userPassword:: MUNGED
objectClass: top
objectClass: person
sn: proxyagent
cn: proxyagent

dn: cn=default,ou=profile, dc=domain,dc=tld
defaultSearchBase: dc=domain,dc=tld
authenticationMethod: simple
followReferrals: TRUE
profileTTL: 43200
searchTimeLimit: 30
objectClass: DUAConfigProfile
defaultServerList: ldapserver1.domain.tld ldapserver2.domain.tld
credentialLevel: proxy
cn: default
defaultSearchScope: one

dn: cn=tls_profile,ou=profile, dc=domain,dc=tld
defaultSearchBase: dc=domain,dc=tld
authenticationMethod: tls:simple
followReferrals: FALSE
bindTimeLimit: 10
profileTTL: 43200
searchTimeLimit: 30
objectClass: top
objectClass: DUAConfigProfile
defaultServerList: ldapserver1.domain.tld ldapserver2.domain.tld
credentialLevel: proxy
cn: tls_profile
serviceSearchDescriptor: passwd: ou=People,dc=domain,dc=tld
serviceSearchDescriptor: group: ou=Group,dc=domain,dc=tld
serviceSearchDescriptor: shadow: ou=People,dc=domain,dc=tld
serviceSearchDescriptor: netgroup: ou=netgroup,dc=domain,dc=tld
serviceSearchDescriptor: sudoers: ou=SUDOers,dc=domain,dc=tld
defaultSearchScope: one

dn: ou=policies, dc=domain,dc=tld
ou: policies
objectClass: top
objectClass: organizationalUnit

dn: uid=testuser,ou=People, dc=domain,dc=tld
shadowMin: 5
sn: User
userPassword:: MUNGED
loginShell: /bin/bash
uidNumber: 9999
gidNumber: 1000
shadowFlag: 0
shadowExpire: -1
shadowMax: 99999
uid: testuser
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: posixAccount
objectClass: shadowAccount
gecos: Test User
shadowLastChange: 0
cn: Test User
homeDirectory: /export/home/testuser
shadowInactive: -1
shadowWarning: 7

dn: cn=default,ou=policies, dc=domain,dc=tld
pwdFailureCountInterval: 30
pwdSafeModify: FALSE
pwdGraceAuthNLimit: 5
pwdLockoutDuration: 10
objectClass: pwdPolicy
objectClass: person
objectClass: top
objectClass: pwdPolicyChecker
pwdMaxFailure: 5
pwdAllowUserChange: TRUE
pwdMinLength: 5
cn: default
pwdAttribute: userPassword
pwdMinAge: 5
pwdLockout: TRUE
pwdCheckQuality: 1
pwdInHistory: 5
sn: default policy
pwdMustChange: FALSE
pwdExpireWarning: 600
pwdMaxAge: 10

Configuring a Solaris 10 Client

If you have defined a profile in your LDAP tree, it should be quite easy to setup a LDAP client on a Solaris 10 system.
If you are using SSL or TLS with your server (you should), then you need to install the CA certificate first, so the server certificate can be checked.

certutil -N -d /var/ldap
certutil -A -d /var/ldap -n 'CA Name' -i /path/to/cacert.pem -a -t CT

  1. First copy /etc/nsswitch.ldap to /etc/nsswitch.ldap.bak and /etc/nsswitch to /etc/nsswitch.bak
  2. Edit /etc/nsswitch.ldap, making sure to change the entries for hosts and ipnodes to ‘files dns’
  3. run ldapclient init:

  4. ldapclient init -v \
    -a proxyDN=cn=proxyagent,ou=profile,dc=domain,dc=tld \
    -a proxyPassword=secret \
    -a domainName=domain.tld \
    -a profileName=tls_profile \

  5. If all is well, LDAP should be configured now.

Using listusers you should be able to see the ldap accounts in your userlist.

Configuring PAM

Next step is configuring pam to allow people to actually log-in using ldap accounts, and have their passwords stored in LDAP. Sun-SSH uses seperate pam names for each authentication method, and the sshd-pubkey method has it’s own dedicated configuration.

# pam.conf.ldapv2_native_client
# 1) This is a /etc/pam.conf with password management support that works for:
# Solaris10 Native LDAP Client
# Solaris9 Native LDAP Client provided that:
# – latest kernel patch and Patch 112960 are applied
# – all the lines are commented out
# Solaris8 Native LDAP Client provided that:
# – latest kernel patch and Patch 108993 are applied
# – all the lines are commented out
# 2) If modules for “sshd” or any are not defined, default is “other”
# as seen by output of “grep other /etc/pam.conf”
# Notes from Mark Janssen
# 3) SSH Pubkey authentication needs it’s own pam rules on sshd-pubkey
# Authentication management
# login service (explicit because of pam_dial_auth)
login auth requisite
login auth required
login auth required
login auth required
login auth binding server_policy
login auth required
# rlogin service (explicit because of pam_rhost_auth)
rlogin auth sufficient
rlogin auth requisite
rlogin auth required
rlogin auth required
rlogin auth binding server_policy
rlogin auth required
# rsh service (explicit because of pam_rhost_auth,
# and pam_unix_auth for meaningful pam_setcred)
rsh auth sufficient
rsh auth required
rsh auth binding server_policy
rsh auth required
# PPP service (explicit because of pam_dial_auth)
ppp auth requisite
ppp auth required
ppp auth required
ppp auth binding server_policy
ppp auth required
# Default definitions for Authentication management
# Used when service name is not explicitly mentioned for authentication
other auth requisite
other auth required
other auth required
other auth binding server_policy
other auth required
# passwd command (explicit because of a different authentication module)
passwd auth binding server_policy
passwd auth required
# cron service (explicit because of non-usage of
cron account required
# Default definition for Account management
# Used when service name is not explicitly mentioned for account management
other account requisite
other account binding server_policy
other account required
# Default definition for Session management
# Used when service name is not explicitly mentioned for session management
other session required
#other session required
# Default definition for Password management
# Used when service name is not explicitly mentioned for password management
other password required
other password requisite
other password requisite
other password required debug server_policy

# Custom Stuff
# Allow ssh-pubkey (SUN-SSH) logins to work
sshd-pubkey account required

Configuring a AIX 6.1 Client

Configuring AIX6.1 is quite easy, especially compared to Solaris.

  • Make sure the LDAP client packages are installed
    • idsldap.clt32bit61.rte Directory Server – 32 bit Client
    • idsldap.clt64bit61.rte Directory Server – 64 bit Client
    • idsldap.cltbase61.adt Directory Server – Base Client
    • idsldap.cltbase61.rte Directory Server – Base Client
  • run: mksecldap -c -h ldapserver1,ldapserver2 -a cn=proxyagent,ou=profile,dc=domain,dc=tld -p password -k /etc/security/ldap/your-ca.kdb -w keydbpassword -A ldap_auth
    • Convert your cacert.pem file to a .kdb file using (java) gsk7ikm, and place it in /etc/security/ldap/your-ca.kdb
    • keydbpassword = the password you use in gsk7ikm to encrypt your keyring (mandatory)
    • password = the password used for the proxyagent
  • Lastly, If your AIX clients need to interoperate with Linux and Solaris clients, you need to tell AIX to store the password-age in days-since-epoch, as it defaults to seconds-since-epoch. Change /etc/security/ldap/

    lastupdate SEC_INT shadowlastchange s days

Configuring a RHEL Client

Configuring a Redhat Enterprise Linux Client is quite easy. It consists of the following steps:

  • Copy the CA-Certificate to /etc/openldap/cacerts/ca-cert.pem
  • Edit /etc/ldap.conf: Add the correct values for ‘binddn’ and ‘bindpw’

    binddn cn=proxyagent,ou=profile,dc=domain,dc=tld
    bindpw secret
  • Run /usr/bin/system-config-authentication
    • Check ‘Cache Information’
    • Check ‘Use LDAP’, Check ‘Use TLS’ and fill in the ldap hostname and base-DN
    • Check ‘Use LDAP Authentication’
    • Check ‘Local authentication is sufficient’

Configuring Netgroups

Using the setup described above lets any ldap user with a valid account log in to any ldap-enabled client machine. This might not be what you want. Using netgroups is a method to limit ldap account visibility on a per system basis. Using netgroups you can specify what (groups of) users can login and use what systems.
Configuring netgroups consists of the following steps:

  1. Configuring a netgroup in your directory
  2. Solaris: Changing your nsswitch configuration
  3. AIX: Changing system settings for netgroups
  4. Allowing the netgroup

Configuring a netgroup in LDAP

Import the following ldif-file into your directory:

dn: ou=Netgroup, dc=domain,dc=tld
ou: netgroup
objectClass: top

objectClass: organizationalUnit

dn: cn=Admins, ou=Netgroup, dc=domain,dc=tld
objectClass: nisNetgroup
objectClass: top
nisNetgroupTriple: (,someuser,domain.tld)
cn: Admins

dn: cn=App1, ou=Netgroup, dc=domain,dc=tld
objectClass: nisNetgroup
objectClass: top
nisNetgroupTriple: (,app1user,domain.tld)
memberNisNetgroup: Admins
cn: App1

This example creates the Netgroup infrastructure, and populates it with 2 netgroups. The ‘App1’ netgroup would be used on systems where ‘App1’ would run. The ‘Admins’ netgroup is a group for the admins, and it’s included in the ‘App1’ netgroup. This way I only need to allow the App1 netgroup on that system, and it automatically includes the users from the ‘Admins’ netgroup.
To specify a user in a netgroup, use a ‘nisNetgroupTriple’ where the value is: ‘(‘, <hostname>, <username>, <domainname>, ‘)’. All fields are optional and can be left out. In our case, we’re mostly interested in the ‘username’ field, so the entries look like ‘(,username,)’.
A netgroup can include another netgroup using ‘memberNisNetgroup: netgroupname’.

Solaris: Changing nsswitch.conf

We will be using the ‘compat’ support for netgroups, so we need to change the ‘passwd’ entry in /etc/nsswitch.conf from:

passwd: files ldap


passwd: compat
passwd_compat: ldap

We are telling the nss system to use ‘compat’ (instead of the default files or ldap), and telling it that the database that it should check for NIS entries is ldap (default would be YP)

AIX: Changing system settings for netgroups

For AIX the following changes need to be made to enable netgroups:

  • In /usr/lib/security/methods.cfg, change the LDAP group, add the options line:

    program = /usr/lib/security/LDAP
    program_64 =/usr/lib/security/LDAP64
    options = netgroup
  • In /etc/group, add a line at the end:

  • In /etc/security/user, change the default group:

    SYSTEM = compat

Allowing netgroups

Every netgroup you want to allow on the system needs to be included in the /etc/passwd file. Make sure you use the correct format, otherwise you will not be able to login.

For Solaris this format needs to be:


If you only add ‘+@netgroupname’ things seem to work, you can see the accounts with ‘listusers’ and even ‘su’ to them, however you still can’t login with these accounts. If you add the entry as specified above, and then run ‘pwconv’ the entry will be copied to ‘/etc/shadow’ in the correct format and you should then be able to login with netgroup-listed accounts.
For AIX you can just specify the simpler:


It’s recomendable to create dedicated netgroups for any system or group of systems that have their own user limitations. It’s also a good idea to include the ‘admin’ netgroup in any netgroup you create or explicitly include it on every system.

Creating home directories

Linux and AIX have PAM modules to create a home directory for a user if one doesn’t exist. Solaris sadly doesn’t have a PAM module for this (and I couldn’t get the linux module working for solaris).

The Linux PAM module is pam_mkhomedir. You can include it in your PAM stack as follows:

session required skel=/etc/skel/ umask=0022

The AIX PAM module is called pam_mkuserhome, however, I have not been able to get it to create an actual directory in my experiments. Since I already need to have a work-around for Solaris I used this method for AIX as well.

  • Create a mkhome script and put it in /usr/local/bin


    if [ -d ${HOME} ]; then
    exit 0

    mkdir -p ${HOME}
    cp -r /etc/skel/.???* ${HOME}
    cp -r /etc/skel/* ${HOME}
    chown ${SUDO_UID}:${SUDO_GID} ${HOME} ${HOME}/* ${HOME}/.???*
    echo "Created ${HOME}"
    exit 0

  • Allow this script to be run using sudo, without prompting for a password

  • dn: cn=Global_Allowed_NOPASS,ou=SUDOers, dc=domain,dc=tld
    sudoUser: ALL
    sudoCommand: /usr/local/bin/mkhome
    sudoHost: ALL
    objectClass: top
    objectClass: sudoRole
    sudoOption: !authenticate
    cn: Global_Allowed_NOPASS

  • Call sudo /usr/local/bin/mkhome from /etc/profile when a home directory can’t be found

    if [ ! -d $HOME ]
    /usr/bin/sudo /usr/local/bin/mkhome
    cd $HOME
Be Sociable, Share!

41 thoughts on “Setting up LDAP with OpenLDAP server, Solaris 10, AIX 6.1 and Linux clients.”

  1. wh0cd677699 [url=]buy kamagra[/url] [url=]buy seroquel[/url] [url=]sildenafil with no prescription[/url] [url=]stromectol online[/url] [url=]BUY CEPHALEXIN[/url]

  2. [url=]Nike Air Max Estampadas[/url]
    To economize in your life insurance coverage, select a word existence plan. This insurance policy will be the quickest and best choice for men and women from age of 20 to about age 50. When you are around 50 and comparatively well-off, it is possible to choose instead for money worth life insurance.


    You might now realise it doesn’t need an insane volume of information to discover how to get a full style. With everything else which you figured out attempt to apply yourself to help you increase your appearance, and people will enjoy the new styles you might have made for yourself.Trend And Also You – Find out What Must Be Done


  3. [url=]Adidas Boost Vibes[/url]
    If you need to utilize a payday loan because of an unexpected emergency, or unexpected event, recognize that most people are put in an negative situation by doing this. If you do not rely on them responsibly, you can find yourself in a pattern that you are unable to get rid of. You could be in personal debt on the payday loan firm for a long time.


    Should you suffer from obstructive sleep apnea, it is vital to prevent taking in liquor before bedtime. Liquor works as a sedative, therefore, it is going to by natural means decelerate your breathing. Furthermore, it can unwind each of the muscles in the body, which includes those in your tonsils that help to keep your airway open.


  4. do you need a prescription for viagra in canada
    [url=]cialis pharmacy rx one[/url]

    canadian pharmacy online for viagra

    canadian generic cialis

  5. wh0cd291569 [url=]zoloft[/url] [url=]altace[/url] [url=]atarax[/url] [url=]bupropion[/url] [url=]yasmin[/url] [url=]revia[/url]

Leave a Reply

Your email address will not be published. Required fields are marked *