Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc: Mention possibility of \" for inline PHPLDAPADMIN_LDAP_HOSTS #28

Open
j-maas opened this issue Apr 4, 2017 · 3 comments
Open

Doc: Mention possibility of \" for inline PHPLDAPADMIN_LDAP_HOSTS #28

j-maas opened this issue Apr 4, 2017 · 3 comments

Comments

@j-maas
Copy link

j-maas commented Apr 4, 2017

The docs (main README) could mention how to customize the phpLDAPAdmin-Config using arrays.

Current state

The YAML-example uses an array for force_may:

- ldap.example.org:
  - server:
    - tls: true
    - port: 636
    - force_may: array('uidNumber','gidNumber','sambaSID')
  - login:
    - bind_id: cn=admin,dc=example,dc=org
    - bind_pass: p0p!
  - auto_number:
    - min: 1000
- ldap2.example.org
- ldap3.example.org

However the inline example does not use any array:

docker run --env PHPLDAPADMIN_LDAP_HOSTS="#PYTHON2BASH:[{'ldap.example.org': [{'server': [{'tls': True}]},{'login': [{'bind_id': 'cn=admin,dc=example,dc=org'}]}]}, 'ldap2.example.org', 'ldap3.example.org']" --detach osixia/phpldapadmin:0.6.12

Proposed solution

For example, the complete YAML-example could be translated into inline. (This might be too verbose, though). The need for escaping might be spelled out explicitely.

docker run --env PHPLDAPADMIN_LDAP_HOSTS="#PYTHON2BASH:[{'ldap.example.org': [{'server': [{'tls': True}, {'port': 636}, {'force_may': \"array('uidNumber','gidNumber','sambaSID')\"}]}, {'login': [{'bind_id': 'cn=admin,dc=example,dc=org'}, {'bind_pass': 'p0p!'}]}, {'auto_number': [{'min': 1000}]}]}, 'ldap2.example.org', 'ldap3.example.org']" --detach osixia/phpldapadmin:0.6.12

Motivation

I spent a few hours trying to define multiple base DNs for my server to be able to access the cn=config. I finally realized that it is possible to escape the inner " that are put around the array.

If there is an alternative way of customizing the phpLDAPAdmin-Config, then maybe it could be clarified. The docs suggest there is, but I do not understand what it is (apart from maybe mounting a volume to image/environment/default.yaml thus overriding the default.yml?).

@agrrh
Copy link

agrrh commented Oct 31, 2018

Faced same problem with auto_number, would be excellent to add some docs about using array() with env vars configuration.

@Archweii
Copy link

The documentation seems wrong, I tried setting PHPLDAPADMIN_LDAP_HOSTS with your Python code and it worked, it overrides the default config with my server's config!

@ChrisSamo632
Copy link

ChrisSamo632 commented Mar 1, 2019

Possibly worth adding some documentation/comments about setting this in a docker-compose.yml as a multiline string (I found this much easier to read and ultimately helped me find what was wrong with the syntax in my entries), e.g.

version: '3.7'

services:
  phpldapadmin:
    image: osixia/phpldapadmin:0.7.2
    environment:
      PHPLDAPADMIN_LDAP_HOSTS: "#PYTHON2BASH:[
{'ldap.example.com':[
  {'server': [
    {'tls': True},
    {'port': 389},
    {'force_may': \"array('uidNumber','gidNumber','sambaSID')\"},
    {'base': \"array('dc=example,dc=com')\"}
   ]
  },
  {'login': [
    {'bind_id': 'cn=admin,dc=example,dc=com'},
    {'bind_pass': '${LDAP_ADMIN_PASSWORD:-default_password}'}
   ]
  },
  {'auto_number': [
    {'min': \"array('uidNumber'=>1000,'gidNumber'=>1000)\"}
   ]
  }
 ]
}
]"
...

(N.B. I didn't specify force_may, base, login or auto_number entries in the end to get my initial START_TLS connections working to the osixia/openldap service also running on my Swarm, but thought I'd include them here as working out the syntax to get them working with PYTHON2BASH was tricky and time consuming).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants