1
1
Fork 0
mirror of https://github.com/docker-mailserver/docker-mailserver synced 2024-04-18 18:53:54 +02:00

cleaned up >/dev/nulls in Dockerfile and replaced em dashes with normal dashes (#2024)

This commit is contained in:
Georg Lauterbach 2021-06-08 03:20:20 +02:00 committed by GitHub
parent ac450f641f
commit e7b88d865b
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 151 additions and 151 deletions

View File

@ -1,7 +1,7 @@
#
# General
# https://editorconfig.org
#
# -----------------------------------------------
# --- General -----------------------------------
# --- https://editorconfig.org ------------------
# -----------------------------------------------
root = true
@ -12,9 +12,9 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
#
# Specific
#
# -----------------------------------------------
# --- Specific ----------------------------------
# -----------------------------------------------
[*.{yaml,yml,sh,bats}]
indent_size = 2
@ -26,9 +26,9 @@ indent_size = 4
[*.md]
trim_trailing_whitespace = false
#
# Git Submodules
#
# -----------------------------------------------
# --- Git Submodules ----------------------------
# -----------------------------------------------
[{test/bats/**,test/test_helper/**,target/docker-configomat/**}]
indent_style = none

View File

@ -129,11 +129,11 @@ SCRIPT='name_of_this_script.sh'
function __log_err
{
printf "\n \e[1m\e[31mUNCHECKED ERROR\e[0m\n%s\n%s\n%s\n%s\n\n" \
" script = ${SCRIPT:-${0}}" \
" function = ${1} / ${2}" \
" line = ${3}" \
" exit code = ${4}" 1>&2
printf "\n--- \e[1m\e[31mUNCHECKED ERROR\e[0m\n%s\n%s\n%s\n%s\n\n" \
" - script = ${SCRIPT:-${0}}" \
" - function = ${1} / ${2}" \
" - line = ${3}" \
" - exit code = ${4}" 1>&2
<CODE TO RUN AFTERWARDS>
}

View File

@ -34,16 +34,16 @@ ENV VIRUSMAILS_DELETE_DELAY=7
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
#
# Install Basic Software
#
# -----------------------------------------------
# --- Install Basic Software --------------------
# -----------------------------------------------
RUN \
apt-get -qq update && \
apt-get -y install apt-utils &>/dev/null && \
apt-get -y dist-upgrade >/dev/null && \
apt-get -y install postfix >/dev/null && \
apt-get -y --no-install-recommends install \
apt-get -y -qq install apt-utils && \
apt-get -y -qq dist-upgrade && \
apt-get -y -q install postfix && \
apt-get -y -q --no-install-recommends install \
# A - D
altermime amavisd-new apt-transport-https arj binutils bzip2 bsd-mailx \
ca-certificates cabextract clamav clamav-daemon cpio curl \
@ -62,28 +62,28 @@ RUN \
unrar-free unzip whois xz-utils && \
# Fail2Ban
gpg --keyserver ${FAIL2BAN_GPG_PUBLIC_KEY_SERVER} \
--recv-keys ${FAIL2BAN_GPG_PUBLIC_KEY_ID} &>/dev/null && \
--recv-keys ${FAIL2BAN_GPG_PUBLIC_KEY_ID} 2>&1 && \
curl -Lkso fail2ban.deb ${FAIL2BAN_DEB_URL} && \
curl -Lkso fail2ban.deb.asc ${FAIL2BAN_DEB_ASC_URL} && \
FINGERPRINT="$(LANG=C gpg --verify \
fail2ban.deb.asc fail2ban.deb 2>&1 \
| sed -n 's#Primary key fingerprint: \(.*\)#\1#p')" && \
if [[ -z ${FINGERPRINT} ]]; then \
echo "ERROR: Invalid GPG signature!" 2>&1; exit 1; fi && \
echo "ERROR: Invalid GPG signature!" >&2; exit 1; fi && \
if [[ ${FINGERPRINT} != "${FAIL2BAN_GPG_FINGERPRINT}" ]]; then \
echo "ERROR: Wrong GPG fingerprint!" 2>&1; exit 1; fi && \
dpkg -i fail2ban.deb &>/dev/null && \
echo "ERROR: Wrong GPG fingerprint!" >&2; exit 1; fi && \
dpkg -i fail2ban.deb 2>&1 && \
rm fail2ban.deb fail2ban.deb.asc && \
# cleanup
apt-get -qq autoremove &>/dev/null && \
apt-get -qq autoremove && \
apt-get -qq autoclean && \
apt-get -qq clean && \
rm -rf /var/lib/apt/lists/* && \
c_rehash &>/dev/null
c_rehash 2>&1
#
# ClamAV & FeshClam
#
# -----------------------------------------------
# --- ClamAV & FeshClam -------------------------
# -----------------------------------------------
RUN \
echo '0 */6 * * * clamav /usr/bin/freshclam --quiet' >/etc/cron.d/clamav-freshclam && \
@ -94,9 +94,9 @@ RUN \
chown -R clamav:root /var/run/clamav && \
rm -rf /var/log/clamav/
#
# Dovecot & MkCert
#
# -----------------------------------------------
# --- Dovecot & MkCert --------------------------
# -----------------------------------------------
COPY target/dovecot/auth-passwdfile.inc target/dovecot/??-*.conf /etc/dovecot/conf.d/
COPY target/dovecot/sieve/ /etc/dovecot/sieve/
@ -119,13 +119,13 @@ RUN \
sed -i 's/RANDFILE.*//g' /usr/share/dovecot/dovecot-openssl.cnf && \
mkdir /etc/dovecot/ssl && \
chmod 755 /etc/dovecot/ssl && \
./mkcert.sh 2>&1 >/dev/null && \
./mkcert.sh 2>&1 && \
mkdir -p /usr/lib/dovecot/sieve-pipe /usr/lib/dovecot/sieve-filter /usr/lib/dovecot/sieve-global && \
chmod 755 -R /usr/lib/dovecot/sieve-pipe /usr/lib/dovecot/sieve-filter /usr/lib/dovecot/sieve-global
#
# LDAP & SpamAssassin's Cron
#
# -----------------------------------------------
# --- LDAP & SpamAssassin's Cron ----------------
# -----------------------------------------------
COPY target/dovecot/dovecot-ldap.conf.ext /etc/dovecot
COPY \
@ -141,9 +141,9 @@ RUN \
sed -i -r 's/^(CRON)=0/\1=1/g' /etc/default/spamassassin && \
sed -i -r 's/^\$INIT restart/supervisorctl restart amavis/g' /etc/spamassassin/sa-update-hooks.d/amavisd-new
#
# Scripts & Miscellaneous
#
# -----------------------------------------------
# --- Scripts & Miscellaneous -------------------
# -----------------------------------------------
COPY \
./target/bin/* \
@ -165,9 +165,9 @@ RUN \
rm /etc/postsrsd.secret && \
rm /etc/cron.daily/00logwatch
#
# PostSRSD, Postgrey & Amavis
#
# -----------------------------------------------
# --- PostSRSD, Postgrey & Amavis ---------------
# -----------------------------------------------
COPY target/postsrsd/postsrsd /etc/default/postsrsd
COPY target/postgrey/postgrey /etc/default/postgrey
@ -180,23 +180,23 @@ RUN \
COPY target/amavis/conf.d/* /etc/amavis/conf.d/
RUN \
sed -i -r 's/#(@| \\%)bypass/\1bypass/g' /etc/amavis/conf.d/15-content_filter_mode && \
adduser clamav amavis >/dev/null && \
adduser amavis clamav >/dev/null && \
adduser clamav amavis && \
adduser amavis clamav && \
# no syslog user in Debian compared to Ubuntu
adduser --system syslog >/dev/null && \
useradd -u 5000 -d /home/docker -s /bin/bash -p "$(echo docker | openssl passwd -1 -stdin)" docker >/dev/null && \
adduser --system syslog && \
useradd -u 5000 -d /home/docker -s /bin/bash -p "$(echo docker | openssl passwd -1 -stdin)" docker && \
echo "0 4 * * * /usr/local/bin/virus-wiper" | crontab - && \
chmod 644 /etc/amavis/conf.d/*
# overcomplication necessary for CI
RUN \
for _ in {1..10}; do su - amavis -c "razor-admin -create" ; sleep 3 ; \
if su - amavis -c "razor-admin -register" &>/dev/null; then { EC=0 ; break ; } ; \
if su - amavis -c "razor-admin -register" ; then { EC=0 ; break ; } ; \
else EC=${?} ; fi ; done ; (exit ${EC})
#
# Fail2Ban, DKIM & DMARC
#
# -----------------------------------------------
# --- Fail2Ban, DKIM & DMARC --------------------
# -----------------------------------------------
COPY target/fail2ban/jail.local /etc/fail2ban/jail.local
RUN \
@ -217,9 +217,9 @@ RUN \
update-alternatives --set iptables /usr/sbin/iptables-legacy && \
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
#
# Fetchmail, Postfix & Let'sEncrypt
#
# -----------------------------------------------
# --- Fetchmail, Postfix & Let'sEncrypt ---------
# -----------------------------------------------
COPY target/fetchmail/fetchmailrc /etc/fetchmailrc_general
COPY target/postfix/main.cf target/postfix/master.cf /etc/postfix/
@ -236,9 +236,9 @@ RUN \
mkdir /var/run/fetchmail && chown fetchmail /var/run/fetchmail && \
curl -s https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem >/etc/ssl/certs/lets-encrypt-x3-cross-signed.pem
#
# Logs
#
# -----------------------------------------------
# --- Logs --------------------------------------
# -----------------------------------------------
RUN \
sed -i -r "/^#?compress/c\compress\ncopytruncate" /etc/logrotate.conf && \
@ -266,9 +266,9 @@ RUN \
# prevent email when /sbin/init or init system is not existing
sed -i -e 's|invoke-rc.d rsyslog rotate > /dev/null|/usr/bin/supervisorctl signal hup rsyslog >/dev/null|g' /usr/lib/rsyslog/rsyslog-rotate
#
# Supervisord & Start
#
# -----------------------------------------------
# --- Supervisord & Start -----------------------
# -----------------------------------------------
COPY target/supervisor/supervisord.conf /etc/supervisor/supervisord.conf
COPY target/supervisor/conf.d/* /etc/supervisor/conf.d/

View File

@ -6,9 +6,9 @@ VCS_VER = $(shell git describe --tags --contains --always)
export CDIR = $(shell pwd)
#
# Generic Build Targets
#
# -----------------------------------------------
# --- Generic Build Targets ---------------------
# -----------------------------------------------
all: lint build backup generate-accounts tests clean
@ -28,9 +28,9 @@ clean:
-@ for container in $$(docker ps -a | grep -E "mail|ldap_for_mail|mail_overri.*|hadolint|eclint|shellcheck" | cut -f 1-1 -d ' '); do docker rm -f $$container; done
-@ sudo rm -rf test/onedir test/alias test/quota test/relay test/config/dovecot-lmtp/userdb test/config/key* test/config/opendkim/keys/domain.tld/ test/config/opendkim/keys/example.com/ test/config/opendkim/keys/localdomain2.com/ test/config/postfix-aliases.cf test/config/postfix-receive-access.cf test/config/postfix-receive-access.cfe test/config/dovecot-quotas.cf test/config/postfix-send-access.cf test/config/postfix-send-access.cfe test/config/relay-hosts/chksum test/config/relay-hosts/postfix-aliases.cf test/config/dhparams.pem test/config/dovecot-lmtp/dh.pem test/config/relay-hosts/dovecot-quotas.cf test/config/user-patches.sh test/alias/config/postfix-virtual.cf test/quota/config/dovecot-quotas.cf test/quota/config/postfix-accounts.cf test/relay/config/postfix-relaymap.cf test/relay/config/postfix-sasl-password.cf test/duplicate_configs/
#
# Tests
#
# -----------------------------------------------
# --- Tests -------------------------------------
# -----------------------------------------------
generate-accounts:
@ docker run --rm -e MAIL_USER=user1@localhost.localdomain -e MAIL_PASS=mypassword -t $(NAME) /bin/sh -c 'echo "$$MAIL_USER|$$(doveadm pw -s SHA512-CRYPT -u $$MAIL_USER -p $$MAIL_PASS)"' > test/config/postfix-accounts.cf

View File

@ -93,11 +93,11 @@ SCRIPT='name_of_this_script.sh'
function __log_err
{
printf "\n \e[1m\e[31mUNCHECKED ERROR\e[0m\n%s\n%s\n%s\n%s\n\n" \
" script = ${SCRIPT:-${0}}" \
" function = ${1} / ${2}" \
" line = ${3}" \
" exit code = ${4}" 1>&2
printf "\n--- \e[1m\e[31mUNCHECKED ERROR\e[0m\n%s\n%s\n%s\n%s\n\n" \
" - script = ${SCRIPT:-${0}}" \
" - function = ${1} / ${2}" \
" - line = ${3}" \
" - exit code = ${4}" 1>&2
<CODE TO RUN AFTERWARDS>
}

View File

@ -1,13 +1,13 @@
#
# Mailserver Environment Variables
#
# -----------------------------------------------
# --- Mailserver Environment Variables ----------
# -----------------------------------------------
# DOCUMENTATION FOR THESE VARIABLES IS FOUND UNDER
# https://docker-mailserver.github.io/docker-mailserver/edge/config/environment/
#
# General Section
#
# -----------------------------------------------
# --- General Section ---------------------------
# -----------------------------------------------
# empty => uses the `hostname` command to get the mail server's canonical hostname
# => Specify a fully-qualified domainname to serve mail for. This is used for many of the config features so if you can't set your hostname (e.g. you're in a container platform that doesn't let you) specify it in this environment variable.
@ -227,9 +227,9 @@ REPORT_INTERVAL=daily
# Note: More details in http://www.postfix.org/postconf.5.html#inet_protocols
POSTFIX_INET_PROTOCOLS=all
#
# SpamAssassin Section
#
# -----------------------------------------------
# --- SpamAssassin Section ----------------------
# -----------------------------------------------
ENABLE_SPAMASSASSIN=0
@ -251,18 +251,18 @@ SA_KILL=6.31
# add tag to subject if spam detected
SA_SPAM_SUBJECT=***SPAM*****
#
# Fetchmail Section
#
# -----------------------------------------------
# --- Fetchmail Section -------------------------
# -----------------------------------------------
ENABLE_FETCHMAIL=0
# The interval to fetch mail in seconds
FETCHMAIL_POLL=300
#
# LDAP Section
#
# -----------------------------------------------
# --- LDAP Section ------------------------------
# -----------------------------------------------
# A second container for the ldap service is necessary (i.e. https://github.com/osixia/docker-openldap)
# For preparing the ldap server to use in combination with this container this article may be helpful: http://acidx.net/wordpress/2014/06/installing-a-mailserver-with-postfix-dovecot-sasl-ldap-roundcube/
@ -308,9 +308,9 @@ LDAP_QUERY_FILTER_ALIAS=
# => Specify how ldap should be asked for domains
LDAP_QUERY_FILTER_DOMAIN=
#
# Dovecot Section
#
# -----------------------------------------------
# --- Dovecot Section ---------------------------
# -----------------------------------------------
# empty => no
# yes => LDAP over TLS enabled for Dovecot
@ -331,9 +331,9 @@ DOVECOT_MAILBOX_FORMAT=maildir
# https://wiki.dovecot.org/AuthDatabase/LDAP/AuthBinds
DOVECOT_AUTH_BIND=
#
# Postgrey Section
#
# -----------------------------------------------
# --- Postgrey Section --------------------------
# -----------------------------------------------
ENABLE_POSTGREY=0
# greylist for N seconds
@ -345,9 +345,9 @@ POSTGREY_TEXT=Delayed by Postgrey
# whitelist host after N successful deliveries (N=0 to disable whitelisting)
POSTGREY_AUTO_WHITELIST_CLIENTS=5
#
# SASL Section
#
# -----------------------------------------------
# --- SASL Section ------------------------------
# -----------------------------------------------
ENABLE_SASLAUTHD=0
@ -424,9 +424,9 @@ SASLAUTHD_LDAP_AUTH_METHOD=
# Any value => Fills the `ldap_mech` option
SASLAUTHD_LDAP_MECH=
#
# SRS Section
#
# -----------------------------------------------
# --- SRS Section -------------------------------
# -----------------------------------------------
# envelope_sender => Rewrite only envelope sender address (default)
# header_sender => Rewrite only header sender (not recommended)
@ -447,9 +447,9 @@ SRS_EXCLUDE_DOMAINS=
# rotate and expire keys
SRS_SECRET=
#
# Default Relay Host Section
#
# -----------------------------------------------
# --- Default Relay Host Section ----------------
# -----------------------------------------------
# Setup relaying all mail through a default relay host
#
@ -457,9 +457,9 @@ SRS_SECRET=
# default host and optional port to relay all mail through
DEFAULT_RELAY_HOST=
#
# Multi-Domain Relay Section
#
# -----------------------------------------------
# --- Multi-Domain Relay Section ----------------
# -----------------------------------------------
# Setup relaying for multiple domains based on the domain name of the sender
# optionally uses usernames and passwords in postfix-sasl-password.cf and relay host mappings in postfix-relaymap.cf

View File

@ -22,11 +22,11 @@ trap '__log_err "${FUNCNAME[0]:-?}" "${BASH_COMMAND:-?}" "${LINENO:-?}" "${?:-?}
function __log_err
{
printf "\n ${BOLD}${RED}UNCHECKED ERROR${RESET}\n%s\n%s\n%s\n%s\n\n" \
" script = ${SCRIPT:-${0}}" \
" function = ${1} / ${2}" \
" line = ${3}" \
" exit code = ${4}" >&2
printf "\n--- ${BOLD}${RED}UNCHECKED ERROR${RESET}\n%s\n%s\n%s\n%s\n\n" \
" - script = ${SCRIPT:-${0}}" \
" - function = ${1} / ${2}" \
" - line = ${3}" \
" - exit code = ${4}" >&2
printf "Make sure you use a version of this script that matches
the version / tag of docker-mailserver. Please read the

View File

@ -6,7 +6,7 @@
LOG_DATE=$(date +"%Y-%m-%d %H:%M:%S ")
_notify 'task' "${LOG_DATE} Start check-for-changes script."
# ? Checks
# ? --------------------------------------------- Checks
cd /tmp/docker-mailserver || exit 1
@ -24,7 +24,7 @@ then
exit 0
fi
# ? Actual script begins
# ? --------------------------------------------- Actual script begins
# determine postmaster address, duplicated from start-mailserver.sh
# this script previously didn't work when POSTMASTER_ADDRESS was empty

View File

@ -2,7 +2,7 @@
DMS_DEBUG="${DMS_DEBUG:=0}"
# ? BIN HELPER
# ? --------------------------------------------- BIN HELPER
function errex
{
@ -15,7 +15,7 @@ function escape
echo "${1//./\\.}"
}
# ? IP & CIDR
# ? --------------------------------------------- IP & CIDR
function _mask_ip_digit
{
@ -57,7 +57,7 @@ function _sanitize_ipv4_to_subnet_cidr
}
export -f _sanitize_ipv4_to_subnet_cidr
# ? ACME
# ? --------------------------------------------- ACME
function _extract_certs_from_acme
{
@ -106,7 +106,7 @@ for key, value in acme.items():
}
export -f _extract_certs_from_acme
# ? Notifications
# ? --------------------------------------------- Notifications
function _notify
{
@ -132,7 +132,7 @@ function _notify
}
export -f _notify
# ? Relay Host Map
# ? --------------------------------------------- Relay Host Map
# setup /etc/postfix/relayhost_map
# --
@ -170,7 +170,7 @@ function _populate_relayhost_map
}
export -f _populate_relayhost_map
# ? File Checksums
# ? --------------------------------------------- File Checksums
# file storing the checksums of the monitored files.
# shellcheck disable=SC2034

View File

@ -10,11 +10,11 @@ unset DAEMONS_START HOSTNAME DOMAINNAME CHKSUM_FILE
declare -A VARS
declare -a FUNCS_SETUP FUNCS_FIX FUNCS_CHECK FUNCS_MISC DAEMONS_START
#
# ------------------------------------------------------------
# ? <<
#
# --
# ? >> Setup of default and global values / variables
#
# ------------------------------------------------------------
VARS[AMAVIS_LOGLEVEL]="${AMAVIS_LOGLEVEL:=0}"
VARS[DEFAULT_RELAY_HOST]="${DEFAULT_RELAY_HOST:=}"
@ -71,11 +71,11 @@ HOSTNAME="$(hostname -f)"
DOMAINNAME="$(hostname -d)"
CHKSUM_FILE=/tmp/docker-mailserver-config-chksum
#
# ------------------------------------------------------------
# ? << Setup of default and global values / variables
#
# --
# ? >> Registering functions
#
# ------------------------------------------------------------
function register_functions
{
@ -223,16 +223,16 @@ function _defunc
exit 1
}
#
# ------------------------------------------------------------
# ? << Registering functions
#
# --
# ? >> Sourcing all stacks
# 1. Checks
# 2. Setup
# 3. Fixes
# 4. Miscellaneous
# 5. Daemons
#
# ------------------------------------------------------------
# shellcheck source=./startup/check-stack.sh
. /usr/local/bin/check-stack.sh
@ -249,11 +249,11 @@ function _defunc
# shellcheck source=./startup/daemons-stack.sh
. /usr/local/bin/daemons-stack.sh
#
# ------------------------------------------------------------
# ? << Sourcing all stacks
#
# --
# ? >> Executing all stacks
#
# ------------------------------------------------------------
_notify 'tasklog' "Welcome to docker-mailserver $(</VERSION)"
_notify 'inf' 'ENVIRONMENT'

View File

@ -18,35 +18,35 @@ trap '__log_err "${FUNCNAME[0]:-?}" "${BASH_COMMAND:-?}" ${LINENO:-?} ${?:-?}' E
function __log_err
{
printf "\n \e[1m\e[31mUNCHECKED ERROR\e[0m\n%s\n%s\n%s\n%s\n\n" \
" script = ${SCRIPT:-${0}}" \
" function = ${1} / ${2}" \
" line = ${3}" \
" exit code = ${4}"
printf "\n--- \e[1m\e[31mUNCHECKED ERROR\e[0m\n%s\n%s\n%s\n%s\n\n" \
" - script = ${SCRIPT:-${0}}" \
" - function = ${1} / ${2}" \
" - line = ${3}" \
" - exit code = ${4}"
}
function __log_info
{
printf "\n \e[34m%s\e[0m\n%s\n%s\n\n" \
printf "\n--- \e[34m%s\e[0m\n%s\n%s\n\n" \
"${SCRIPT:-${0}}" \
" type = INFO" \
" version = ${*}"
" - type = INFO" \
" - version = ${*}"
}
function __log_failure
{
printf "\n \e[91m%s\e[0m\n%s\n%s\n\n" \
printf "\n--- \e[91m%s\e[0m\n%s\n%s\n\n" \
"${SCRIPT:-${0}}" \
" type = FAILURE" \
" message = ${*:-errors encountered}"
" - type = FAILURE" \
" - message = ${*:-errors encountered}"
}
function __log_success
{
printf "\n \e[32m%s\e[0m\n%s\n%s\n\n" \
printf "\n--- \e[32m%s\e[0m\n%s\n%s\n\n" \
"${SCRIPT}" \
" type = SUCCESS" \
" message = no errors detected"
" - type = SUCCESS" \
" - message = no errors detected"
}
function __in_path

View File

@ -41,9 +41,9 @@ function teardown_file
docker rm -f "${CONTAINER_NAME}"
}
#
# Actual Tests
#
# -----------------------------------------------
# --- Actual Tests ------------------------------
# -----------------------------------------------
@test "${TEST_FILE}/etc/opendkim/KeyTable should contain 2 entries" {
run docker exec "${CONTAINER_NAME}" /bin/bash -c "cat /etc/opendkim/KeyTable | wc -l"
@ -400,7 +400,7 @@ function teardown_file
"grep 'domain1.tld' /etc/opendkim/KeyTable | wc -l"
assert_success
assert_output 1
# Check valid entries actually present in SigningTable
run docker run --rm \
-v "${PRIVATE_CONFIG}/with-selector/opendkim":/etc/opendkim \

View File

@ -935,9 +935,9 @@ EOF
assert_output "passdb: pass@localhost.localdomain auth succeeded"
}
#
# setup.sh
#
# -----------------------------------------------
# --- setup.sh ----------------------------------
# -----------------------------------------------
@test "setup.sh :: exit with error when no arguments provided" {
run ./setup.sh