From c65f98a4373d84c61ab2ea3d326b325e7b79de1c Mon Sep 17 00:00:00 2001 From: finn Date: Sun, 7 Jul 2024 10:12:32 -0700 Subject: [PATCH] add pmb build and pgp stuff --- Dockerfile | 22 +++++++++++++++++++++- README.md | 2 ++ docker-compose.yml | 26 ++++++++++++++++++++++---- run.sh | 12 ++++++++++++ 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3e2577a..b24a92f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,38 @@ #Dockerfile for a Postfix email relay service -FROM alpine:3.16 +FROM alpine:3 MAINTAINER Juan Luis Baptiste juan.baptiste@gmail.com RUN apk update && \ apk add bash gawk cyrus-sasl cyrus-sasl-login cyrus-sasl-crammd5 mailx \ postfix && \ + apk add make go pkgconfig libsecret libsecret-dev git gpg gpg-agent pass && \ rm -rf /var/cache/apk/* && \ mkdir -p /var/log/supervisor/ /var/run/supervisor/ && \ sed -i -e 's/inet_interfaces = localhost/inet_interfaces = all/g' /etc/postfix/main.cf +# Gpg for pass/pmb +RUN mkdir /root/.gnupg +#RUN echo "default-cache-ttl 34560000" >> /root/.gnupg/gpg-agent.conf +#RUN echo "max-cache-ttl 34560000" >> /root/.gnupg/gpg-agent.conf +RUN gpg-agent --daemon --batch --disable-scdaemon +RUN gpg --quick-gen-key --batch --passphrase '' pmbkey +RUN pass init pmbkey + COPY run.sh / +COPY passpgp.sh / RUN chmod +x /run.sh +RUN chmod +x /passpgp.sh RUN newaliases +# ProtonMailBridge +RUN git clone https://github.com/ProtonMail/proton-bridge.git pb +WORKDIR pb +RUN echo "BUILDING BRIDGE" +RUN make build-nogui +RUN rm -rf /root/.cache && rm -rf /root/go + +WORKDIR / + EXPOSE 25 #ENTRYPOINT ["/run.sh"] CMD ["/run.sh"] diff --git a/README.md b/README.md index dbab175..21adb76 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ [![Docker Stars](https://img.shields.io/docker/stars/juanluisbaptiste/postfix.svg?style=flat-square)](https://hub.docker.com/r/juanluisbaptiste/postfix/) [![Docker Pulls](https://img.shields.io/docker/pulls/juanluisbaptiste/postfix.svg?style=flat-square)](https://hub.docker.com/r/juanluisbaptiste/postfix/) +## This is a merge of juanluisbaptiste/postfix and ProtonMail/proton-bridge + Simple Postfix SMTP TLS relay [docker](http://www.docker.com) alpine based image with no local authentication enabled (to be run in a secure LAN). This image is available for the following architectures: diff --git a/docker-compose.yml b/docker-compose.yml index 62f9924..9aa7b30 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,29 @@ version: '2' services: - postfix: - image: juanluisbaptiste/postfix:latest + dpo: + build: + context: . + dockerfile: Dockerfile + #image: juanluisbaptiste/postfix:latest expose: - - "25" + - "25" env_file: - .env restart: always volumes: - - "/etc/localtime:/etc/localtime:ro" + - dpo_root:/root + - "/etc/localtime:/etc/localtime:ro" + networks: + - mn + + deb: + image: debian:latest + tty: yes + stdin_open: yes + networks: + - mn + +networks: + mn: +volumes: + dpo_root: diff --git a/run.sh b/run.sh index 6e51f81..33cc477 100644 --- a/run.sh +++ b/run.sh @@ -2,6 +2,17 @@ [ "${DEBUG}" == "yes" ] && set -x +# GPG Area +#exec gpg-agent --daemon --batch --disable-scdaemon +gpg-agent --daemon --batch --disable-scdaemon + + + + + + +# Postfix area + function add_config_value() { local key=${1} local value=${2} @@ -35,6 +46,7 @@ add_config_value "myorigin" '$mydomain' add_config_value "relayhost" "[${SMTP_SERVER}]:${SMTP_PORT}" add_config_value "smtp_use_tls" "yes" if [ ! -z "${SMTP_USERNAME}" ]; then + add_config_value "smtp_sasl_mechanism_filter" "login" add_config_value "smtp_sasl_auth_enable" "yes" add_config_value "smtp_sasl_password_maps" "lmdb:/etc/postfix/sasl_passwd" add_config_value "smtp_sasl_security_options" "noanonymous"