|
2 | 2 |
|
3 | 3 | A basic ldap server in a docker container with admin gui.
|
4 | 4 |
|
5 |
| -Created by following this guide |
| 5 | +Read: |
6 | 6 | https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-a-basic-ldap-server-on-an-ubuntu-12-04-vps
|
| 7 | +https://wiki.r00tedvw.com/index.php/Ubuntu/openldap |
7 | 8 |
|
8 | 9 | Still WIP.
|
9 | 10 |
|
10 |
| -TODO: Initial config |
11 | 11 |
|
12 |
| -TODO: Directories /etc/ldap and /usr/share/slapd must be saved outside. |
| 12 | +Directories /etc/ldap and /usr/share/slapd must be saved outside. |
| 13 | + |
| 14 | +To build: |
| 15 | + |
| 16 | +sudo docker build -t ldap . |
| 17 | + |
| 18 | +To run: |
| 19 | + |
| 20 | +sudo docker run -d -p 8888:80 -p 8889:389 -v /tmp/data/etc:/etc/ldap -v /tmp/data/slapd:/usr/share/slapd --name ldap -t ldap |
| 21 | + |
| 22 | +sudo docker exec -it ldap dpkg-reconfigure slapd |
| 23 | + |
| 24 | +Config like this (example tampere.hacklab.fi): |
| 25 | + |
| 26 | +Configuring slapd |
| 27 | +----------------- |
| 28 | + |
| 29 | +If you enable this option, no initial configuration or database will be created for you. |
| 30 | + |
| 31 | +Omit OpenLDAP server configuration? [yes/no] no |
| 32 | + |
| 33 | +The DNS domain name is used to construct the base DN of the LDAP directory. For example, 'foo.example.org' will create the directory with 'dc=foo, dc=example, dc=org' as base DN. |
| 34 | + |
| 35 | +DNS domain name: tampere.hacklab.fi |
| 36 | + |
| 37 | +Please enter the name of the organization to use in the base DN of your LDAP directory. |
| 38 | + |
| 39 | +Organization name: Tampere Hacklab |
| 40 | + |
| 41 | +Please enter the password for the admin entry in your LDAP directory. |
| 42 | + |
| 43 | +Administrator password: |
| 44 | + |
| 45 | +Please enter the admin password for your LDAP directory again to verify that you have typed it correctly. |
| 46 | + |
| 47 | +Confirm password: |
| 48 | + |
| 49 | +HDB and BDB use similar storage formats, but HDB adds support for subtree renames. Both support the same configuration options. |
| 50 | + |
| 51 | +The MDB backend is recommended. MDB uses a new storage format and requires less configuration than BDB or HDB. |
| 52 | + |
| 53 | +In any case, you should review the resulting database configuration for your needs. See /usr/share/doc/slapd/README.Debian.gz for more details. |
| 54 | + |
| 55 | + 1. BDB 2. HDB 3. MDB |
| 56 | +Database backend to use: 2 |
| 57 | + |
| 58 | +Do you want the database to be removed when slapd is purged? [yes/no] yes |
| 59 | + |
| 60 | +There are still files in /var/lib/ldap which will probably break the configuration process. If you enable this option, the maintainer scripts will move the old database files out of the way |
| 61 | +before creating a new database. |
| 62 | + |
| 63 | +Move old database? [yes/no] yes |
| 64 | + |
| 65 | +The obsolete LDAPv2 protocol is disabled by default in slapd. Programs and users should upgrade to LDAPv3. If you have old programs which can't use LDAPv3, you should select this option and |
| 66 | +'allow bind_v2' will be added to your slapd.conf file. |
| 67 | + |
| 68 | +Allow LDAPv2 protocol? [yes/no] no |
| 69 | + |
| 70 | + Moving old database directory to /var/backups: |
| 71 | + - directory unknown... done. |
| 72 | + Creating initial configuration... done. |
| 73 | + Creating LDAP directory... done. |
| 74 | +invoke-rc.d: could not determine current runlevel |
| 75 | +invoke-rc.d: policy-rc.d denied execution of start. |
| 76 | + |
| 77 | + |
| 78 | +Then: |
| 79 | + |
| 80 | +nano /etc/phpldapadmin/config.php |
| 81 | + |
| 82 | + |
| 83 | +change: |
| 84 | + |
| 85 | +$servers->setValue('server','base',array('dc=tampere,dc=hacklab,dc=fi')); |
| 86 | +$servers->setValue('login','bind_id','cn=admin,dc=tampere,dc=hacklab,dc=fi'); |
| 87 | + |
| 88 | +run: |
| 89 | +service slapd start |
| 90 | +service apache2 start |
| 91 | + |
| 92 | +Open browser at http://localhost:8888/phpldapadmin |
| 93 | + |
| 94 | +Admin login: cn=admin,dc=tampere,dc=hacklab,dc=fi |
13 | 95 |
|
0 commit comments