This commit is contained in:
Wolfgang Hottgenroth 2019-09-02 09:46:57 +00:00
commit abc6d3949a
6 changed files with 88 additions and 0 deletions

25
.gitlab-ci.yml Normal file
View File

@ -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

32
Dockerfile Normal file
View File

@ -0,0 +1,32 @@
FROM mariadb:latest
LABEL Maintainer="Wolfgang Hottgenroth <wolfgang.hottgenroth@icloud.com>"
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

1
VERSION Normal file
View File

@ -0,0 +1 @@
0.1

View File

@ -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

18
ldap.conf-tmpl Normal file
View File

@ -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

3
pam.conf-tail Normal file
View File

@ -0,0 +1,3 @@
mariadb auth required pam_ldap.so
mariadb account required pam_ldap.so