| 1 |
Sample config |
| 2 |
============= |
| 3 |
|
| 4 |
pam_pkcs11.conf: |
| 5 |
---------------- |
| 6 |
|
| 7 |
(...) |
| 8 |
# Directory ( ldap style ) mapper |
| 9 |
mapper ldap { |
| 10 |
debug = false; |
| 11 |
module = /usr/lib/pam_pkcs11/ldap_mapper.so; |
| 12 |
# where base directory resides |
| 13 |
basedir = /etc/pam_pkcs11/mapdir; |
| 14 |
# hostname of ldap server |
| 15 |
ldaphost = "localhost"; |
| 16 |
# Port on ldap server to connect |
| 17 |
ldapport = 389; |
| 18 |
# Scope of search: 0 = x, 1 = y, 2 = z |
| 19 |
scope = 2; |
| 20 |
# DN to bind with. Must have read-access for user entries under "base" |
| 21 |
binddn = "cn=pam,o=example,c=com"; |
| 22 |
# Password for above DN |
| 23 |
passwd = "test"; |
| 24 |
# Searchbase for user entries |
| 25 |
base = "ou=People,o=example,c=com"; |
| 26 |
# Attribute of user entry which contains the certificate |
| 27 |
attribute = "userCertificate"; |
| 28 |
# Searchfilter for user entry. Must only let pass user entry for the login user. |
| 29 |
filter = "(&(objectClass=posixAccount)(uid=%s))" |
| 30 |
# Attribute of user entry which contains the user's login name (optional) |
| 31 |
uid_attribute = "uid"; |
| 32 |
# List of sets of ldap attribute / cert attribute pairs (optional) |
| 33 |
attribute_map = "uid=uid&mail=email", "krbprincipalname=upn", "userCertificate;binary=cert"; |
| 34 |
} |
| 35 |
(...) |
| 36 |
|
| 37 |
Sample structure of the LDAP entries |
| 38 |
==================================== |
| 39 |
|
| 40 |
/etc/openldap/slapd.conf: |
| 41 |
------------------------- |
| 42 |
|
| 43 |
include /etc/openldap/schema/core.schema |
| 44 |
include /etc/openldap/schema/cosine.schema |
| 45 |
include /etc/openldap/schema/inetorgperson.schema |
| 46 |
include /etc/openldap/schema/nis.schema |
| 47 |
allow bind_v2 |
| 48 |
pidfile /var/run/slapd.pid |
| 49 |
argsfile /var/run/slapd.args |
| 50 |
access to dn.base="" by * read |
| 51 |
access to dn.base="ou=People" by dn=cn=pam,o=example,c=com read |
| 52 |
access to * |
| 53 |
by self write |
| 54 |
by users read |
| 55 |
by anonymous auth |
| 56 |
database bdb |
| 57 |
suffix "o=example,c=com" |
| 58 |
rootdn "cn=root,o=example,c=com" |
| 59 |
rootpw {SSHA}**** |
| 60 |
directory /var/lib/ldap |
| 61 |
index objectClass eq,pres |
| 62 |
index ou,cn,mail,surname,givenname eq,pres,sub |
| 63 |
index uidNumber,gidNumber,loginShell eq,pres |
| 64 |
index uid,memberUid eq,pres,sub |
| 65 |
index nisMapName,nisMapEntry eq,pres,sub |
| 66 |
|
| 67 |
initial.ldif: |
| 68 |
------------- |
| 69 |
dn: o=example,c=com |
| 70 |
objectClass: dcObject |
| 71 |
objectClass: organization |
| 72 |
o: example |
| 73 |
dc: example |
| 74 |
|
| 75 |
dn: ou=People,o=example,c=com |
| 76 |
ou: People |
| 77 |
objectclass: organizationalUnit |
| 78 |
|
| 79 |
dn: ou=Groups,o=example,c=com |
| 80 |
ou: Groups |
| 81 |
objectclass: organizationalUnit |
| 82 |
|
| 83 |
pam.user.ldif: |
| 84 |
-------------- |
| 85 |
dn: uid=pam,o=example,c=com |
| 86 |
uid: pam |
| 87 |
givenName: Pamela |
| 88 |
sn: Anderson |
| 89 |
userPassword: pam |
| 90 |
loginShell: /bin/false |
| 91 |
uidNumber: 999999 |
| 92 |
gidNumber: 999999 |
| 93 |
homeDirectory: /tmp |
| 94 |
shadowMin: -1 |
| 95 |
shadowMax: 999999 |
| 96 |
shadowWarning: 7 |
| 97 |
shadowInactive: -1 |
| 98 |
shadowExpire: -1 |
| 99 |
shadowFlag: 0 |
| 100 |
objectClass: top |
| 101 |
objectClass: person |
| 102 |
objectClass: posixAccount |
| 103 |
objectClass: shadowAccount |
| 104 |
objectClass: inetOrgPerson |
| 105 |
cn: pam |
| 106 |
|
| 107 |
sample.user.ldif: |
| 108 |
----------------- |
| 109 |
dn: uid=testuser,ou=People,o=example,c=com |
| 110 |
uid: testuser |
| 111 |
givenName: Test |
| 112 |
sn: User |
| 113 |
cn: Test User |
| 114 |
userPassword: abcde |
| 115 |
loginShell: /bin/bash |
| 116 |
uidNumber: 1000 |
| 117 |
gidNumber: 1000 |
| 118 |
homeDirectory: /home/testuser |
| 119 |
shadowMin: -1 |
| 120 |
shadowMax: 999999 |
| 121 |
shadowWarning: 7 |
| 122 |
shadowInactive: -1 |
| 123 |
shadowExpire: -1 |
| 124 |
shadowFlag: 0 |
| 125 |
objectClass: top |
| 126 |
objectClass: person |
| 127 |
objectClass: posixAccount |
| 128 |
objectClass: shadowAccount |
| 129 |
objectClass: inetOrgPerson |
| 130 |
userCertificate;binary:: MIIELD |
| 131 |
(...) |
| 132 |
Bg== |
| 133 |
|