]> granicus.if.org Git - pdns/commitdiff
Add LDAP backend to testing
authorPieter Lexis <pieter.lexis@powerdns.com>
Wed, 10 Apr 2019 15:58:29 +0000 (17:58 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Mon, 6 May 2019 15:13:17 +0000 (17:13 +0200)
.circleci/config.yml
build-scripts/docker/.gitignore [new file with mode: 0644]
build-scripts/docker/ldap-regress/Dockerfile [new file with mode: 0644]
build-scripts/docker/ldap-regress/Makefile [new file with mode: 0644]
build-scripts/docker/ldap-regress/bootstrap/ldif/powerdns-mdb.ldif [moved from modules/ldapbackend/testfiles/add.ldif with 50% similarity]
regression-tests/backends/ldap-master

index e761edacd7891279b1f9e02da7a099f5dae8b9a2..e4d2ab147e6f86d5ffa3c49ae83f434248b6439e 100644 (file)
@@ -134,6 +134,8 @@ commands:
       - run: |
           apt-get install -qq -y --no-install-recommends \
             libboost-all-dev \
+            libkrb5-3 \
+            libldap-2.4-2 \
             liblmdb0 \
             libpq5 \
             libssl1.1 \
@@ -156,6 +158,8 @@ commands:
               g++ \
               git \
               libboost-all-dev \
+              libkrb5-dev \
+              libldap2-dev \
               liblmdb-dev \
               libpq-dev \
               libsqlite3-dev \
@@ -265,7 +269,7 @@ jobs:
             CXXFLAGS="-O1 -Werror=vla" \
             ./configure \
               --disable-lua-records \
-              --with-modules='bind lmdb gmysql gsqlite3 gpgsql godbc random' \
+              --with-modules='bind lmdb ldap gmysql gsqlite3 gpgsql godbc random' \
               --enable-tools \
               --with-lmdb=/usr \
               --prefix=/opt/pdns-auth
@@ -473,6 +477,29 @@ jobs:
       - auth-regress:
           context: gpgsql-nsec3-narrow
 
+  test-auth-regress-ldap:
+    docker:
+      - image: debian:stretch
+        environment:
+          LDAPHOST: ldap://ldapserver/
+      - image: powerdns/ldap-regress:1.2.4-0 # OpenLDAP 2.4.47
+        name: ldapserver
+        command: '--loglevel debug'
+        environment:
+          LDAP_LOG_LEVEL: 0
+    steps:
+      - auth-regress-setup
+      - run: DEBIAN_FRONTEND=noninteractive apt-get install -qq -y ldap-utils
+      - auth-regress:
+          context: ldap-tree
+          doroot: false
+      - auth-regress:
+          context: ldap-simple
+          doroot: false
+      - auth-regress:
+          context: ldap-strict
+          doroot: false
+
   test-auth-regress-lmdb:
     docker:
       - image: debian:stretch
@@ -672,6 +699,9 @@ workflows:
       - test-auth-regress-lmdb:
           requires:
             - build-auth
+      - test-auth-regress-ldap:
+          requires:
+            - build-auth
 
       - build-recursor
       - test-recursor-regression:
diff --git a/build-scripts/docker/.gitignore b/build-scripts/docker/.gitignore
new file mode 100644 (file)
index 0000000..1c12cf9
--- /dev/null
@@ -0,0 +1 @@
+schema
diff --git a/build-scripts/docker/ldap-regress/Dockerfile b/build-scripts/docker/ldap-regress/Dockerfile
new file mode 100644 (file)
index 0000000..4b83c3a
--- /dev/null
@@ -0,0 +1,6 @@
+ARG VERSION
+FROM osixia/openldap:$VERSION
+ADD bootstrap /container/service/slapd/assets/config/bootstrap
+RUN rm -rf /container/service/slapd/assets/config/bootstrap/schema/mmc
+RUN mkdir -p /var/lib/ldap-powerdns
+RUN chown openldap:openldap /var/lib/ldap-powerdns
diff --git a/build-scripts/docker/ldap-regress/Makefile b/build-scripts/docker/ldap-regress/Makefile
new file mode 100644 (file)
index 0000000..0b6611d
--- /dev/null
@@ -0,0 +1,20 @@
+NAME = powerdns/ldap-regress
+VERSION = 1.2.4
+REVISION = 0
+
+.PHONY: all build build-nocache dep
+
+all: build
+
+dep:
+       mkdir -p bootstrap/schema
+       cp ../../../modules/ldapbackend/*.schema bootstrap/schema
+
+build: dep
+       docker build --build-arg VERSION=$(VERSION) -t $(NAME):$(VERSION)-$(REVISION) --rm .
+
+build-nocache: dep
+       docker build --build-arg VERSION=$(VERSION) -t $(NAME):$(VERSION)-$(REVISION) --no-cache --rm .
+
+push: build
+       docker push powerdns/ldap-regress:$(VERSION)-$(REVISION)
\ No newline at end of file
similarity index 50%
rename from modules/ldapbackend/testfiles/add.ldif
rename to build-scripts/docker/ldap-regress/bootstrap/ldif/powerdns-mdb.ldif
index 88a233f89646cd70d54cf5c88511ece73c91ced2..1ca2e76e632ab272bf27cf8439aeb89e778d2ae7 100644 (file)
@@ -1,19 +1,16 @@
-dn: olcDatabase=hdb,cn=config
+dn: olcDatabase=mdb,cn=config
 objectClass: olcDatabaseConfig
-objectClass: olcHdbConfig
-olcDatabase: hdb
-olcDbDirectory: /var/lib/ldap/powerdns
+objectClass: olcMdbConfig
+olcDatabase: mdb
+olcDbDirectory: /var/lib/ldap-powerdns
 olcSuffix: o=power
 olcLastMod: TRUE
 olcRootDN: uid=testuser,o=power
 olcDbCheckpoint: 512 30
-olcDbConfig: {0}set_cachesize 0 2097152 0
-olcDbConfig: {1}set_lk_max_objects 1500
-olcDbConfig: {2}set_lk_max_locks 1500
-olcDbConfig: {3}set_lk_max_lockers 1500
 olcDbIndex: objectClass eq
 olcDbIndex: associatedDomain eq
 olcRootPW: secret
+olcDbMaxSize: 1073741824
 
 dn: o=power
 objectClass: organization
index 6f26c21f3fd89175cc9fe75e740e8c5c62c37f22..7260c10163757d9da4901ae033cba632d369c9f4 100644 (file)
@@ -4,16 +4,17 @@ case $context in
                [ -z "$LDAPPASSWD" ] && LDAPPASSWD='secret'
                [ -z "$LDAPBASEDN" ] && LDAPBASEDN='ou=dns,o=power'
                [ -z "$LDAPRELATTR" ] && LDAPRELATTR='ou: dns'
+               [ -z "$LDAPHOST" ] && LDAPHOST='ldap://127.0.0.1:389/'
 
                layout=${context:5}
-               ldapdelete -D $LDAPUSER -w $LDAPPASSWD -r $LDAPBASEDN || true
-               ldapadd -D $LDAPUSER -w $LDAPPASSWD << __EOF__
+               ldapdelete -D $LDAPUSER -w $LDAPPASSWD -r $LDAPBASEDN -H $LDAPHOST || true
+               ldapadd -D $LDAPUSER -w $LDAPPASSWD -H $LDAPHOST << __EOF__
 dn: $LDAPBASEDN
 objectClass: organizationalUnit
 $LDAPRELATTR
 __EOF__
 
-               $ZONE2LDAP --dnsttl=yes --basedn=$LDAPBASEDN --layout=$layout --named-conf=named.conf | ldapmodify -D $LDAPUSER -w $LDAPPASSWD -c > /dev/null || true
+               $ZONE2LDAP --dnsttl=yes --basedn=$LDAPBASEDN --layout=$layout --named-conf=named.conf | ldapmodify -D $LDAPUSER -w $LDAPPASSWD -H $LDAPHOST -c > /dev/null || true
 
                cat > pdns-ldap.conf << __EOF__
 module-dir=./modules
@@ -22,6 +23,7 @@ ldap-basedn=$LDAPBASEDN
 ldap-binddn=$LDAPUSER
 ldap-secret=$LDAPPASSWD
 ldap-method=$layout
+ldap-host=$LDAPHOST
 __EOF__
 
                $RUNWRAPPER $PDNS --daemon=no --local-address=$address --local-port=$port --config-dir=. \