From a23e08ce20887efb4e158a02ffee1f775a0db89f Mon Sep 17 00:00:00 2001 From: Quentin Date: Sat, 12 Sep 2020 20:17:07 +0200 Subject: Refactor 2 --- app/build/mariadb/60-disable-dialog.cnf | 3 ++ app/build/mariadb/60-ldap.cnf | 3 ++ app/build/mariadb/60-remote.cnf | 2 ++ app/build/mariadb/Dockerfile | 14 +++++++++ app/build/mariadb/README.md | 19 +++++++++++++ app/build/mariadb/entrypoint.sh | 50 +++++++++++++++++++++++++++++++++ app/build/mariadb/nsswitch.conf | 21 ++++++++++++++ app/build/mariadb/pam-mariadb | 2 ++ 8 files changed, 114 insertions(+) create mode 100644 app/build/mariadb/60-disable-dialog.cnf create mode 100644 app/build/mariadb/60-ldap.cnf create mode 100644 app/build/mariadb/60-remote.cnf create mode 100644 app/build/mariadb/Dockerfile create mode 100644 app/build/mariadb/README.md create mode 100755 app/build/mariadb/entrypoint.sh create mode 100644 app/build/mariadb/nsswitch.conf create mode 100644 app/build/mariadb/pam-mariadb (limited to 'app/build/mariadb') diff --git a/app/build/mariadb/60-disable-dialog.cnf b/app/build/mariadb/60-disable-dialog.cnf new file mode 100644 index 0000000..d41731a --- /dev/null +++ b/app/build/mariadb/60-disable-dialog.cnf @@ -0,0 +1,3 @@ +[mariadb] +pam_use_cleartext_plugin +bind-address = 0.0.0.0 diff --git a/app/build/mariadb/60-ldap.cnf b/app/build/mariadb/60-ldap.cnf new file mode 100644 index 0000000..72ffb9f --- /dev/null +++ b/app/build/mariadb/60-ldap.cnf @@ -0,0 +1,3 @@ +[mariadb] +plugin-load=auth_pam.so + diff --git a/app/build/mariadb/60-remote.cnf b/app/build/mariadb/60-remote.cnf new file mode 100644 index 0000000..f759a49 --- /dev/null +++ b/app/build/mariadb/60-remote.cnf @@ -0,0 +1,2 @@ +[mysqld] +bind-address = 0.0.0.0 diff --git a/app/build/mariadb/Dockerfile b/app/build/mariadb/Dockerfile new file mode 100644 index 0000000..15ef954 --- /dev/null +++ b/app/build/mariadb/Dockerfile @@ -0,0 +1,14 @@ +FROM debian:stretch + +RUN apt-get update && \ + apt-get dist-upgrade -y && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y mariadb-server mariadb-client libnss-ldapd + +COPY 60-ldap.cnf /etc/mysql/mariadb.conf.d/60-ldap.cnf +COPY 60-remote.cnf /etc/mysql/mariadb.conf.d/60-remote.cnf +COPY 60-disable-dialog.cnf /etc/mysql/mariadb.conf.d/60-disable-dialog.cnf +COPY pam-mariadb /etc/pam.d/mariadb +COPY nsswitch.conf /etc/nsswitch.conf +COPY entrypoint.sh /usr/local/bin/entrypoint + +ENTRYPOINT ["/usr/local/bin/entrypoint"] diff --git a/app/build/mariadb/README.md b/app/build/mariadb/README.md new file mode 100644 index 0000000..1a3b8aa --- /dev/null +++ b/app/build/mariadb/README.md @@ -0,0 +1,19 @@ +``` +sudo docker build -t superboum/amd64_mariadb:v3 . + +sudo docker run \ + -t -i \ + -p 3306:3306 \ + -v /tmp/mysql:/var/lib/mysql \ + -e LDAP_URI='ldap://bottin.service.2.cluster.deuxfleurs.fr' \ + -e LDAP_BASE='ou=users,dc=deuxfleurs,dc=fr' \ + -e LDAP_VERSION=3 \ + -e LDAP_BIND_DN='cn=admin,dc=deuxfleurs,dc=fr' \ + -e LDAP_BIND_PW='xxxx' \ + -e MYSQL_PASSWORD='xxxx' \ + superboum/amd64_mariadb:v1 \ + tail -f /var/log/mysql/error.log + +CREATE USER quentin@localhost IDENTIFIED VIA pam USING 'mariadb'; + +``` diff --git a/app/build/mariadb/entrypoint.sh b/app/build/mariadb/entrypoint.sh new file mode 100755 index 0000000..7ebf049 --- /dev/null +++ b/app/build/mariadb/entrypoint.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +set -e + +cat > /etc/nslcd.conf <