SuiteCRM LDAP integration fixes:

- Correct LDAP attribute FIRSTNAME changed to givenName
- Add automated ldap.yaml rendering and bind mount
- Create LDAP extension directory inside container
- Adjust docker-compose.yml for proper LDAP config mount
- Add strict formatting template for ldap.yaml
- Update paths for SUITECRM_LDAP_CONFIG_HOST and SUITECRM_LDAP_EXTENSION_DIR

Details: https://chatgpt.com/share/6928375d-1458-800f-bcc3-b3364ea69078
This commit is contained in:
2025-11-27 12:35:07 +01:00
parent 3fe83f26d5
commit d7e0123af2
6 changed files with 28 additions and 1 deletions

View File

@@ -87,7 +87,7 @@ LDAP:
ID: "{{ _ldap_user_id }}" ID: "{{ _ldap_user_id }}"
MAIL: "mail" MAIL: "mail"
FULLNAME: "cn" FULLNAME: "cn"
FIRSTNAME: "givenname" FIRSTNAME: "givenName"
SURNAME: "sn" SURNAME: "sn"
SSH_PUBLIC_KEY: "sshPublicKey" SSH_PUBLIC_KEY: "sshPublicKey"
NEXTCLOUD_QUOTA: "nextcloudQuota" NEXTCLOUD_QUOTA: "nextcloudQuota"

View File

@@ -4,6 +4,14 @@
vars: vars:
docker_compose_flush_handlers: false docker_compose_flush_handlers: false
- name: "Render SuiteCRM LDAP mapping"
template:
src: ldap.yaml.j2
dest: "{{ SUITECRM_LDAP_CONFIG_HOST }}"
notify:
- docker compose up
when: SUITECRM_LDAP_ENABLED | bool
- name: "Deploy '{{ SUITECRM_ENTRYPOINT_SCRIPT_HOST_ABS }}'" - name: "Deploy '{{ SUITECRM_ENTRYPOINT_SCRIPT_HOST_ABS }}'"
copy: copy:
src: "{{ SUITECRM_ENTRYPOINT_SCRIPT_FILE }}" src: "{{ SUITECRM_ENTRYPOINT_SCRIPT_FILE }}"

View File

@@ -86,5 +86,8 @@ RUN yarn install --immutable \
COPY {{ SUITECRM_ENTRYPOINT_SCRIPT_HOST_REL }} {{ SUITECRM_ENTRYPOINT_SCRIPT_DOCKER }} COPY {{ SUITECRM_ENTRYPOINT_SCRIPT_HOST_REL }} {{ SUITECRM_ENTRYPOINT_SCRIPT_DOCKER }}
RUN chmod +x {{ SUITECRM_ENTRYPOINT_SCRIPT_DOCKER }} RUN chmod +x {{ SUITECRM_ENTRYPOINT_SCRIPT_DOCKER }}
# Create LDAP Extension Directory
RUN mkdir -p "{{ SUITECRM_LDAP_EXTENSION_DIR }}"
ENTRYPOINT ["{{ SUITECRM_ENTRYPOINT_SCRIPT_DOCKER }}"] ENTRYPOINT ["{{ SUITECRM_ENTRYPOINT_SCRIPT_DOCKER }}"]
CMD ["apache2-foreground"] CMD ["apache2-foreground"]

View File

@@ -17,6 +17,11 @@
volumes: volumes:
- data:/var/www/html/ - data:/var/www/html/
{% if SUITECRM_LDAP_ENABLED | bool %}
# Readonly isn't possible for LDAP config, because otherwise file permission script will fail
- "{{ SUITECRM_LDAP_CONFIG_HOST }}:{{ SUITECRM_LDAP_EXTENSION_DIR }}/ldap.yaml"
{% endif %}
{% include 'roles/docker-compose/templates/volumes.yml.j2' %} {% include 'roles/docker-compose/templates/volumes.yml.j2' %}
data: data:
name: {{ SUITECRM_DATA_VOLUME }} name: {{ SUITECRM_DATA_VOLUME }}

View File

@@ -0,0 +1,7 @@
{# WARNING: Don't mess with the formatation SuiteCRM is very strict! #}
parameters:
ldap.extra_fields: ['{{ LDAP.USER.ATTRIBUTES.MAIL }}', '{{ LDAP.USER.ATTRIBUTES.FIRSTNAME }}', '{{ LDAP.USER.ATTRIBUTES.SURNAME }}']
ldap.autocreate.extra_fields_map:
{{ LDAP.USER.ATTRIBUTES.MAIL }}: email1
{{ LDAP.USER.ATTRIBUTES.FIRSTNAME }}: first_name
{{ LDAP.USER.ATTRIBUTES.SURNAME }}: last_name

View File

@@ -25,7 +25,11 @@ SUITECRM_DATA_VOLUME: "{{ applications | get_app_conf(applicatio
# URLs & feature flags # URLs & feature flags
SUITECRM_URL: "{{ domains | get_url(application_id, WEB_PROTOCOL) }}" SUITECRM_URL: "{{ domains | get_url(application_id, WEB_PROTOCOL) }}"
# LDAP
SUITECRM_LDAP_ENABLED: "{{ applications | get_app_conf(application_id, 'features.ldap') }}" SUITECRM_LDAP_ENABLED: "{{ applications | get_app_conf(application_id, 'features.ldap') }}"
SUITECRM_LDAP_CONFIG_HOST: "{{ [ docker_compose.directories.config, 'ldap.yaml'] | path_join }}"
SUITECRM_LDAP_EXTENSION_DIR: "/var/www/html/extensions/{{ SOFTWARE_NAME | lower | replace('.', '-') }}/config/services/ldap"
# Simple maintenance toggle (for later extensions) # Simple maintenance toggle (for later extensions)
SUITECRM_INIT_MAINTENANCE_MODE: "{{ applications | get_app_conf(application_id, 'maintenance_mode') }}" SUITECRM_INIT_MAINTENANCE_MODE: "{{ applications | get_app_conf(application_id, 'maintenance_mode') }}"