From c6636c937a959f1088ce097827aa1d7fac15ac21 Mon Sep 17 00:00:00 2001 From: TechieNK Date: Sun, 29 Dec 2024 20:12:38 +0530 Subject: [PATCH 1/3] Add Postfix in Canasta --- Dockerfile | 10 ++++++++++ _sources/scripts/run-all.sh | 7 +++++++ main.cf | 39 +++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 main.cf diff --git a/Dockerfile b/Dockerfile index 89c34cfe..e6646e41 100644 --- a/Dockerfile +++ b/Dockerfile @@ -95,6 +95,16 @@ RUN set -x; \ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ && composer self-update 2.1.3 +RUN set -x; \ + # Preconfigure Postfix to avoid the interactive prompt + echo "postfix postfix/main_mailer_type select Internet Site" | debconf-set-selections \ + && echo "postfix postfix/mailname string smtp.gmail.com" | debconf-set-selections \ + && apt-get update \ + && apt-get install -y mailutils \ + && apt install -y postfix + +COPY main.cf /etc/postfix/main.cf + FROM base AS source # MediaWiki core diff --git a/_sources/scripts/run-all.sh b/_sources/scripts/run-all.sh index 05ec26cd..81b2b5ec 100755 --- a/_sources/scripts/run-all.sh +++ b/_sources/scripts/run-all.sh @@ -133,6 +133,13 @@ make_dir_writable "$MW_VOLUME" -not '(' -path "$MW_VOLUME/images" -prune ')' # Running php-fpm /run-php-fpm.sh & +echo "root: $EMAIL" >> /etc/aliases +echo "$MAILNAME" >> /etc/mailname +echo "[$SMTP_DOMAIN]:$SMTP_PORT $EMAIL:$EMAIL_PASSWORD" >> /etc/postfix/sasl_passwd +chmod 0600 /etc/postfix/sasl_passwd +postmap /etc/postfix/sasl_passwd +service postfix start + ############### Run Apache ############### # Make sure we're not confused by old, incompletely-shutdown httpd # context after restarting the container. httpd won't start correctly diff --git a/main.cf b/main.cf new file mode 100644 index 00000000..61355a7e --- /dev/null +++ b/main.cf @@ -0,0 +1,39 @@ +# See /usr/share/postfix/main.cf.dist for a commented, more complete version +# Debian specific: Specifying a file name will cause the first +# line of that file to be used as the name. The Debian default +# is /etc/mailname. +#myorigin = /etc/mailname +smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) +biff = no +# appending .domain is the MUA's job. +append_dot_mydomain = no +# Uncomment the next line to generate "delayed mail" warnings +#delay_warning_time = 4h +readme_directory = no +# See http://www.postfix.org/COMPATIBILITY_README.html - default to 3.6 on +# fresh installs. +compatibility_level = 3.6 +# TLS parameters +smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem +smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key +smtpd_tls_security_level=may +smtp_tls_CApath=/etc/ssl/certs +smtp_tls_security_level=may +smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache +smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination +myhostname = localhost +alias_maps = hash:/etc/aliases +alias_database = hash:/etc/aliases +myorigin = /etc/mailname +mydestination = $myhostname, /etc/mailname, localhost, localhost.localdomain, localhost +relayhost = [smtp.gmail.com]:587 +mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 +mailbox_size_limit = 0 +recipient_delimiter = + +inet_interfaces = loopback-only +inet_protocols = all +smtp_sasl_auth_enable = yes +smtp_sasl_security_options = +smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd +smtp_use_tls = yes +smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt \ No newline at end of file From 8fdfb106e35b3c0103fc93fca20047b9c8a60d7b Mon Sep 17 00:00:00 2001 From: TechieNK Date: Sun, 29 Dec 2024 21:01:02 +0530 Subject: [PATCH 2/3] Add Postfix in Canasta --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e6646e41..b151f3a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -98,7 +98,7 @@ RUN set -x; \ RUN set -x; \ # Preconfigure Postfix to avoid the interactive prompt echo "postfix postfix/main_mailer_type select Internet Site" | debconf-set-selections \ - && echo "postfix postfix/mailname string smtp.gmail.com" | debconf-set-selections \ + && echo "postfix postfix/mailname string $SMTP_DOMAIN" | debconf-set-selections \ && apt-get update \ && apt-get install -y mailutils \ && apt install -y postfix From 98c8acce7443abbc5ade3dd413c8fae8da5a3e2a Mon Sep 17 00:00:00 2001 From: TechieNK Date: Sun, 29 Dec 2024 21:22:16 +0530 Subject: [PATCH 3/3] Add Postfix in Canasta --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b151f3a8..022d98f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -98,7 +98,7 @@ RUN set -x; \ RUN set -x; \ # Preconfigure Postfix to avoid the interactive prompt echo "postfix postfix/main_mailer_type select Internet Site" | debconf-set-selections \ - && echo "postfix postfix/mailname string $SMTP_DOMAIN" | debconf-set-selections \ + && echo "postfix postfix/mailname string $MAILNAME" | debconf-set-selections \ && apt-get update \ && apt-get install -y mailutils \ && apt install -y postfix