From 084eb1c0c05ce8e536d6fbd250132dd288204975 Mon Sep 17 00:00:00 2001 From: Dominik Chilla Date: Sun, 10 Feb 2019 15:30:20 +0100 Subject: [PATCH] init --- BASEOS | 1 + VERSION | 1 + app/ldap-acl-milter.py | 0 config/config.json | 49 ++++++++++++++++++++++++++++++++++++++++ docker-build.sh | 36 +++++++++++++++++++++++++++++ docker/debian/Dockerfile | 22 ++++++++++++++++++ 6 files changed, 109 insertions(+) create mode 100644 BASEOS create mode 100644 VERSION create mode 100644 app/ldap-acl-milter.py create mode 100644 config/config.json create mode 100755 docker-build.sh create mode 100644 docker/debian/Dockerfile diff --git a/BASEOS b/BASEOS new file mode 100644 index 0000000..2dee175 --- /dev/null +++ b/BASEOS @@ -0,0 +1 @@ +debian diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..55b939b --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +19.02 diff --git a/app/ldap-acl-milter.py b/app/ldap-acl-milter.py new file mode 100644 index 0000000..e69de29 diff --git a/config/config.json b/config/config.json new file mode 100644 index 0000000..244f5ee --- /dev/null +++ b/config/config.json @@ -0,0 +1,49 @@ +{ + "logging": { + "__level": "default: WARNING. Possible: INFO,ERROR,CRITICAL,DEBUG", + "level": "DEBUG", + "__filename": "default: empty string (stdout).", + "filename": "" + }, + "daemon":{ + "listen_host": "127.0.0.1", + "listen_port": 5001 + }, + "trusted_proxies": { + "rprx01":[ + "172.16.100.5", "fd00:100::5" + ], + "rprx02":[ + "172.16.100.6", "fd00:100::6" + ] + }, + "api_keys": { + "HIGHLY_SECURE_API_KEY": { + "user": "GULAG APP" + } + }, + "uri_prefixes": { + "root": "http://127.0.0.1:9090/api/v1/", + "mailrelays": "http://127.0.0.1:9090/api/v1/mailrelays/", + "mailboxes": "http://127.0.0.1:9090/api/v1/mailboxes/", + "quarmails": "http://127.0.0.1:9090/api/v1/quarmails/", + "attachments": "http://127.0.0.1:9090/api/v1/attachments/", + "uris": "http://127.0.0.1:9090/api/v1/uris/" + }, + "dos_protection": { + "max_body_bytes": 8388608 + }, + "db":{ + "unix_socket": "/mysqld/mysqld.sock", + "user": "root", + "password": "", + "name": "Gulag" + }, + "cleaner":{ + "retention_period": "12 hour", + "interval": 10 + }, + "importer":{ + "interval": 10 + } +} diff --git a/docker-build.sh b/docker-build.sh new file mode 100755 index 0000000..9caa72b --- /dev/null +++ b/docker-build.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +BRANCH="$(/usr/bin/git branch|/bin/grep \*|/usr/bin/awk {'print $2'})" +VERSION="$(/bin/cat VERSION)" +BASEOS="$(/bin/cat BASEOS)" +#REGISTRY="some-registry.invalid" +GO="" + +while getopts g opt +do + case $opt in + g) GO="go";; + esac +done + +if [ -z "${GO}" ] ; then + echo "Building ldap-acl-milter@docker on '${BASEOS}' for version '${VERSION}' in branch '${BRANCH}'!" + echo "GO serious with '-g'!" + exit 1 +fi + +IMAGES="ldap-acl-milter" + +for IMAGE in ${IMAGES}; do + /usr/bin/docker build \ + --build-arg http_proxy=http://wprx-zdf.zwackl.local:3128 \ + --build-arg https_proxy=http://wprx-zdf.zwackl.local:3128 \ + -t "${IMAGE}/${BASEOS}:${VERSION}_${BRANCH}" \ + -f "docker/${BASEOS}/Dockerfile" . +# /usr/bin/docker tag "${IMAGE}/${BASEOS}:${VERSION}_${BRANCH}" "${REGISTRY}/${IMAGE}/${BASEOS}:${VERSION}_${BRANCH}" +done + +#/bin/echo "Push images to registry:" +#for IMAGE in ${IMAGES}; do +# /bin/echo "/usr/bin/docker push ${REGISTRY}/${IMAGE}/${BASEOS}:${VERSION}_${BRANCH}" +#done diff --git a/docker/debian/Dockerfile b/docker/debian/Dockerfile new file mode 100644 index 0000000..d1f3c50 --- /dev/null +++ b/docker/debian/Dockerfile @@ -0,0 +1,22 @@ +ARG http_proxy +ARG https_proxy +FROM debian +LABEL maintainer="Dominik Chilla " + +ENV DEBIAN_FRONTEND=noninteractive \ + TZ=Europe/Berlin + +RUN env; set -ex ; \ + apt-get -qq update \ + && apt-get -qq --no-install-recommends install \ + python3-pip python3-setuptools python3-ldap3 \ + libmilter1.0.1 libmilter-dev procps net-tools \ + gcc python3-dev \ + && /usr/bin/pip3 install pymilter \ + && /bin/mkdir /config /socket /app \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +COPY app/*.py /app/ + +ENTRYPOINT ["/entrypoint.sh"]