openldap Plugin

This plugin installs OpenLDAP in an existing Kubernetes cluster using the Helm chart. Please at least make sure your Kubernetes’s version is greater than 1.18.

Usage

  1. tools:
  2. # name of the tool
  3. - name: openldap
  4. # id of the tool instance
  5. instanceID: default
  6. # format: name.instanceID; If specified, dtm will make sure the dependency is applied first before handling this tool.
  7. dependsOn: []
  8. # options for the plugin
  9. options:
  10. # need to create the namespace or not, default: false
  11. create_namespace: true
  12. repo:
  13. # name of the Helm repo
  14. name: helm-openldap
  15. # url of the Helm repo
  16. url: https://jp-gouin.github.io/helm-openldap/
  17. # Helm chart information
  18. chart:
  19. # name of the chart
  20. chart_name: helm-openldap/openldap-stack-ha
  21. # release name of the chart
  22. release_name: openldap
  23. # k8s namespace where OpenLDAP will be installed
  24. namespace: openldap
  25. # whether to wait for the release to be deployed or not
  26. wait: true
  27. # the time to wait for any individual Kubernetes operation (like Jobs for hooks). This defaults to 5m0s
  28. timeout: 5m
  29. # custom configuration (Optional). You can refer to https://github.com/jp-gouin/helm-openldap/blob/master/values.yaml
  30. values_yaml: |
  31. replicaCount: 1
  32. service:
  33. type: NodePort
  34. env:
  35. LDAP_ORGANISATION: "DevStream Inc."
  36. LDAP_DOMAIN: "devstream.io"
  37. persistence:
  38. enabled: false
  39. adminPassword: Not@SecurePassw0rd
  40. configPassword: Not@SecurePassw0rd
  41. ltb-passwd:
  42. enabled : false
  43. phpldapadmin:
  44. enabled: true
  45. ingress:
  46. enabled: false

Description of Key Fields in values_yaml

  • replicaCount: The default value is 3, for the convenience of local testing, the above example is set to 1
  • service.type: The default value is ClusterIP, if you have services outside the Kubernetes cluster that require ldap integration, the value preferably be set to NodePort, so that services outside the Kubernetes cluster can access the ldap service via ldap://ip:389 instead of ldap://openldap.openldap-openldap-stack-ha:389
  • adminPassword: Use your own custom password
  • configPassword: Use your own custom password
  • ltb-passwd: Ingress of the Ltb-Passwd service by which you can modify your password. If you need this service, you can set ltb-passwd.enabled to true.
  • phpldapadmin.ingress: Ingress of Phpldapadmin service by which you can manage your ldap service. If you wish to expose the service to the Internet, you can change the phpldapadmin.ingress.enabled to true and configure your own domain name

Post-installation Operations

Once the installation is complete, you can manage ldap service through phpldapadmin. For local testing, you can access the service through port forwarding. The commands are as follows.

  1. kubectl port-forward svc/openldap-phpldapadmin 8080:80 -n openldap

Now you can now access the phpldapadmin service on your browser via http://127.0.0.1:8080

If you have not changed the default values in the above example, its account will be cn=admin,dc=devstream,dc=org and password will be Not@SecurePassw0rd.

Note: If you’re familiar with OpenLDAP, then you don’t need to continue reading the tutorial below, you can just go ahead and integrate ldap for your service.

Importing Your Data

The following is a sample file, if you have changed the above configuration, remember to replace dc=devstream,dc=org with your own.

  1. dn: cn=admin,dc=devstream,dc=org
  2. cn: admin
  3. objectclass: organizationalRole
  4. dn: ou=Group,dc=devstream,dc=org
  5. cn: Group
  6. objectclass: organizationalRole
  7. ou: Group
  8. # confluence organizationalUnit
  9. dn: ou=confluence,ou=Group,dc=devstream,dc=org
  10. objectclass: organizationalUnit
  11. objectclass: top
  12. ou: confluence
  13. # confluence administrators group
  14. dn: cn=confluence-administrators,ou=confluence,ou=Group,dc=devstream,dc=org
  15. cn: confluence-administrators
  16. description:: d2lraeeuoeeQhue7hA==
  17. objectclass: groupOfUniqueNames
  18. uniquemember: uid=example,ou=People,dc=devstream,dc=org
  19. # confluence users group
  20. dn: cn=confluence-users,ou=confluence,ou=Group,dc=devstream,dc=org
  21. cn: confluence-users
  22. description:: d2lraeaZrumAmueUqOaItw==
  23. objectclass: groupOfUniqueNames
  24. uniquemember: uid=example,ou=People,dc=devstream,dc=org
  25. # jira organizationalUnit
  26. dn: ou=jira,ou=Group,dc=devstream,dc=org
  27. objectclass: organizationalUnit
  28. objectclass: top
  29. ou: jira
  30. # jira administrators Group
  31. dn: cn=jira-administrators,ou=jira,ou=Group,dc=devstream,dc=org
  32. cn: jira-administrators
  33. description:: amlyYeeuoeeQhue7hA==
  34. objectclass: groupOfUniqueNames
  35. uniquemember: uid=example,ou=People,dc=devstream,dc=org
  36. # jira users group
  37. dn: cn=jira-software-users,ou=jira,ou=Group,dc=devstream,dc=org
  38. cn: jira-software-users
  39. description:: amlyYeeuoeeQhue7hA==
  40. objectclass: groupOfUniqueNames
  41. uniquemember: uid=example,ou=People,dc=devstream,dc=org
  42. dn: ou=People,dc=devstream,dc=org
  43. objectclass: organizationalUnit
  44. ou: People
  45. # People for example
  46. dn: uid=example,ou=People,dc=devstream,dc=org
  47. cn: example
  48. gidnumber: 500
  49. givenname: example
  50. homedirectory: /home/example
  51. loginshell: /bin/sh
  52. mail: example@devstream.org
  53. objectclass: inetOrgPerson
  54. objectclass: posixAccount
  55. objectclass: top
  56. sn: example
  57. uid: example
  58. uidnumber: 1007
  59. userpassword: example@123456

Login your phpldapadmin service and import the sample configuration above.After importing the data successfully, the result is as follows.

Verify the LDAP Service

Log in to the container where the ldap service is located, and then use the ldapsearch command to query the user(uid=example,ou=people,dc=devstream,dc=org) created above

  1. root@openldap-openldap-stack-ha-0:/# ldapsearch -x -H ldap://127.0.0.1:389 -b uid=example,ou=people,dc=devstream,dc=org -D "cn=admin,dc=devstream,dc=org" -w Not@SecurePassw0rd
  2. # extended LDIF
  3. #
  4. # LDAPv3
  5. # base <uid=example,ou=people,dc=devstream,dc=org> with scope subtree
  6. # filter: (objectclass=*)
  7. # requesting: ALL
  8. #
  9. # example, People, devstream.org
  10. dn: uid=example,ou=People,dc=devstream,dc=org
  11. cn: example
  12. gidNumber: 500
  13. givenName: example
  14. homeDirectory: /home/example
  15. loginShell: /bin/sh
  16. mail: example@devstream.org
  17. objectClass: inetOrgPerson
  18. objectClass: posixAccount
  19. objectClass: top
  20. sn: example
  21. uid: example
  22. uidNumber: 1007
  23. userPassword:: ZXhhbXBsZUAxMjM0NTY=
  24. # search result
  25. search: 2
  26. result: 0 Success
  27. # numResponses: 2
  28. # numEntries: 1

If your command output is as above, your ldap service is fine. The above values_yaml is only to facilitate your local testing, if you want production available, you also have to configure replicaCount, data persistence, etc., refer to OpenLDAP values.yaml