diff --git a/Dockerfile b/Dockerfile index b24a92f..78189af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ 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 && \ + apk add msmtp && \ 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 @@ -18,21 +19,18 @@ RUN gpg-agent --daemon --batch --disable-scdaemon RUN gpg --quick-gen-key --batch --passphrase '' pmbkey RUN pass init pmbkey +COPY dotmsmtprc /root/.msmtprc 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 git clone https://github.com/ProtonMail/proton-bridge.git pmb +WORKDIR pmb 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/docker-compose.yml b/docker-compose.yml index 9aa7b30..f671320 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ version: '2' services: - dpo: + pmb: build: context: . dockerfile: Dockerfile @@ -11,19 +11,19 @@ services: - .env restart: always volumes: - - dpo_root:/root + - pmb_root:/root - "/etc/localtime:/etc/localtime:ro" networks: - - mn + - pmb_mailnet deb: image: debian:latest tty: yes stdin_open: yes networks: - - mn + - pmb_mailnet networks: - mn: + pmb_mailnet: volumes: - dpo_root: + pmb_root: diff --git a/dotmsmtprc b/dotmsmtprc new file mode 100644 index 0000000..bc9b309 --- /dev/null +++ b/dotmsmtprc @@ -0,0 +1,28 @@ +# (debian) cat /usr/share/doc/msmtp/examples/msmtprc-user-example +# Example for a user configuration file ~/.msmtprc + +# With modern mail services that publish autoconfiguration information, +# you can simply run 'msmtp --configure yourmail@example.com' to get +# a basic working configuration. + +# This example focusses on TLS and authentication. Features not used here +# include logging, timeouts, SOCKS proxies, TLS parameters, Delivery Status +# Notification (DSN) settings, and more. + +# Set default values: use the mail submission port 587, and always use TLS. +# On this port, TLS is activated via STARTTLS. +defaults +port 25 +tls off +tls_starttls off + +# Define a mail account at a freemail service +account pmb +# Host name of the SMTP server +host pmb +# Envelope-from address +from joe_smith@freemail.example +# Authentication +auth off +#user joe.smith + diff --git a/run.sh b/run.sh index 33cc477..b8ebd64 100644 --- a/run.sh +++ b/run.sh @@ -2,16 +2,13 @@ [ "${DEBUG}" == "yes" ] && set -x -# GPG Area -#exec gpg-agent --daemon --batch --disable-scdaemon +# GPG/PMB Area ------------------- gpg-agent --daemon --batch --disable-scdaemon +# ProtonMail bridge has really bad timeout/retry logic: +sleep 2 +/pmb/bridge -n & - - - - - -# Postfix area +# Postfix area ------------------ function add_config_value() { local key=${1} @@ -46,6 +43,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 + # Following line added for proton bridge 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"