From 30e2232b713b0fba0ead1577469973a970f92629 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Fri, 14 Sep 2018 11:21:35 +0200 Subject: [PATCH] Integrate postfix into basic --- basic.sh | 8 +++++-- .../srv => basic/etc}/postfix/conf/main.cf | 3 --- postfix/Dockerfile | 21 ------------------- postfix/build.sh | 16 -------------- .../docker/etc/services.d/.s6-svscan/finish | 3 --- postfix/docker/etc/services.d/postfix/run | 3 --- postfix/docker/etc/services.d/syslogd/run | 3 --- postfix/etc/init.d/postfix | 20 ------------------ 8 files changed, 6 insertions(+), 71 deletions(-) rename {postfix/srv => basic/etc}/postfix/conf/main.cf (69%) delete mode 100644 postfix/Dockerfile delete mode 100755 postfix/build.sh delete mode 100755 postfix/docker/etc/services.d/.s6-svscan/finish delete mode 100755 postfix/docker/etc/services.d/postfix/run delete mode 100755 postfix/docker/etc/services.d/syslogd/run delete mode 100755 postfix/etc/init.d/postfix diff --git a/basic.sh b/basic.sh index db43197..8a7af22 100755 --- a/basic.sh +++ b/basic.sh @@ -4,7 +4,7 @@ set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/basic # Install packages -apk --no-cache add curl bridge e2fsprogs-extra gettext iptables kbd-misc libcap libressl libseccomp python3 py3-bcrypt py3-cffi py3-dnspython py3-jinja2 py3-requests py3-six py3-werkzeug nginx util-linux +apk --no-cache add ca-certificates curl bridge e2fsprogs-extra gettext iptables kbd-misc libcap libressl libseccomp postfix python3 py3-bcrypt py3-cffi py3-dnspython py3-jinja2 py3-requests py3-six py3-werkzeug nginx util-linux if [ ${DEBUG:-0} -eq 1 ]; then # Install some utilities for DEBUG mode apk --no-cache add git file htop less openssh-server openssh-sftp-server @@ -63,8 +63,12 @@ vmmgr create-selfsigned # Configure nginx cp ${SOURCE_DIR}/etc/nginx/nginx.conf /etc/nginx/nginx.conf +# Configure postfix +cp ${SOURCE_DIR}/etc/postfix/main.cf /etc/postfix/main.cf +newaliases + # Configure services -for SERVICE in cgroups consolefont crond iptables nginx ntpd swap vmmgr; do +for SERVICE in cgroups consolefont crond iptables nginx ntpd postfix swap vmmgr; do rc-update add ${SERVICE} boot service ${SERVICE} start done diff --git a/postfix/srv/postfix/conf/main.cf b/basic/etc/postfix/conf/main.cf similarity index 69% rename from postfix/srv/postfix/conf/main.cf rename to basic/etc/postfix/conf/main.cf index 3c8e0db..a3b9578 100644 --- a/postfix/srv/postfix/conf/main.cf +++ b/basic/etc/postfix/conf/main.cf @@ -1,8 +1,5 @@ append_dot_mydomain = no biff = no compatibility_level = 2 -inet_protocols = ipv4 -mynetworks = 0.0.0.0/0 smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtp_use_tls = yes -smtputf8_enable = no diff --git a/postfix/Dockerfile b/postfix/Dockerfile deleted file mode 100644 index 9c5ca35..0000000 --- a/postfix/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM alpine -LABEL maintainer="Disassembler " - -RUN \ - # Create OS user (which will be picked up later by apk add) - addgroup -S -g 587 postfix \ - && adduser -S -u 587 -h /var/spool/postfix -s /bin/false -g postfix -G postfix postfix \ - # Install Postfix - && apk --no-cache add ca-certificates postfix \ - # Build aliases database - && newaliases \ - # Cleanup - && sed -ir '/^(#.*)?$/d' /etc/postfix/aliases \ - && rm -r /etc/postfix/access /etc/postfix/canonical /etc/postfix/dynamicmaps.cf* /etc/postfix/generic /etc/postfix/header_checks /etc/postfix/postfix-files.d /etc/postfix/relocated /etc/postfix/transport /etc/postfix/virtual - -COPY docker/ / - -VOLUME ["/etc/postfix", "/var/spool/postfix"] -EXPOSE 25 - -CMD ["s6-svscan", "/etc/services.d"] diff --git a/postfix/build.sh b/postfix/build.sh deleted file mode 100755 index b5fe698..0000000 --- a/postfix/build.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -set -e - -SOURCE_DIR=$(realpath $(dirname "${0}"))/postfix - -# Build Docker container -docker build -t postfix ${SOURCE_DIR} -cp ${SOURCE_DIR}/etc/init.d/postfix /etc/init.d/postfix -rc-update -u - -# Copy existing config files into persistent storage -mkdir -p /srv/postfix/conf /srv/postfix/data -docker run --rm -v /srv/postfix/conf:/mnt/conf postfix cp -rp /etc/postfix/. /mnt/conf - -# Configure postfix -cp ${SOURCE_DIR}/srv/postfix/conf/main.cf /srv/postfix/conf/main.cf diff --git a/postfix/docker/etc/services.d/.s6-svscan/finish b/postfix/docker/etc/services.d/.s6-svscan/finish deleted file mode 100755 index 78d5fdc..0000000 --- a/postfix/docker/etc/services.d/.s6-svscan/finish +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -/bin/true diff --git a/postfix/docker/etc/services.d/postfix/run b/postfix/docker/etc/services.d/postfix/run deleted file mode 100755 index dead385..0000000 --- a/postfix/docker/etc/services.d/postfix/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/execlineb -P - -/usr/sbin/postfix -c /etc/postfix start-fg diff --git a/postfix/docker/etc/services.d/syslogd/run b/postfix/docker/etc/services.d/syslogd/run deleted file mode 100755 index 7f2b5a1..0000000 --- a/postfix/docker/etc/services.d/syslogd/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/execlineb -P - -/sbin/syslogd -n -S -O - diff --git a/postfix/etc/init.d/postfix b/postfix/etc/init.d/postfix deleted file mode 100755 index 529733b..0000000 --- a/postfix/etc/init.d/postfix +++ /dev/null @@ -1,20 +0,0 @@ -#!/sbin/openrc-run - -description="Postfix docker container" - -depend() { - need docker -} - -start() { - /usr/bin/docker run -d --rm \ - --name postfix \ - -h postfix \ - -v /srv/postfix/conf:/etc/postfix \ - -v /srv/postfix/data:/var/spool/postfix \ - postfix -} - -stop() { - /usr/bin/docker stop postfix -}