commit abc6d3949adc796305e396f2675a35c73f7d1e8d Author: Wolfgang Hottgenroth Date: Mon Sep 2 09:46:57 2019 +0000 initial diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..e7fc6eb --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,25 @@ +image: docker:stable + +stages: + - build + +variables: + IMAGE_NAME: registry.gitlab.com/wolutator/mariadb-with-ldap-pam + HUB_IMAGE_NAME: wollud1969/mariadb-with-ldap-pam + +build: + stage: build + tags: + - hottis + - linux + - docker + script: + - VERSION=`cat VERSION` + - docker build --tag $IMAGE_NAME:latest --tag $IMAGE_NAME:$VERSION --tag $HUB_IMAGE_NAME:$VERSION --tag $HUB_IMAGE_NAME:latest . + - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY + - docker push $IMAGE_NAME:latest + - docker push $IMAGE_NAME:$VERSION + - docker login -u $DOCKER_HUB_LOGIN -p $DOCKER_HUB_PASSWORD + - docker push $HUB_IMAGE_NAME:latest + - docker push $HUB_IMAGE_NAME:$VERSION + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3db6ac6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +FROM mariadb:latest + +LABEL Maintainer="Wolfgang Hottgenroth " +LABEL ImageName="registry.gitlab.com/wolutator/mariadb-with-ldap-pam" +LABEL AlternativeImageName="wollud1969/mariadb-with-ldap-pam" + +ENV LDAPBASE "DC=hottis,DC=de" +ENV LDAPURI "ldap://ldap.hottis.de:389" +ENV LDAPBINDDB "" +ENV LDAPBINDPW "" + +RUN \ + apt-get update && \ + env DEBIAN_FRONTEND=noninteractive apt-get -yq install libpam-ldap && \ + env DEBIAN_FRONTEND=noninteractive apt-get -yq install pamtester + +COPY docker-entrypoint.sh-head /usr/local/bin +COPY pam.conf-tail /etc/pam.conf-tail +COPY ldap.conf-tmpl /etc/ldap.conf-tmpl + +RUN \ + cd /usr/local/bin && \ + tail -n +2 docker-entrypoint.sh > docker-entrypoint.sh-tail && \ + cat docker-entrypoint.sh-head docker-entrypoint.sh-tail > docker-entrypoint.sh && \ + cd /etc && \ + cat pam.conf-tail >> pam.conf + + + + + + diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..49d5957 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1 diff --git a/docker-entrypoint.sh-head b/docker-entrypoint.sh-head new file mode 100644 index 0000000..50d6c62 --- /dev/null +++ b/docker-entrypoint.sh-head @@ -0,0 +1,9 @@ +#!/bin/bash + +echo "new docker-entrypoint.sh head" + +pushd /etc +cat ldap.conf-tmpl | sed -e "s/%LDAPBASE%/$LDAPBASE/" -e "s,%LDAPURI%,$LDAPURI," -e "s/%LDAPBINDDN%/$LDAPBINDDN/" -e "s/%LDAPBINDPW%/$LDAPBINDPW/" > ldap.conf +popd + + diff --git a/ldap.conf-tmpl b/ldap.conf-tmpl new file mode 100644 index 0000000..376e2ff --- /dev/null +++ b/ldap.conf-tmpl @@ -0,0 +1,18 @@ +base %LDAPBASE% +uri %LDAPURI% +binddn %LDAPBINDDN% +bindpw %LDAPBINDPW% +ldap_version 3 +referrals off +pam_login_attribute samaccountname +pam_member_attribute member +nss_map_objectclass posixAccount user +nss_map_objectclass shadowAccount user +nss_map_attribute uid sAMAccountName +nss_map_attribute homeDirectory unixHomeDirectory +nss_map_attribute shadowLastChange pwdLastSet +nss_map_objectclass posixGroup group +nss_map_attribute uniqueMember member +pam_login_attribute sAMAccountName +pam_filter objectclass=User +pam_password ad diff --git a/pam.conf-tail b/pam.conf-tail new file mode 100644 index 0000000..652f274 --- /dev/null +++ b/pam.conf-tail @@ -0,0 +1,3 @@ +mariadb auth required pam_ldap.so +mariadb account required pam_ldap.so +