Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

OpenLDAP based on Alpine Linux

License

NotificationsYou must be signed in to change notification settings

gitphill/ldap-alpine

Repository files navigation

The Lightweight Directory Access Protocol (LDAP) is an open, vendor-neutral,industry standard application protocol for accessing and maintainingdistributed directory information services over an Internet Protocol (IP)network.

This image is based on Alpine Linux and OpenLDAP.

Customisation

Override the following environment variables when running the docker containerto customise LDAP:

VARIABLEDESCRIPTIONDEFAULT
ORGANISATION_NAMEOrganisation nameExample Ltd
SUFFIXOrganisation distinguished namedc=example,dc=com
ROOT_USERRoot usernameadmin
ROOT_PWRoot passwordpassword
USER_UIDInitial user's uidpgarrett
USER_GIVEN_NAMEInitial user's given namePhill
USER_SURNAMEInitial user's surnameGarrett
USER_EMAILInitial user's emailpgarrett@example.com
USER_PWInitial user's passwordpassword
ACCESS_CONTROLGlobal access controlaccess to * by * read
LOG_LEVELLDAP logging level, see below for valid values.stats

For example:

docker run -t -p 389:389 \  -e ORGANISATION_NAME="Beispiel gmbh" \  -e SUFFIX="dc=beispiel,dc=de" \  -e ROOT_PW="geheimnis" \  pgarrett/ldap-alpine

Search for user:

ldapsearch -x -b "dc=beispiel,dc=de" "uid=pgarrett"

Logging Levels

NAMEDESCRIPTION
anyenable all debugging (warning! lots of messages will be output)
tracetrace function calls
packetsdebug packet handling
argsheavy trace debugging
connsconnection management
BERprint out packets sent and received
filtersearch filter processing
configconfiguration processing
ACLaccess control list processing
statsstats log connections/operations/results
stats2stats log entries sent
shellprint communication with shell backends
parseprint entry parsing debugging
syncsyncrepl consumer processing
noneonly messages that get logged whatever log level is set

Custom ldif files

*.ldif files can be used to add lots of people to the organisation onstartup.

Copy ldif files to /ldif and the container will execute them. This can bedone either by extending this Dockerfile with your own:

FROM pgarrett/ldap-alpineCOPY my-users.ldif /ldif/

Or by mounting your scripts directory into the container:

docker run -t -p 389:389 -v /my-ldif:/ldif pgarrett/ldap-alpine

Persist data

The container uses a standard mdb backend. To persist this database outside thecontainer mount/var/lib/openldap/openldap-data. For example:

docker run -t -p 389:389 -v /my-backup:/var/lib/openldap/openldap-data pgarrett/ldap-alpine

Transport Layer Security

The container can be started using the encrypted LDAPS protocol. You mustprovide all three TLS environment variables.

VARIABLEDESCRIPTIONEXAMPLE
CA_FILEPEM-format file containing certificates for the CA's that slapd will trust/etc/ssl/certs/ca.pem
KEY_FILEThe slapd server private key/etc/ssl/certs/public.key
CERT_FILEThe slapd server certificate/etc/ssl/certs/public.crt
TLS_VERIFY_CLIENTSlapd option for client certificate verificationtry, never, demand

Note these variables inform the entrypoint script (executed on startup) whereto find the SSL certificates inside the container. So the certificates mustalso be mounted at runtime too, for example:

docker run -t -p 389:389 \  -v /my-certs:/etc/ssl/certs \  -e CA_FILE /etc/ssl/certs/ca.pem \  -e KEY_FILE /etc/ssl/certs/public.key \  -e CERT_FILE /etc/ssl/certs/public.crt \  pgarrett/ldap-alpine

Where/my-certs on the host contains the three certificate filesca.pem,public.key andpublic.crt.

To disable client certificates setTLS_VERIFY_CLIENT tonever ortry.

Access Control

Global access to your directory can be configured via the ACCESS_CONTROL environment variable.

The default policy allows anyone and everyone to read anything but restricts updates to rootdn.

access to * by * read

Note rootdn can always read and writeeverything!

You can find detailed documentation on access control herehttps://www.openldap.org/doc/admin24/access-control.html

This following access control allows the user to modify their entry, allows anonymous to authenticate against these entries,and allows all others to read these entries:

docker run -t -p 389:389 \  -e ACCESS_CONTROL="access to * by self write by anonymous auth by users read" \  pgarrett/ldap-alpine

Nowldapsearch -x -b "dc=example,dc=com" "uid=pgarret" will return no results.

In order to search you will need to authenticate (bind) first:

ldapsearch -D "uid=pgarrett,ou=Users,dc=example,dc=com" -w password -b "dc=example,dc=com" "uid=pgarrett"

[8]ページ先頭

©2009-2025 Movatter.jp