Bump mail server to 10.1.2

pull/4/head
Davide Polonio 2021-09-20 08:21:30 +00:00
parent fc2c232fd2
commit 84f0d3dab4
2 changed files with 67 additions and 71 deletions

View File

@ -2,7 +2,7 @@
version: '3.7'
services:
mail:
image: mailserver/docker-mailserver:9.1.0
image: mailserver/docker-mailserver:10.1.2
hostname: ${HOSTNAME}
domainname: ${DOMAINNAME}
container_name: ${CONTAINER_NAME}

View File

@ -19,15 +19,14 @@ RESET="\e[0m"
set -euEo pipefail
trap '__log_err "${FUNCNAME[0]:-?}" "${BASH_COMMAND:-?}" "${LINENO:-?}" "${?:-?}"' ERR
trap '_unset_vars || :' EXIT
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
@ -35,39 +34,38 @@ the version / tag of docker-mailserver. Please read the
ly and use ./setup.sh help and read the VERSION section.\n" >&2
}
function _unset_vars
function _get_absolute_script_directory
{
unset CDIR CRI INFO IMAGE_NAME CONTAINER_NAME DEFAULT_CONFIG_PATH
unset USE_CONTAINER WISHED_CONFIG_PATH CONFIG_PATH VOLUME USE_TTY
unset SCRIPT USING_SELINUX
if [[ "$(uname)" == "Darwin" ]]
then
readlink() {
greadlink "${@:+$@}" # Requires coreutils
}
function _get_current_directory
{
fi
if dirname "$(readlink -f "${0}")" &>/dev/null
then
CDIR="$(dirname "$(readlink -f "${0}")")"
DIR="$(dirname "$(readlink -f "${0}")")"
elif realpath -e -L "${0}" &>/dev/null
then
CDIR="$(realpath -e -L "${0}")"
CDIR="${CDIR%/setup.sh}"
DIR="$(realpath -e -L "${0}")"
DIR="${DIR%/setup.sh}"
fi
}
CDIR="$(pwd)"
_get_current_directory
DIR="$(pwd)"
_get_absolute_script_directory
CRI=
INFO=
IMAGE_NAME=
CONTAINER_NAME=
DEFAULT_CONFIG_PATH="${CDIR}/config"
USE_CONTAINER=false
WISHED_CONFIG_PATH=
CONFIG_PATH=
VOLUME=
CONTAINER_NAME=
DEFAULT_CONFIG_PATH="${DIR}/config"
IMAGE_NAME=
INFO=
USE_CONTAINER=false
USE_TTY=
USING_SELINUX=
USE_SELINUX=
VOLUME=
WISHED_CONFIG_PATH=
function _check_root
{
@ -158,7 +156,7 @@ ${ORANGE}OPTIONS${RESET}
-p PATH
Provides the config folder path. The default is
${WHITE}${CDIR}/config/${RESET}
${WHITE}${DIR}/config/${RESET}
${LBLUE}SELinux${RESET}
-z
@ -171,36 +169,35 @@ ${ORANGE}OPTIONS${RESET}
${RED}[${ORANGE}SUB${RED}]${ORANGE}COMMANDS${RESET}
${LBLUE}COMMAND${RESET} email ${RED}:=${RESET}
${0} email add <EMAIL ADDRESS> [<PASSWORD>]
${0} email update <EMAIL ADDRESS> [<PASSWORD>]
${0} email del [ OPTIONS${RED}...${RESET} ] <EMAIL ADDRESS> [ <EMAIL ADDRESS>${RED}...${RESET} ]
${0} email restrict <add${RED}|${RESET}del${RED}|${RESET}list> <send${RED}|${RESET}receive> [<EMAIL ADDRESS>]
${0} email list
${0} email ${CYAN}add${RESET} <EMAIL ADDRESS> [<PASSWORD>]
${0} email ${CYAN}update${RESET} <EMAIL ADDRESS> [<PASSWORD>]
${0} email ${CYAN}del${RESET} [ OPTIONS${RED}...${RESET} ] <EMAIL ADDRESS> [ <EMAIL ADDRESS>${RED}...${RESET} ]
${0} email ${CYAN}restrict${RESET} <add${RED}|${RESET}del${RED}|${RESET}list> <send${RED}|${RESET}receive> [<EMAIL ADDRESS>]
${0} email ${CYAN}list${RESET}
${LBLUE}COMMAND${RESET} alias ${RED}:=${RESET}
${0} alias add <EMAIL ADDRESS> <RECIPIENT>
${0} alias del <EMAIL ADDRESS> <RECIPIENT>
${0} alias list
${0} alias ${CYAN}add${RESET} <EMAIL ADDRESS> <RECIPIENT>
${0} alias ${CYAN}del${RESET} <EMAIL ADDRESS> <RECIPIENT>
${0} alias ${CYAN}list${RESET}
${LBLUE}COMMAND${RESET} quota ${RED}:=${RESET}
${0} quota set <EMAIL ADDRESS> [<QUOTA>]
${0} quota del <EMAIL ADDRESS>
${0} quota ${CYAN}set${RESET} <EMAIL ADDRESS> [<QUOTA>]
${0} quota ${CYAN}del${RESET} <EMAIL ADDRESS>
${LBLUE}COMMAND${RESET} config ${RED}:=${RESET}
${0} config dkim [ ARGUMENTS${RED}...${RESET} ]
${0} config ssl <FQDN> (${CYAN}ATTENTION${RESET}: This is deprecated and will be removed soon.)
${0} config ${CYAN}dkim${RESET} [ ARGUMENTS${RED}...${RESET} ]
${LBLUE}COMMAND${RESET} relay ${RED}:=${RESET}
${0} relay add-domain <DOMAIN> <HOST> [<PORT>]
${0} relay add-auth <DOMAIN> <USERNAME> [<PASSWORD>]
${0} relay exclude-domain <DOMAIN>
${0} relay ${CYAN}add-domain${RESET} <DOMAIN> <HOST> [<PORT>]
${0} relay ${CYAN}add-auth${RESET} <DOMAIN> <USERNAME> [<PASSWORD>]
${0} relay ${CYAN}exclude-domain${RESET} <DOMAIN>
${LBLUE}COMMAND${RESET} debug ${RED}:=${RESET}
${0} debug fetchmail
${0} debug fail2ban [unban <IP>]
${0} debug show-mail-logs
${0} debug inspect
${0} debug login <COMMANDS>
${0} debug ${CYAN}fetchmail${RESET}
${0} debug ${CYAN}fail2ban${RESET} [unban <IP>]
${0} debug ${CYAN}show-mail-logs${RESET}
${0} debug ${CYAN}inspect${RESET}
${0} debug ${CYAN}login${RESET} <COMMANDS>
${ORANGE}EXAMPLES${RESET}
${WHITE}./setup.sh email add test@domain.tld${RESET}
@ -234,7 +231,7 @@ function _docker_image
if ${USE_CONTAINER}
then
# reuse existing container specified on command line
${CRI} exec "${USE_TTY}" "${CONTAINER_NAME}" "${@}"
${CRI} exec "${USE_TTY}" "${CONTAINER_NAME}" "${@:+$@}"
else
# start temporary container with specified image
if ! _docker_image_exists "${IMAGE_NAME}"
@ -244,8 +241,8 @@ function _docker_image
fi
${CRI} run --rm \
-v "${CONFIG_PATH}:/tmp/docker-mailserver${USING_SELINUX}" \
"${USE_TTY}" "${IMAGE_NAME}" "${@}"
-v "${CONFIG_PATH}:/tmp/docker-mailserver${USE_SELINUX}" \
"${USE_TTY}" "${IMAGE_NAME}" "${@:+$@}"
fi
}
@ -253,7 +250,7 @@ function _docker_container
{
if [[ -n ${CONTAINER_NAME} ]]
then
${CRI} exec "${USE_TTY}" "${CONTAINER_NAME}" "${@}"
${CRI} exec "${USE_TTY}" "${CONTAINER_NAME}" "${@:+$@}"
else
echo "The mailserver is not running!"
exit 1
@ -300,8 +297,8 @@ function _main
do
case ${OPT} in
i ) IMAGE_NAME="${OPTARG}" ;;
z ) USING_SELINUX=":z" ;;
Z ) USING_SELINUX=":Z" ;;
z ) USE_SELINUX=":z" ;;
Z ) USE_SELINUX=":Z" ;;
c )
# container specified, connect to running instance
CONTAINER_NAME="${OPTARG}"
@ -311,7 +308,7 @@ function _main
p )
case "${OPTARG}" in
/* ) WISHED_CONFIG_PATH="${OPTARG}" ;;
* ) WISHED_CONFIG_PATH="${CDIR}/${OPTARG}" ;;
* ) WISHED_CONFIG_PATH="${DIR}/${OPTARG}" ;;
esac
if [[ ! -d ${WISHED_CONFIG_PATH} ]]
@ -349,11 +346,11 @@ function _main
email )
case ${2:-} in
add ) shift 2 ; _docker_image addmailuser "${@}" ;;
update ) shift 2 ; _docker_image updatemailuser "${@}" ;;
del ) shift 2 ; _docker_container delmailuser "${@}" ;;
restrict ) shift 2 ; _docker_container restrict-access "${@}" ;;
list ) _docker_image listmailuser ;;
add ) shift 2 ; _docker_image addmailuser "${@:+$@}" ;;
update ) shift 2 ; _docker_image updatemailuser "${@:+$@}" ;;
del ) shift 2 ; _docker_container delmailuser "${@:+$@}" ;;
restrict ) shift 2 ; _docker_container restrict-access "${@:+$@}" ;;
list ) _docker_container listmailuser ;;
* ) _usage ;;
esac
;;
@ -369,25 +366,24 @@ function _main
quota )
case ${2:-} in
set ) shift 2 ; _docker_image setquota "${@}" ;;
del ) shift 2 ; _docker_image delquota "${@}" ;;
set ) shift 2 ; _docker_image setquota "${@:+$@}" ;;
del ) shift 2 ; _docker_image delquota "${@:+$@}" ;;
* ) _usage ;;
esac
;;
config )
case ${2:-} in
dkim ) shift 2 ; _docker_image open-dkim "${@}" ;;
ssl ) shift 2 ; _docker_image generate-ssl-certificate "${1}" ;;
dkim ) shift 2 ; _docker_image open-dkim "${@:+$@}" ;;
* ) _usage ;;
esac
;;
relay )
case ${2:-} in
add-domain ) shift 2 ; _docker_image addrelayhost "${@}" ;;
add-auth ) shift 2 ; _docker_image addsaslpassword "${@}" ;;
exclude-domain ) shift 2 ; _docker_image excluderelaydomain "${@}" ;;
add-domain ) shift 2 ; _docker_image addrelayhost "${@:+$@}" ;;
add-auth ) shift 2 ; _docker_image addsaslpassword "${@:+$@}" ;;
exclude-domain ) shift 2 ; _docker_image excluderelaydomain "${@:+$@}" ;;
* ) _usage ;;
esac
;;
@ -395,7 +391,7 @@ function _main
debug )
case ${2:-} in
fetchmail ) _docker_image debug-fetchmail ;;
fail2ban ) shift 2 ; _docker_container fail2ban "${@}" ;;
fail2ban ) shift 2 ; _docker_container fail2ban "${@:+$@}" ;;
show-mail-logs ) _docker_container cat /var/log/mail/mail.log ;;
inspect ) _inspect ;;
login )
@ -404,7 +400,7 @@ function _main
then
_docker_container /bin/bash
else
_docker_container /bin/bash -c "${@}"
_docker_container /bin/bash -c "${@:+$@}"
fi
;;
* ) _usage ; exit 1 ;;
@ -416,4 +412,4 @@ function _main
esac
}
_main "${@}"
_main "${@:+$@}"