Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tutorial:ldap:installopenldap [2016-04-03 22:17] weichbr |
tutorial:ldap:installopenldap [2019-08-14 19:43] (current) weichbr |
||
---|---|---|---|
Line 5: | Line 5: | ||
===== Requirements ===== | ===== Requirements ===== | ||
* Debian 8 installation | * Debian 8 installation | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Notes ===== | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
---- | ---- | ||
Line 50: | Line 62: | ||
===== Add Some Data ===== | ===== Add Some Data ===== | ||
- | * We want to create some basic organizational units (OUs) | + | * We want to create some basic organizational units (OUs), e.g. for people and groups |
+ | * Create '' | ||
+ | * < | ||
+ | dn: ou=people, | ||
+ | objectClass: | ||
+ | ou: people | ||
+ | |||
+ | dn: ou=groups, | ||
+ | objectClass: | ||
+ | ou: groups | ||
+ | </ | ||
+ | * Add it with '' | ||
+ | * < | ||
---- | ---- | ||
Line 56: | Line 80: | ||
===== Enforce Authorization ===== | ===== Enforce Authorization ===== | ||
* We do not want our directory to be world readable, so we need to setup some ACLs | * We do not want our directory to be world readable, so we need to setup some ACLs | ||
- | * | + | * First, get your current ACLs: |
+ | * < | ||
+ | * This results in a long list, we are interested in the output under the '' | ||
+ | * < | ||
+ | # {1}mdb, config | ||
+ | dn: olcDatabase={1}mdb, | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | olcDatabase: | ||
+ | olcDbDirectory: | ||
+ | olcSuffix: dc=my, | ||
+ | olcAccess: {0}to attrs=userPassword, | ||
+ | | ||
+ | olcAccess: {1}to dn.base="" | ||
+ | olcAccess: {2}to * by dn=" | ||
+ | olcLastMod: TRUE | ||
+ | olcRootDN: cn=admin, | ||
+ | olcRootPW: {SSHA}abcdefghijklmnopqrstuvwxyz123456 | ||
+ | olcSecurity: | ||
+ | olcDbCheckpoint: | ||
+ | olcDbIndex: objectClass eq | ||
+ | olcDbIndex: cn,uid eq | ||
+ | olcDbIndex: uidNumber, | ||
+ | olcDbIndex: member, | ||
+ | olcDbMaxSize: | ||
+ | </ | ||
+ | * Take a look at the lines starting with '' | ||
+ | * We want users to be able to change their own password as well as authenticate. Noone else should be able to read the password hash. The admin accounts can modify everyones passwords and can read all hashes. | ||
+ | * Also we want users to authenticate before reading the directory. Anonymous access should be disallowed. | ||
+ | * We need to modify '' | ||
+ | * Create the '' | ||
+ | * < | ||
+ | dn: olcDatabase={1}mdb, | ||
+ | changetype: modify | ||
+ | delete: olcAccess | ||
+ | olcAccess: {0} | ||
+ | - | ||
+ | add: olcAccess | ||
+ | olcAccess: {0}to attrs=userPassword, | ||
+ | by dn=" | ||
+ | by self write | ||
+ | by anonymous auth | ||
+ | by * none | ||
+ | - | ||
+ | delete: olcAccess | ||
+ | olcAccess: {2} | ||
+ | - | ||
+ | add: olcAccess | ||
+ | olcAccess: {2}to * | ||
+ | by dn=" | ||
+ | by self write | ||
+ | by anonymous auth | ||
+ | by users read | ||
+ | |||
+ | </ | ||
+ | * Apply it: | ||
+ | * < | ||
+ | * Users now need to authenticate to read the directory, like this: | ||
+ | * < | ||
---- | ---- | ||
Line 62: | Line 144: | ||
===== Enabling TLS ===== | ===== Enabling TLS ===== | ||
* Make sure you have the following files: | * Make sure you have the following files: | ||
- | * cert.crt - Your certificate (without any other intermediate certs) | + | * '' |
- | * cert.key - Your private key | + | * '' |
- | * chain.pem - The intermediate certs | + | * '' |
* I assume the files are located at '' | * I assume the files are located at '' | ||
* Add the openldap user to the ssl-cert group: | * Add the openldap user to the ssl-cert group: | ||
Line 73: | Line 155: | ||
$> chmod 640 cert.crt cert.key chain.pem | $> chmod 640 cert.crt cert.key chain.pem | ||
</ | </ | ||
- | * Create the tls.ldif file: | + | * Create the '' |
* < | * < | ||
dn: cn=config | dn: cn=config | ||
Line 107: | Line 189: | ||
olcSecurity: | olcSecurity: | ||
</ | </ | ||
+ | * Users now need to use STARTTLS (e.g. with '' | ||
+ | * < | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Add an admin group ==== | ||
+ | * We do not want to give every admin the admin account credentials | ||
+ | * We need an admin group which all admins are a member of | ||
+ | * We can give this group manage permissions | ||
+ | * I assume you already have created a '' | ||
+ | * Take a look at the ldif to enforce authorization and change it to this: | ||
+ | * < | ||
+ | dn: olcDatabase={1}mdb, | ||
+ | changetype: modify | ||
+ | delete: olcAccess | ||
+ | olcAccess: {3} | ||
+ | - | ||
+ | add: olcAccess | ||
+ | olcAccess: {3}to * | ||
+ | by dn=" | ||
+ | by set=" | ||
+ | by self write | ||
+ | by anonymous auth | ||
+ | by users read | ||
+ | - | ||
+ | </ | ||
+ | * Apply it like above |