From c79c8bffd7466a233fb71c0048f87d45cd8c57ea Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 18 Apr 2019 20:59:51 +0200 Subject: [PATCH] Improve usage examples --- README.md | 12 ++++++++++-- docker-compose.yml.example | 10 +++++++--- fixtures/10_ldapPublicKey.ldif | 9 --------- fixtures/{00_config.ldif => config.ldif} | 13 ++++++++++++- ...xample_structure.ldif => example_structure.ldif} | 0 5 files changed, 29 insertions(+), 15 deletions(-) delete mode 100644 fixtures/10_ldapPublicKey.ldif rename fixtures/{00_config.ldif => config.ldif} (92%) rename fixtures/{20_example_structure.ldif => example_structure.ldif} (100%) diff --git a/README.md b/README.md index b8f7439..b2b5e07 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,21 @@ image. ### Building slapd ``` -docker build -t zombi/slapd . +docker build -t zombi/ldap . ``` ### Running slapd +Copy over example configuration + +```bash +cp docker-compose.yml{.example,} ``` -docker run -d --name ldap -v /data/ldap:/data -p 389:389 zombi/slapd + +run the service + +``` +docker-compose up -d ``` ### Backing up data diff --git a/docker-compose.yml.example b/docker-compose.yml.example index e6a136d..165eff2 100644 --- a/docker-compose.yml.example +++ b/docker-compose.yml.example @@ -1,9 +1,13 @@ -version: '2' +version: "2.4" networks: net: driver: bridge +volumes: + data: + conf: + services: slapd: image: zombi/ldap:latest @@ -13,5 +17,5 @@ services: - "DATADIR=/data" - "CONFDIR=/conf" volumes: - - ./data/ldap/config:/conf - - ./data/ldap/data:/data + - conf:/etc/ldap/slapd.d + - data:/var/lib/ldap diff --git a/fixtures/10_ldapPublicKey.ldif b/fixtures/10_ldapPublicKey.ldif deleted file mode 100644 index eb7eb28..0000000 --- a/fixtures/10_ldapPublicKey.ldif +++ /dev/null @@ -1,9 +0,0 @@ -dn: cn=ldapPublicKey,cn=schema,cn=config -objectClass: olcSchemaConfig -cn: ldapPublicKey -olcAttributeTypes: ( 1.3.6.1.4.1.24552.500.1.1.1.13 NAME 'sshPublicKey' - DESC 'MANDATORY: OpenSSH Public key' EQUALITY octetStringMatch - SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 ) -olcObjectClasses: ( 1.3.6.1.4.1.24552.500.1.1.2.0 NAME 'ldapPublicKey' - SUP top AUXILIARY DESC 'MANDATORY: OpenSSH LPK objectclass' - MUST ( sshPublicKey $ uid ) ) diff --git a/fixtures/00_config.ldif b/fixtures/config.ldif similarity index 92% rename from fixtures/00_config.ldif rename to fixtures/config.ldif index 6ec3eff..be362b7 100644 --- a/fixtures/00_config.ldif +++ b/fixtures/config.ldif @@ -33,7 +33,7 @@ olcAccess: {0}to * by dn.exact=gidNumber=0+uidNumber=0,cn=peercred,cn=external,c # Allow unauthenticated read access for schema and base DN autodiscovery olcAccess: {1}to dn.exact="" by * read olcAccess: {2}to dn.base="cn=Subschema" by * read -# Define CRYPT as preferred algorighm for password hashing +# Define CRYPT as preferred algorithm for password hashing olcPasswordHash: {CRYPT} # Config db settings @@ -60,6 +60,17 @@ include: file:///etc/ldap/schema/ppolicy.ldif # misc adds support for local mail users and aliases include: file:///etc/ldap/schema/misc.ldif +# schema support for storing user public keys +dn: cn=ldapPublicKey,cn=schema,cn=config +objectClass: olcSchemaConfig +cn: ldapPublicKey +olcAttributeTypes: ( 1.3.6.1.4.1.24552.500.1.1.1.13 NAME 'sshPublicKey' + DESC 'MANDATORY: OpenSSH Public key' EQUALITY octetStringMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 ) +olcObjectClasses: ( 1.3.6.1.4.1.24552.500.1.1.2.0 NAME 'ldapPublicKey' + SUP top AUXILIARY DESC 'MANDATORY: OpenSSH LPK objectclass' + MUST ( sshPublicKey $ uid ) ) + # Load module dn: cn=module{0},cn=config objectClass: olcModuleList diff --git a/fixtures/20_example_structure.ldif b/fixtures/example_structure.ldif similarity index 100% rename from fixtures/20_example_structure.ldif rename to fixtures/example_structure.ldif