2
0
Fork 0
mirror of https://github.com/friendica/docker synced 2024-06-02 22:05:03 +02:00

Replace SSMTP with MSMTP for sendmail

- New parameter "SMTP_PORT"
- Removed parameter "SMTP_AUTH_METHOD"
- Replacing config mapping based on env-variables
This commit is contained in:
Philipp Holzer 2020-07-22 23:17:31 +02:00
parent f18979f1ec
commit 55b4574787
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
16 changed files with 191 additions and 170 deletions

View file

@ -10,7 +10,7 @@ RUN set -ex; \
bzip2 \ bzip2 \
git \ git \
# For mail() support # For mail() support
ssmtp \ msmtp \
# For tini installation # For tini installation
gnupg dirmngr \ gnupg dirmngr \
; \ ; \
@ -109,7 +109,7 @@ RUN set -ex; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
\ \
{ \ { \
echo sendmail_path = "/usr/sbin/sendmail -t -i"; \ echo sendmail_path = "/usr/bin/msmtp -t"; \
} > /usr/local/etc/php/conf.d/sendmail.ini; \ } > /usr/local/etc/php/conf.d/sendmail.ini; \
\ \
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \

View file

@ -16,40 +16,45 @@ version_greater() {
[ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ] [ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ]
} }
setup_ssmtp() { setup_msmtp() {
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}" SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..." echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
smtp_from=${SMTP_FROM:-no-reply} smtp_from="${SMTP_FROM:=no-reply}"
# Setup SSMTP # Setup MSMTP
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
# add possible mail-senders # add possible mail-senders
{ {
echo "www-data:$smtp_from@$SMTP_DOMAIN:$SMTP" echo "www-data: $smtp_from@$SMTP_DOMAIN"
echo "root::$smtp_from@$SMTP_DOMAIN:$SMTP" echo "root: $smtp_from@$SMTP_DOMAIN"
} > /etc/ssmtp/revaliases } >/etc/aliases
# replace ssmtp.conf settings # create msmtp settings
{ {
echo "root=:$smtp_from@$SMTP_DOMAIN" echo "account default"
echo "hostname=$SMTP_DOMAIN" echo "host $SMTP_DOMAIN"
echo "mailhub=$SMTP" if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
echo "FromLineOverride=YES" echo "from $smtp_from@$SMTP_DOMAIN"
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user $SMTP_AUTH_USER"; fi
} > /etc/ssmtp/ssmtp.conf if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password $SMTP_AUTH_PASS"; fi
echo "logfile /var/log/msmtp.log"
echo "aliases /etc/aliases"
} >/etc/msmtprc
echo "Setup finished" echo "Setup finished"
fi fi
} }
setup_msmtp
# just check if we execute apache or php-fpm # just check if we execute apache or php-fpm
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
installed_version="0.0.0.0" installed_version="0.0.0.0"
@ -65,8 +70,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
exit 1 exit 1
fi fi
setup_ssmtp
# check it just in case the version is greater or if we force the upgrade # check it just in case the version is greater or if we force the upgrade
if version_greater "$image_version" "$installed_version" || [ "${FRIENDICA_UPGRADE:-false}" = "true" ]; then if version_greater "$image_version" "$installed_version" || [ "${FRIENDICA_UPGRADE:-false}" = "true" ]; then
echo "Initializing Friendica $image_version ..." echo "Initializing Friendica $image_version ..."

View file

@ -7,7 +7,7 @@ RUN set -ex; \
rsync \ rsync \
git \ git \
# For mail() support # For mail() support
ssmtp \ msmtp \
shadow \ shadow \
tini; tini;
@ -84,7 +84,7 @@ RUN set -ex; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
\ \
{ \ { \
echo sendmail_path = "/usr/sbin/sendmail -t -i"; \ echo sendmail_path = "/usr/bin/msmtp -t"; \
} > /usr/local/etc/php/conf.d/sendmail.ini; \ } > /usr/local/etc/php/conf.d/sendmail.ini; \
\ \
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \

View file

@ -16,40 +16,45 @@ version_greater() {
[ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ] [ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ]
} }
setup_ssmtp() { setup_msmtp() {
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}" SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..." echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
smtp_from=${SMTP_FROM:-no-reply} smtp_from="${SMTP_FROM:=no-reply}"
# Setup SSMTP # Setup MSMTP
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
# add possible mail-senders # add possible mail-senders
{ {
echo "www-data:$smtp_from@$SMTP_DOMAIN:$SMTP" echo "www-data: $smtp_from@$SMTP_DOMAIN"
echo "root::$smtp_from@$SMTP_DOMAIN:$SMTP" echo "root: $smtp_from@$SMTP_DOMAIN"
} > /etc/ssmtp/revaliases } >/etc/aliases
# replace ssmtp.conf settings # create msmtp settings
{ {
echo "root=:$smtp_from@$SMTP_DOMAIN" echo "account default"
echo "hostname=$SMTP_DOMAIN" echo "host $SMTP_DOMAIN"
echo "mailhub=$SMTP" if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
echo "FromLineOverride=YES" echo "from $smtp_from@$SMTP_DOMAIN"
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user $SMTP_AUTH_USER"; fi
} > /etc/ssmtp/ssmtp.conf if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password $SMTP_AUTH_PASS"; fi
echo "logfile /var/log/msmtp.log"
echo "aliases /etc/aliases"
} >/etc/msmtprc
echo "Setup finished" echo "Setup finished"
fi fi
} }
setup_msmtp
# just check if we execute apache or php-fpm # just check if we execute apache or php-fpm
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
installed_version="0.0.0.0" installed_version="0.0.0.0"
@ -65,8 +70,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
exit 1 exit 1
fi fi
setup_ssmtp
# check it just in case the version is greater or if we force the upgrade # check it just in case the version is greater or if we force the upgrade
if version_greater "$image_version" "$installed_version" || [ "${FRIENDICA_UPGRADE:-false}" = "true" ]; then if version_greater "$image_version" "$installed_version" || [ "${FRIENDICA_UPGRADE:-false}" = "true" ]; then
echo "Initializing Friendica $image_version ..." echo "Initializing Friendica $image_version ..."

View file

@ -10,7 +10,7 @@ RUN set -ex; \
bzip2 \ bzip2 \
git \ git \
# For mail() support # For mail() support
ssmtp \ msmtp \
# For tini installation # For tini installation
gnupg dirmngr \ gnupg dirmngr \
; \ ; \
@ -109,7 +109,7 @@ RUN set -ex; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
\ \
{ \ { \
echo sendmail_path = "/usr/sbin/sendmail -t -i"; \ echo sendmail_path = "/usr/bin/msmtp -t"; \
} > /usr/local/etc/php/conf.d/sendmail.ini; \ } > /usr/local/etc/php/conf.d/sendmail.ini; \
\ \
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \

View file

@ -16,40 +16,45 @@ version_greater() {
[ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ] [ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ]
} }
setup_ssmtp() { setup_msmtp() {
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}" SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..." echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
smtp_from=${SMTP_FROM:-no-reply} smtp_from="${SMTP_FROM:=no-reply}"
# Setup SSMTP # Setup MSMTP
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
# add possible mail-senders # add possible mail-senders
{ {
echo "www-data:$smtp_from@$SMTP_DOMAIN:$SMTP" echo "www-data: $smtp_from@$SMTP_DOMAIN"
echo "root::$smtp_from@$SMTP_DOMAIN:$SMTP" echo "root: $smtp_from@$SMTP_DOMAIN"
} > /etc/ssmtp/revaliases } >/etc/aliases
# replace ssmtp.conf settings # create msmtp settings
{ {
echo "root=:$smtp_from@$SMTP_DOMAIN" echo "account default"
echo "hostname=$SMTP_DOMAIN" echo "host $SMTP_DOMAIN"
echo "mailhub=$SMTP" if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
echo "FromLineOverride=YES" echo "from $smtp_from@$SMTP_DOMAIN"
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user $SMTP_AUTH_USER"; fi
} > /etc/ssmtp/ssmtp.conf if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password $SMTP_AUTH_PASS"; fi
echo "logfile /var/log/msmtp.log"
echo "aliases /etc/aliases"
} >/etc/msmtprc
echo "Setup finished" echo "Setup finished"
fi fi
} }
setup_msmtp
# just check if we execute apache or php-fpm # just check if we execute apache or php-fpm
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
installed_version="0.0.0.0" installed_version="0.0.0.0"
@ -65,8 +70,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
exit 1 exit 1
fi fi
setup_ssmtp
# check it just in case the version is greater or if we force the upgrade # check it just in case the version is greater or if we force the upgrade
if version_greater "$image_version" "$installed_version" || [ "${FRIENDICA_UPGRADE:-false}" = "true" ]; then if version_greater "$image_version" "$installed_version" || [ "${FRIENDICA_UPGRADE:-false}" = "true" ]; then
echo "Initializing Friendica $image_version ..." echo "Initializing Friendica $image_version ..."

View file

@ -10,7 +10,7 @@ RUN set -ex; \
bzip2 \ bzip2 \
git \ git \
# For mail() support # For mail() support
ssmtp \ msmtp \
# For tini installation # For tini installation
gnupg dirmngr \ gnupg dirmngr \
; \ ; \
@ -109,7 +109,7 @@ RUN set -ex; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
\ \
{ \ { \
echo sendmail_path = "/usr/sbin/sendmail -t -i"; \ echo sendmail_path = "/usr/bin/msmtp -t"; \
} > /usr/local/etc/php/conf.d/sendmail.ini; \ } > /usr/local/etc/php/conf.d/sendmail.ini; \
\ \
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \

View file

@ -16,40 +16,45 @@ version_greater() {
[ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ] [ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ]
} }
setup_ssmtp() { setup_msmtp() {
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}" SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..." echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
smtp_from=${SMTP_FROM:-no-reply} smtp_from="${SMTP_FROM:=no-reply}"
# Setup SSMTP # Setup MSMTP
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
# add possible mail-senders # add possible mail-senders
{ {
echo "www-data:$smtp_from@$SMTP_DOMAIN:$SMTP" echo "www-data: $smtp_from@$SMTP_DOMAIN"
echo "root::$smtp_from@$SMTP_DOMAIN:$SMTP" echo "root: $smtp_from@$SMTP_DOMAIN"
} > /etc/ssmtp/revaliases } >/etc/aliases
# replace ssmtp.conf settings # create msmtp settings
{ {
echo "root=:$smtp_from@$SMTP_DOMAIN" echo "account default"
echo "hostname=$SMTP_DOMAIN" echo "host $SMTP_DOMAIN"
echo "mailhub=$SMTP" if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
echo "FromLineOverride=YES" echo "from $smtp_from@$SMTP_DOMAIN"
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user $SMTP_AUTH_USER"; fi
} > /etc/ssmtp/ssmtp.conf if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password $SMTP_AUTH_PASS"; fi
echo "logfile /var/log/msmtp.log"
echo "aliases /etc/aliases"
} >/etc/msmtprc
echo "Setup finished" echo "Setup finished"
fi fi
} }
setup_msmtp
# just check if we execute apache or php-fpm # just check if we execute apache or php-fpm
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
installed_version="0.0.0.0" installed_version="0.0.0.0"
@ -65,8 +70,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
exit 1 exit 1
fi fi
setup_ssmtp
# check it just in case the version is greater or if we force the upgrade # check it just in case the version is greater or if we force the upgrade
if version_greater "$image_version" "$installed_version" || [ "${FRIENDICA_UPGRADE:-false}" = "true" ]; then if version_greater "$image_version" "$installed_version" || [ "${FRIENDICA_UPGRADE:-false}" = "true" ]; then
echo "Initializing Friendica $image_version ..." echo "Initializing Friendica $image_version ..."

View file

@ -7,7 +7,7 @@ RUN set -ex; \
rsync \ rsync \
git \ git \
# For mail() support # For mail() support
ssmtp \ msmtp \
shadow \ shadow \
tini; tini;
@ -84,7 +84,7 @@ RUN set -ex; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
\ \
{ \ { \
echo sendmail_path = "/usr/sbin/sendmail -t -i"; \ echo sendmail_path = "/usr/bin/msmtp -t"; \
} > /usr/local/etc/php/conf.d/sendmail.ini; \ } > /usr/local/etc/php/conf.d/sendmail.ini; \
\ \
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \

View file

@ -16,40 +16,45 @@ version_greater() {
[ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ] [ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ]
} }
setup_ssmtp() { setup_msmtp() {
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}" SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..." echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
smtp_from=${SMTP_FROM:-no-reply} smtp_from="${SMTP_FROM:=no-reply}"
# Setup SSMTP # Setup MSMTP
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
# add possible mail-senders # add possible mail-senders
{ {
echo "www-data:$smtp_from@$SMTP_DOMAIN:$SMTP" echo "www-data: $smtp_from@$SMTP_DOMAIN"
echo "root::$smtp_from@$SMTP_DOMAIN:$SMTP" echo "root: $smtp_from@$SMTP_DOMAIN"
} > /etc/ssmtp/revaliases } >/etc/aliases
# replace ssmtp.conf settings # create msmtp settings
{ {
echo "root=:$smtp_from@$SMTP_DOMAIN" echo "account default"
echo "hostname=$SMTP_DOMAIN" echo "host $SMTP_DOMAIN"
echo "mailhub=$SMTP" if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
echo "FromLineOverride=YES" echo "from $smtp_from@$SMTP_DOMAIN"
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user $SMTP_AUTH_USER"; fi
} > /etc/ssmtp/ssmtp.conf if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password $SMTP_AUTH_PASS"; fi
echo "logfile /var/log/msmtp.log"
echo "aliases /etc/aliases"
} >/etc/msmtprc
echo "Setup finished" echo "Setup finished"
fi fi
} }
setup_msmtp
# just check if we execute apache or php-fpm # just check if we execute apache or php-fpm
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
installed_version="0.0.0.0" installed_version="0.0.0.0"
@ -65,8 +70,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
exit 1 exit 1
fi fi
setup_ssmtp
# check it just in case the version is greater or if we force the upgrade # check it just in case the version is greater or if we force the upgrade
if version_greater "$image_version" "$installed_version" || [ "${FRIENDICA_UPGRADE:-false}" = "true" ]; then if version_greater "$image_version" "$installed_version" || [ "${FRIENDICA_UPGRADE:-false}" = "true" ]; then
echo "Initializing Friendica $image_version ..." echo "Initializing Friendica $image_version ..."

View file

@ -10,7 +10,7 @@ RUN set -ex; \
bzip2 \ bzip2 \
git \ git \
# For mail() support # For mail() support
ssmtp \ msmtp \
# For tini installation # For tini installation
gnupg dirmngr \ gnupg dirmngr \
; \ ; \
@ -109,7 +109,7 @@ RUN set -ex; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
\ \
{ \ { \
echo sendmail_path = "/usr/sbin/sendmail -t -i"; \ echo sendmail_path = "/usr/bin/msmtp -t"; \
} > /usr/local/etc/php/conf.d/sendmail.ini; \ } > /usr/local/etc/php/conf.d/sendmail.ini; \
\ \
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \

View file

@ -16,40 +16,45 @@ version_greater() {
[ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ] [ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ]
} }
setup_ssmtp() { setup_msmtp() {
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}" SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..." echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
smtp_from=${SMTP_FROM:-no-reply} smtp_from="${SMTP_FROM:=no-reply}"
# Setup SSMTP # Setup MSMTP
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
# add possible mail-senders # add possible mail-senders
{ {
echo "www-data:$smtp_from@$SMTP_DOMAIN:$SMTP" echo "www-data: $smtp_from@$SMTP_DOMAIN"
echo "root::$smtp_from@$SMTP_DOMAIN:$SMTP" echo "root: $smtp_from@$SMTP_DOMAIN"
} > /etc/ssmtp/revaliases } >/etc/aliases
# replace ssmtp.conf settings # create msmtp settings
{ {
echo "root=:$smtp_from@$SMTP_DOMAIN" echo "account default"
echo "hostname=$SMTP_DOMAIN" echo "host $SMTP_DOMAIN"
echo "mailhub=$SMTP" if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
echo "FromLineOverride=YES" echo "from $smtp_from@$SMTP_DOMAIN"
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user $SMTP_AUTH_USER"; fi
} > /etc/ssmtp/ssmtp.conf if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password $SMTP_AUTH_PASS"; fi
echo "logfile /var/log/msmtp.log"
echo "aliases /etc/aliases"
} >/etc/msmtprc
echo "Setup finished" echo "Setup finished"
fi fi
} }
setup_msmtp
# just check if we execute apache or php-fpm # just check if we execute apache or php-fpm
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
installed_version="0.0.0.0" installed_version="0.0.0.0"
@ -65,8 +70,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
exit 1 exit 1
fi fi
setup_ssmtp
# check it just in case the version is greater or if we force the upgrade # check it just in case the version is greater or if we force the upgrade
if version_greater "$image_version" "$installed_version" || [ "${FRIENDICA_UPGRADE:-false}" = "true" ]; then if version_greater "$image_version" "$installed_version" || [ "${FRIENDICA_UPGRADE:-false}" = "true" ]; then
echo "Initializing Friendica $image_version ..." echo "Initializing Friendica $image_version ..."

View file

@ -6,7 +6,7 @@ RUN set -ex; \
rsync \ rsync \
git \ git \
# For mail() support # For mail() support
ssmtp \ msmtp \
shadow \ shadow \
tini; tini;
@ -83,7 +83,7 @@ RUN set -ex; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
\ \
{ \ { \
echo sendmail_path = "/usr/sbin/sendmail -t -i"; \ echo sendmail_path = "/usr/bin/msmtp -t"; \
} > /usr/local/etc/php/conf.d/sendmail.ini; \ } > /usr/local/etc/php/conf.d/sendmail.ini; \
\ \
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \

View file

@ -9,7 +9,7 @@ RUN set -ex; \
bzip2 \ bzip2 \
git \ git \
# For mail() support # For mail() support
ssmtp \ msmtp \
# For tini installation # For tini installation
gnupg dirmngr \ gnupg dirmngr \
; \ ; \
@ -108,7 +108,7 @@ RUN set -ex; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
\ \
{ \ { \
echo sendmail_path = "/usr/sbin/sendmail -t -i"; \ echo sendmail_path = "/usr/bin/msmtp -t"; \
} > /usr/local/etc/php/conf.d/sendmail.ini; \ } > /usr/local/etc/php/conf.d/sendmail.ini; \
\ \
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \

View file

@ -107,13 +107,13 @@ A valid SMTP-MTA would be, for example, `mx.example.org`.
The following environment variables are possible for the SMTP examples. The following environment variables are possible for the SMTP examples.
- `SMTP` Address of the SMTP Mail-Gateway. (**required**) - `SMTP` Address of the SMTP Mail-Gateway. (**required**)
- `SMTP_PORT` Port of the SMTP Mail-Gateway. (Default: 587)
- `SMTP_DOMAIN` The sender domain. (**required** - e.g. `friendica.local`) - `SMTP_DOMAIN` The sender domain. (**required** - e.g. `friendica.local`)
- `SMTP_FROM` Sender user-part of the address. (Default: `no-reply` - e.g. no-reply@friendica.local) - `SMTP_FROM` Sender user-part of the address. (Default: `no-reply` - e.g. no-reply@friendica.local)
- `SMTP_TLS` Use TLS for connecting the SMTP Mail-Gateway. (Default: empty) - `SMTP_TLS` Use TLS for connecting the SMTP Mail-Gateway. (Default: empty)
- `SMTP_STARTTLS` Use STARTTLS for connecting the SMTP Mail-Gateway. (Default: empty) - `SMTP_STARTTLS` Use STARTTLS for connecting the SMTP Mail-Gateway. (Default: empty)
- `SMTP_AUTH_USER` Username for the SMTP Mail-Gateway. (Default: empty) - `SMTP_AUTH_USER` Username for the SMTP Mail-Gateway. (Default: empty)
- `SMTP_AUTH_PASS` Password for the SMTP Mail-Gateway. (Default: empty) - `SMTP_AUTH_PASS` Password for the SMTP Mail-Gateway. (Default: empty)
- `SMTP_AUTH_METHOD` Authentication method for the SMTP Mail-Gateway. (Default: empty/plain text)
## Database settings ## Database settings

View file

@ -16,41 +16,44 @@ version_greater() {
[ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ] [ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ]
} }
setup_ssmtp() { setup_msmtp() {
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}" SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..." echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
smtp_from=${SMTP_FROM:-no-reply} smtp_from="${SMTP_FROM:=no-reply}"
# Setup SSMTP # Setup MSMTP
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
# add possible mail-senders # add possible mail-senders
{ {
echo "www-data:$smtp_from@$SMTP_DOMAIN:$SMTP" echo "www-data: $smtp_from@$SMTP_DOMAIN"
echo "root::$smtp_from@$SMTP_DOMAIN:$SMTP" echo "root: $smtp_from@$SMTP_DOMAIN"
} > /etc/ssmtp/revaliases } >/etc/aliases
# replace ssmtp.conf settings # create msmtp settings
{ {
echo "root=:$smtp_from@$SMTP_DOMAIN" echo "account default"
echo "hostname=$SMTP_DOMAIN" echo "host $SMTP_DOMAIN"
echo "mailhub=$SMTP" if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
echo "FromLineOverride=YES" echo "from $smtp_from@$SMTP_DOMAIN"
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user $SMTP_AUTH_USER"; fi
} > /etc/ssmtp/ssmtp.conf if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password $SMTP_AUTH_PASS"; fi
echo "logfile /var/log/msmtp.log"
echo "aliases /etc/aliases"
} >/etc/msmtprc
echo "Setup finished" echo "Setup finished"
fi fi
} }
setup_ssmtp setup_msmtp
# just check if we execute apache or php-fpm # just check if we execute apache or php-fpm
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then