mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
housekeeping
This commit is contained in:
parent
2f840d7da5
commit
ed7106b04d
|
@ -1,2 +1,4 @@
|
||||||
.github
|
.github
|
||||||
|
.git
|
||||||
|
|
||||||
test/
|
test/
|
||||||
|
|
|
@ -58,10 +58,8 @@ When refactoring, writing or altering scripts, that is Shell and Bash scripts, i
|
||||||
When writing a script, provide the version and the script's task. Please use [semantic versioning][semver].
|
When writing a script, provide the version and the script's task. Please use [semantic versioning][semver].
|
||||||
|
|
||||||
``` BASH
|
``` BASH
|
||||||
#!/usr/bin/env bash
|
#! /bin/bash
|
||||||
|
|
||||||
# version 0.1.0
|
|
||||||
#
|
|
||||||
# <TASK DESCRIPTION> -> cut this off
|
# <TASK DESCRIPTION> -> cut this off
|
||||||
# to make it not longer than approx.
|
# to make it not longer than approx.
|
||||||
# 80 cols.
|
# 80 cols.
|
||||||
|
|
20
Makefile
20
Makefile
|
@ -4,23 +4,20 @@ NAME = tvial/docker-mailserver:testing
|
||||||
VCS_REF := $(shell git rev-parse --short HEAD)
|
VCS_REF := $(shell git rev-parse --short HEAD)
|
||||||
VCS_VERSION := $(shell git describe --tags --contains --always)
|
VCS_VERSION := $(shell git describe --tags --contains --always)
|
||||||
|
|
||||||
SLEEP = 15s
|
|
||||||
|
|
||||||
all: build backup generate-accounts tests clean
|
all: build backup generate-accounts tests clean
|
||||||
no-build: backup generate-accounts tests clean
|
no-build: backup generate-accounts tests clean
|
||||||
complete_test: lint build generate-accounts tests
|
complete_test: lint build generate-accounts tests
|
||||||
|
|
||||||
build:
|
build:
|
||||||
docker build \
|
docker build -t $(NAME) . \
|
||||||
--build-arg VCS_REF=$(VCS_REF) \
|
--build-arg VCS_REF=$(VCS_REF) \
|
||||||
--build-arg VCS_VERSION=$(VCS_VERSION) \
|
--build-arg VCS_VERSION=$(VCS_VERSION) \
|
||||||
-t $(NAME) .
|
|
||||||
|
|
||||||
backup:
|
backup:
|
||||||
# if backup directories exist, clean hasn't been called, therefore
|
# if backup directories exist, clean hasn't been called, therefore
|
||||||
# we shouldn't overwrite it. It still contains the original content.
|
# we shouldn't overwrite it. It still contains the original content.
|
||||||
@ if [[ ! -d config.bak ]]; then cp -rp config config.bak; fi
|
@ [[ ! -d config.bak ]] && cp -rp config config.bak; fi
|
||||||
@ if [[ ! -d testconfig.bak ]]; then cp -rp test/config testconfig.bak; fi
|
@ [[ ! -d testconfig.bak ]] && cp -rp test/config testconfig.bak; fi
|
||||||
|
|
||||||
generate-accounts:
|
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
|
@ 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
|
||||||
|
@ -28,7 +25,6 @@ generate-accounts:
|
||||||
@ echo "# this is a test comment, please don't delete me :'(" >> test/config/postfix-accounts.cf
|
@ echo "# this is a test comment, please don't delete me :'(" >> test/config/postfix-accounts.cf
|
||||||
@ echo " # this is also a test comment, :O" >> test/config/postfix-accounts.cf
|
@ echo " # this is also a test comment, :O" >> test/config/postfix-accounts.cf
|
||||||
|
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
./test/bats/bin/bats test/*.bats
|
./test/bats/bin/bats test/*.bats
|
||||||
|
|
||||||
|
@ -39,14 +35,8 @@ test/%.bats: ALWAYS_RUN
|
||||||
clean:
|
clean:
|
||||||
# remove running and stopped test containers
|
# remove running and stopped test containers
|
||||||
-@ docker ps -a | grep -E "docker-mailserver:testing|ldap_for_mail" | cut -f 1-1 -d ' ' | xargs --no-run-if-empty docker rm -f
|
-@ docker ps -a | grep -E "docker-mailserver:testing|ldap_for_mail" | cut -f 1-1 -d ' ' | xargs --no-run-if-empty docker rm -f
|
||||||
-@ if [ -d config.bak ]; then\
|
-@ [[ -d config.bak ]] && { rm -rf config ; mv config.bak config ; } || :
|
||||||
rm -rf config ;\
|
-@ [[ -d testconfig.bak ]] && { sudo rm -rf test/config ; mv testconfig.bak test/config ; } || :
|
||||||
mv config.bak config ;\
|
|
||||||
fi
|
|
||||||
-@ if [ -d testconfig.bak ]; then\
|
|
||||||
sudo rm -rf test/config ;\
|
|
||||||
mv testconfig.bak test/config ;\
|
|
||||||
fi
|
|
||||||
-@ 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/
|
-@ 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/
|
||||||
|
|
||||||
lint: eclint hadolint shellcheck
|
lint: eclint hadolint shellcheck
|
||||||
|
|
31
README.md
31
README.md
|
@ -32,13 +32,9 @@ Easy to deploy and upgrade.
|
||||||
## Announcements
|
## Announcements
|
||||||
|
|
||||||
1. Since version `v7.1.0`, the use of default variables has changed slightly. Please consult the [environment Variables](#environment-variables) sections
|
1. Since version `v7.1.0`, the use of default variables has changed slightly. Please consult the [environment Variables](#environment-variables) sections
|
||||||
2. Debian Buster is now Docker base image
|
2. New contributing guidelines were added
|
||||||
- Filebeat was removed
|
3. Added coherent coding style and linting
|
||||||
- Dovecot was downgraded
|
4. Added option to use non-default network interface
|
||||||
3. ELK was removed
|
|
||||||
4. New contributing guidelines were added
|
|
||||||
5. Added coherent coding style and linting
|
|
||||||
6. Added option to use non-default network interface
|
|
||||||
|
|
||||||
## Includes
|
## Includes
|
||||||
|
|
||||||
|
@ -114,28 +110,31 @@ chmod a+x ./setup.sh
|
||||||
**Note:** If you want to use a bare domain (host name equals domain name) see [FAQ](https://github.com/tomav/docker-mailserver/wiki/FAQ-and-Tips#can-i-use-nakedbare-domains-no-host-name).
|
**Note:** If you want to use a bare domain (host name equals domain name) see [FAQ](https://github.com/tomav/docker-mailserver/wiki/FAQ-and-Tips#can-i-use-nakedbare-domains-no-host-name).
|
||||||
|
|
||||||
### Get up and running
|
### Get up and running
|
||||||
**Note:** If using SELinux and is enabled, skip to next section below.
|
|
||||||
|
#### Default - Without SELinux
|
||||||
|
|
||||||
``` BASH
|
``` BASH
|
||||||
docker-compose up -d mail
|
docker-compose up -d mail
|
||||||
|
|
||||||
./setup.sh email add <user@domain> [<password>]
|
./setup.sh email add <user@domain> [<password>]
|
||||||
./setup.sh config dkim
|
./setup.sh config dkim
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get up and running with SELinux
|
#### With SELinux
|
||||||
- Edit the files `.env` and `docker-compose.yml`:
|
|
||||||
- In `.env` uncomment the variable `SELINUX_LABEL`.
|
|
||||||
- If you want the volume bind mount to be shared among other containers switch `-Z` to `-z`.
|
|
||||||
- In `docker-compose.yml` uncomment the line that contains `${SELINUX_LABEL}` and comment out or remove the line above.
|
|
||||||
|
|
||||||
**Note:** When using `setup.sh` use the option `-z` or `-Z`. This should match the value of `SELINUX_LABEL` in the `.env` file.\
|
Edit the files `.env` and `docker-compose.yml`. In `.env` uncomment the variable `SELINUX_LABEL`. If you want the volume bind mount to be shared among other containers switch `-Z` to `-z`. In `docker-compose.yml`, uncomment the line that contains `${SELINUX_LABEL}` and comment out or remove the line above.
|
||||||
See the [wiki](https://github.com/tomav/docker-mailserver/wiki/Setup-docker-mailserver-using-the-script-setup.sh) for more information regarding `setup.sh`.
|
|
||||||
|
**Note:** When using `setup.sh` use the option `-z` or `-Z`. This should match the value of `SELINUX_LABEL` in the `.env` file. See the [wiki](https://github.com/tomav/docker-mailserver/wiki/Setup-docker-mailserver-using-the-script-setup.sh) for more information regarding `setup.sh`.
|
||||||
|
|
||||||
``` BASH
|
``` BASH
|
||||||
docker-compose up -d mail
|
docker-compose up -d mail
|
||||||
|
|
||||||
./setup.sh -Z email add <user@domain> [<password>]
|
./setup.sh -Z email add <user@domain> [<password>]
|
||||||
./setup.sh -Z config dkim
|
./setup.sh -Z config dkim
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### DNS - DKIM
|
||||||
|
|
||||||
Now that the keys are generated, you can configure your DNS server by just pasting the content of `config/opendkim/keys/domain.tld/mail.txt` in your `domain.tld.hosts` zone.
|
Now that the keys are generated, you can configure your DNS server by just pasting the content of `config/opendkim/keys/domain.tld/mail.txt` in your `domain.tld.hosts` zone.
|
||||||
|
|
||||||
### Miscellaneous
|
### Miscellaneous
|
||||||
|
@ -144,7 +143,7 @@ Now that the keys are generated, you can configure your DNS server by just pasti
|
||||||
|
|
||||||
``` BASH
|
``` BASH
|
||||||
docker-compose down
|
docker-compose down
|
||||||
docker pull tvial/docker-mailserver:latest
|
docker pull tvial/docker-mailserver:<VERSION TAG>
|
||||||
docker-compose up -d mail
|
docker-compose up -d mail
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -5,4 +5,9 @@
|
||||||
HOSTNAME=mail
|
HOSTNAME=mail
|
||||||
DOMAINNAME=domain.com
|
DOMAINNAME=domain.com
|
||||||
CONTAINER_NAME=mail
|
CONTAINER_NAME=mail
|
||||||
#SELINUX_LABEL=-Z
|
|
||||||
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
|
# ––– SELinux Compose File Settings Variables –––
|
||||||
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
|
|
||||||
|
SELINUX_LABEL=-Z
|
||||||
|
|
|
@ -16,8 +16,8 @@ services:
|
||||||
- mailstate:/var/mail-state
|
- mailstate:/var/mail-state
|
||||||
- maillogs:/var/log/mail
|
- maillogs:/var/log/mail
|
||||||
- ./config/:/tmp/docker-mailserver/
|
- ./config/:/tmp/docker-mailserver/
|
||||||
# If SELinux is enabled uncomment line below and comment line above
|
# ? if SELinux is enabled, uncomment the line below and comment the line above
|
||||||
#- ./config/:/tmp/docker-mailserver/${SELINUX_LABEL}
|
# - ./config/:/tmp/docker-mailserver/${SELINUX_LABEL}
|
||||||
env_file:
|
env_file:
|
||||||
- mailserver.env
|
- mailserver.env
|
||||||
cap_add:
|
cap_add:
|
||||||
|
|
13
hooks/build
13
hooks/build
|
@ -1,8 +1,9 @@
|
||||||
#!/bin/sh
|
#! /bin/sh
|
||||||
VCS_REF=$(git rev-parse --short HEAD)
|
|
||||||
VCS_VERSION=$(git describe --tags --contains --always)
|
VCS_REF="$(git rev-parse --short HEAD)"
|
||||||
|
VCS_VERSION="$(git describe --tags --contains --always)"
|
||||||
|
|
||||||
docker build \
|
docker build \
|
||||||
--build-arg VCS_REF="$VCS_REF" \
|
--build-arg VCS_REF="${VCS_REF}" \
|
||||||
--build-arg VCS_VERSION="$VCS_VERSION" \
|
--build-arg VCS_VERSION="${VCS_VERSION}" \
|
||||||
-f "$DOCKERFILE_PATH" -t "$IMAGE_NAME" .
|
-f "${DOCKERFILE_PATH}" -t "${IMAGE_NAME}" .
|
||||||
|
|
|
@ -175,9 +175,9 @@ REPORT_INTERVAL=daily
|
||||||
# Note: More details in http://www.postfix.org/postconf.5.html#inet_protocols
|
# Note: More details in http://www.postfix.org/postconf.5.html#inet_protocols
|
||||||
POSTFIX_INET_PROTOCOLS=all
|
POSTFIX_INET_PROTOCOLS=all
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
# --------------------- Spamassassin section ----------------------------------------------------------------------------------
|
# ––– Spamassassin Section ––––––––––––––––––––––
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
|
|
||||||
ENABLE_SPAMASSASSIN=0
|
ENABLE_SPAMASSASSIN=0
|
||||||
|
|
||||||
|
@ -199,18 +199,18 @@ SA_KILL=6.31
|
||||||
# add tag to subject if spam detected
|
# add tag to subject if spam detected
|
||||||
SA_SPAM_SUBJECT=***SPAM*****
|
SA_SPAM_SUBJECT=***SPAM*****
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
# --------------------- Fetchmail section -------------------------------------------------------------------------------------
|
# ––– Fetchmail Section –––––––––––––––––––––––––
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
|
|
||||||
ENABLE_FETCHMAIL=0
|
ENABLE_FETCHMAIL=0
|
||||||
|
|
||||||
# The interval to fetch mail in seconds
|
# The interval to fetch mail in seconds
|
||||||
FETCHMAIL_POLL=300
|
FETCHMAIL_POLL=300
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
# --------------------- LDAP section ------------------------------------------------------------------------------------------
|
# ––– LDAP Section ––––––––––––––––––––––––––––––
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
|
|
||||||
# A second container for the ldap service is necessary (i.e. https://github.com/osixia/docker-openldap)
|
# 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/
|
# 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/
|
||||||
|
@ -256,9 +256,9 @@ LDAP_QUERY_FILTER_ALIAS=
|
||||||
# => Specify how ldap should be asked for domains
|
# => Specify how ldap should be asked for domains
|
||||||
LDAP_QUERY_FILTER_DOMAIN=
|
LDAP_QUERY_FILTER_DOMAIN=
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
# ---------------- Dovecot section --------------------------------------------------------------------------------------------
|
# ––– Dovecot Section –––––––––––––––––––––––––––
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
|
|
||||||
# empty => no
|
# empty => no
|
||||||
# yes => LDAP over TLS enabled for Dovecot
|
# yes => LDAP over TLS enabled for Dovecot
|
||||||
|
@ -279,9 +279,9 @@ DOVECOT_MAILBOX_FORMAT=maildir
|
||||||
# https://wiki.dovecot.org/AuthDatabase/LDAP/AuthBinds
|
# https://wiki.dovecot.org/AuthDatabase/LDAP/AuthBinds
|
||||||
DOVECOT_AUTH_BIND=
|
DOVECOT_AUTH_BIND=
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
# ---------------- Postgrey section -------------------------------------------------------------------------------------------
|
# ––– Postgrey Section ––––––––––––––––––––––––––
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
|
|
||||||
ENABLE_POSTGREY=0
|
ENABLE_POSTGREY=0
|
||||||
# greylist for N seconds
|
# greylist for N seconds
|
||||||
|
@ -293,9 +293,9 @@ POSTGREY_TEXT=Delayed by postgrey
|
||||||
# whitelist host after N successful deliveries (N=0 to disable whitelisting)
|
# whitelist host after N successful deliveries (N=0 to disable whitelisting)
|
||||||
POSTGREY_AUTO_WHITELIST_CLIENTS=5
|
POSTGREY_AUTO_WHITELIST_CLIENTS=5
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
# ---------------- SASL section -----------------------------------------------------------------------------------------------
|
# ––– SASL Section ––––––––––––––––––––––––––––––
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
|
|
||||||
ENABLE_SASLAUTHD=0
|
ENABLE_SASLAUTHD=0
|
||||||
|
|
||||||
|
@ -349,9 +349,9 @@ SASLAUTHD_LDAP_TLS_CHECK_PEER=
|
||||||
# string => `/etc/postfix/sasl_passwd` will be created with the string as password
|
# string => `/etc/postfix/sasl_passwd` will be created with the string as password
|
||||||
SASL_PASSWD=
|
SASL_PASSWD=
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
# ---------------- SRS section --------------------------------------------------------------------------------------------
|
# ––– SRS Section –––––––––––––––––––––––––––––––
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
|
|
||||||
# envelope_sender => Rewrite only envelope sender address (default)
|
# envelope_sender => Rewrite only envelope sender address (default)
|
||||||
# header_sender => Rewrite only header sender (not recommended)
|
# header_sender => Rewrite only header sender (not recommended)
|
||||||
|
@ -372,9 +372,9 @@ SRS_EXCLUDE_DOMAINS=
|
||||||
# rotate and expire keys
|
# rotate and expire keys
|
||||||
SRS_SECRET=
|
SRS_SECRET=
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
# ---------------- Default relay host section ---------------------------------------------------------------------------------
|
# ––– Default Relay Host Section ––––––––––––––––
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
|
|
||||||
# Setup relaying all mail through a default relay host
|
# Setup relaying all mail through a default relay host
|
||||||
#
|
#
|
||||||
|
@ -382,9 +382,9 @@ SRS_SECRET=
|
||||||
# default host and optional port to relay all mail through
|
# default host and optional port to relay all mail through
|
||||||
DEFAULT_RELAY_HOST=
|
DEFAULT_RELAY_HOST=
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
# ---------------- Multi-domain relay section ---------------------------------------------------------------------------------
|
# ––– Multi-Domain Relay Section ––––––––––––––––
|
||||||
# -----------------------------------------------------------------------------------------------------------------------------
|
# –––––––––––––––––––––––––––––––––––––––––––––––
|
||||||
|
|
||||||
# Setup relaying for multiple domains based on the domain name of the sender
|
# 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
|
# optionally uses usernames and passwords in postfix-sasl-password.cf and relay host mappings in postfix-relaymap.cf
|
||||||
|
|
36
setup.sh
36
setup.sh
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# Wrapper for various setup scripts
|
# Wrapper for various setup scripts
|
||||||
# included in the docker-mailserver
|
# included in docker-mailserver
|
||||||
|
|
||||||
SCRIPT='SETUP'
|
SCRIPT='SETUP'
|
||||||
|
|
||||||
|
@ -252,11 +252,23 @@ function _main
|
||||||
while getopts ":c:i:p:hzZ" OPT
|
while getopts ":c:i:p:hzZ" OPT
|
||||||
do
|
do
|
||||||
case ${OPT} in
|
case ${OPT} in
|
||||||
c) CONTAINER_NAME="${OPTARG}" ; USE_CONTAINER=true ;; # container specified, connect to running instance
|
i ) IMAGE_NAME="${OPTARG}" ;;
|
||||||
i) IMAGE_NAME="${OPTARG}" ;;
|
z ) USING_SELINUX=":z" ;;
|
||||||
p)
|
Z ) USING_SELINUX=":Z" ;;
|
||||||
|
c )
|
||||||
|
# container specified, connect to running instance
|
||||||
|
CONTAINER_NAME="${OPTARG}"
|
||||||
|
USE_CONTAINER=true
|
||||||
|
;;
|
||||||
|
|
||||||
|
h )
|
||||||
|
_usage
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
|
||||||
|
p )
|
||||||
case "${OPTARG}" in
|
case "${OPTARG}" in
|
||||||
/*) WISHED_CONFIG_PATH="${OPTARG}" ;;
|
/* ) WISHED_CONFIG_PATH="${OPTARG}" ;;
|
||||||
* ) WISHED_CONFIG_PATH="${CDIR}/${OPTARG}" ;;
|
* ) WISHED_CONFIG_PATH="${CDIR}/${OPTARG}" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -267,13 +279,15 @@ function _main
|
||||||
exit 40
|
exit 40
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
h) _usage ; return ;;
|
|
||||||
z) USING_SELINUX=":z" ;;
|
* )
|
||||||
Z) USING_SELINUX=":Z" ;;
|
echo "Invalid option: -${OPTARG}" >&2
|
||||||
*) echo "Invalid option: -${OPTARG}" >&2 ;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $((OPTIND-1))
|
|
||||||
|
shift $(( OPTIND - 1 ))
|
||||||
|
|
||||||
if [[ -z ${WISHED_CONFIG_PATH} ]]
|
if [[ -z ${WISHED_CONFIG_PATH} ]]
|
||||||
then
|
then
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# version 0.1.0
|
|
||||||
# executed from scripts in target/bin/
|
# executed from scripts in target/bin/
|
||||||
# task provides frequently used functions
|
# task provides frequently used functions
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# version 0.2.0
|
|
||||||
#
|
|
||||||
# <INSERT TASK HERE>
|
|
||||||
|
|
||||||
# shellcheck source=./helper-functions.sh
|
# shellcheck source=./helper-functions.sh
|
||||||
. /usr/local/bin/helper-functions.sh
|
. /usr/local/bin/helper-functions.sh
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env sh
|
#! /usr/bin/env sh
|
||||||
|
|
||||||
# Report a quota usage warning to an user
|
# Report a quota usage warning to an user
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# version 0.1.0
|
|
||||||
#
|
|
||||||
# You cannot start fail2ban in some foreground mode and
|
# You cannot start fail2ban in some foreground mode and
|
||||||
# it's more or less important that docker doesn't kill
|
# it's more or less important that docker doesn't kill
|
||||||
# fail2ban and its chilren if you stop the container.
|
# fail2ban and its chilren if you stop the container.
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# version 0.1.1
|
|
||||||
#
|
|
||||||
# Provides varous helpers.
|
|
||||||
|
|
||||||
|
|
||||||
# ? IP and CIDR -------------------------------------------
|
# ? IP and CIDR -------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# version 0.1.0
|
|
||||||
#
|
|
||||||
# You cannot start postfix in some foreground mode and
|
# You cannot start postfix in some foreground mode and
|
||||||
# it's more or less important that docker doesn't kill
|
# it's more or less important that docker doesn't kill
|
||||||
# postfix and its chilren if you stop the container.
|
# postfix and its chilren if you stop the container.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh
|
#! /bin/sh
|
||||||
#
|
|
||||||
# postgrey start/stop the postgrey greylisting deamon for postfix
|
# postgrey start/stop the postgrey greylisting deamon for postfix
|
||||||
# (priority should be smaller than that of postfix)
|
# (priority should be smaller than that of postfix)
|
||||||
#
|
#
|
||||||
|
@ -8,7 +8,8 @@
|
||||||
# Distribute and/or modify at will.
|
# Distribute and/or modify at will.
|
||||||
#
|
#
|
||||||
# Version: $Id: postgrey.init 1436 2006-12-07 07:15:03Z avbidder $
|
# Version: $Id: postgrey.init 1436 2006-12-07 07:15:03Z avbidder $
|
||||||
#
|
# altered by Georg Lauterbach as aendeavor 2020-11.05 14:02:00Z
|
||||||
|
|
||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: postgrey
|
# Provides: postgrey
|
||||||
# Required-Start: $syslog $local_fs $remote_fs
|
# Required-Start: $syslog $local_fs $remote_fs
|
||||||
|
@ -20,31 +21,32 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
PATH='/sbin:/bin:/usr/sbin:/usr/bin'
|
||||||
DAEMON=/usr/sbin/postgrey
|
DAEMON='/usr/sbin/postgrey'
|
||||||
DAEMON_NAME=postgrey
|
DAEMON_NAME='postgrey'
|
||||||
DESC="postfix greylisting daemon"
|
DESC='postfix greylisting daemon'
|
||||||
DAEMON_USER=postgrey
|
DAEMON_USER='postgrey'
|
||||||
|
|
||||||
PIDFILE=/var/run/$DAEMON_NAME/$DAEMON_NAME.pid
|
PIDFILE="/var/run/${DAEMON_NAME}/${DAEMON_NAME}.pid"
|
||||||
SCRIPTNAME=/etc/init.d/$DAEMON_NAME
|
SCRIPTNAME="/etc/init.d/${DAEMON_NAME}"
|
||||||
|
|
||||||
# Gracefully exit if the package has been removed.
|
# gracefully exit if the package has been removed.
|
||||||
test -x $DAEMON || exit 0
|
[ -x "${DAEMON}" ] || exit 0
|
||||||
|
|
||||||
|
# shellcheck source=/dev/null
|
||||||
. /lib/lsb/init-functions
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
# Read config file if it is present.
|
# Read config file if it is present.
|
||||||
if [ -r /etc/default/$DAEMON_NAME ]
|
# shellcheck source=/dev/null
|
||||||
then
|
[ -r "/etc/default/${DAEMON_NAME}" ] && . "/etc/default/${DAEMON_NAME}"
|
||||||
. /etc/default/$DAEMON_NAME
|
|
||||||
fi
|
|
||||||
|
|
||||||
POSTGREY_OPTS="--pidfile=$PIDFILE --daemonize $POSTGREY_OPTS"
|
POSTGREY_OPTS="--pidfile=${PIDFILE} --daemonize ${POSTGREY_OPTS}"
|
||||||
if [ -z "$POSTGREY_TEXT" ]; then
|
|
||||||
|
if [ -z "${POSTGREY_TEXT}" ]
|
||||||
|
then
|
||||||
POSTGREY_TEXT_OPT=""
|
POSTGREY_TEXT_OPT=""
|
||||||
else
|
else
|
||||||
POSTGREY_TEXT_OPT="--greylist-text=$POSTGREY_TEXT"
|
POSTGREY_TEXT_OPT="--greylist-text=${POSTGREY_TEXT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ret=0
|
ret=0
|
||||||
|
@ -55,11 +57,12 @@ do_start()
|
||||||
# 0 if daemon has been started
|
# 0 if daemon has been started
|
||||||
# 1 if daemon was already running
|
# 1 if daemon was already running
|
||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|
start-stop-daemon --start --quiet --pidfile \
|
||||||
|| return 1
|
"${PIDFILE}" --exec "${DAEMON}" --test >/dev/null || return 1
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
|
|
||||||
$POSTGREY_OPTS "$POSTGREY_TEXT_OPT" \
|
start-stop-daemon --start --quiet --pidfile \
|
||||||
|| return 2
|
"${PIDFILE}" --exec "${DAEMON}" -- "${POSTGREY_OPTS}" \
|
||||||
|
"${POSTGREY_TEXT_OPT}" || return 2
|
||||||
}
|
}
|
||||||
|
|
||||||
do_stop()
|
do_stop()
|
||||||
|
@ -69,9 +72,11 @@ do_stop()
|
||||||
# 1 if daemon was already stopped
|
# 1 if daemon was already stopped
|
||||||
# 2 if daemon could not be stopped
|
# 2 if daemon could not be stopped
|
||||||
# other if a failure occurred
|
# other if a failure occurred
|
||||||
start-stop-daemon --user $DAEMON_USER --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
|
start-stop-daemon --user "${DAEMON_USER}" --stop --quiet \
|
||||||
|
--retry=TERM/30/KILL/5 --pidfile "${PIDFILE}"
|
||||||
|
|
||||||
RETVAL="$?"
|
RETVAL="$?"
|
||||||
[ "$RETVAL" = 2 ] && return 2
|
[ "${RETVAL}" -eq 2 ] && return 2
|
||||||
|
|
||||||
# Wait for children to finish too if this is a daemon that forks
|
# Wait for children to finish too if this is a daemon that forks
|
||||||
# and if the daemon is only ever run from this initscript.
|
# and if the daemon is only ever run from this initscript.
|
||||||
|
@ -79,12 +84,13 @@ do_stop()
|
||||||
# that waits for the process to drop all resources that could be
|
# that waits for the process to drop all resources that could be
|
||||||
# needed by services started subsequently. A last resort is to
|
# needed by services started subsequently. A last resort is to
|
||||||
# sleep for some time.
|
# sleep for some time.
|
||||||
start-stop-daemon --user $DAEMON_USER --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
|
start-stop-daemon --user "${DAEMON_USER}" --stop --quiet \
|
||||||
[ "$?" = 2 ] && return 2
|
--oknodo --retry=0/30/KILL/5 --exec "${DAEMON}"
|
||||||
# Many daemons don't delete their pidfiles when they exit.
|
[ "$?" -eq 2 ] && return 2
|
||||||
rm -f $PIDFILE
|
|
||||||
return "$RETVAL"
|
|
||||||
|
|
||||||
|
# Many daemons don't delete their pidfiles when they exit.
|
||||||
|
rm -f "${PIDFILE}"
|
||||||
|
return "${RETVAL}"
|
||||||
}
|
}
|
||||||
|
|
||||||
do_reload()
|
do_reload()
|
||||||
|
@ -94,49 +100,56 @@ do_reload()
|
||||||
# restarting (for example, when it is sent a SIGHUP),
|
# restarting (for example, when it is sent a SIGHUP),
|
||||||
# then implement that here.
|
# then implement that here.
|
||||||
#
|
#
|
||||||
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE
|
start-stop-daemon --stop --signal 1 --quiet --pidfile "${PIDFILE}"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "${1}" in
|
||||||
start)
|
start )
|
||||||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$DAEMON_NAME"
|
[ "${VERBOSE}" != no ] && log_daemon_msg "Starting ${DESC}" "${DAEMON_NAME}"
|
||||||
do_start
|
do_start
|
||||||
case "$?" in
|
|
||||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
case "${?}" in
|
||||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
0|1) [ "${VERBOSE}" != no ] && log_end_msg 0 ;;
|
||||||
|
2) [ "${VERBOSE}" != no ] && log_end_msg 1 ;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
stop)
|
|
||||||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$DAEMON_NAME"
|
|
||||||
do_stop
|
|
||||||
case "$?" in
|
|
||||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
|
||||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
reload|force-reload)
|
|
||||||
[ "$VERBOSE" != no ] && log_daemon_msg "Reloading $DESC" "$DAEMON_NAME"
|
|
||||||
do_reload
|
|
||||||
case "$?" in
|
|
||||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
|
||||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
restart)
|
|
||||||
do_stop
|
|
||||||
do_start
|
|
||||||
;;
|
|
||||||
status)
|
|
||||||
status_of_proc -p $PIDFILE $DAEMON "$DAEMON_NAME" 2>/dev/null
|
|
||||||
ret=$?
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
stop )
|
||||||
echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2
|
[ "${VERBOSE}" != no ] && log_daemon_msg "Stopping ${DESC}" "${DAEMON_NAME}"
|
||||||
|
do_stop
|
||||||
|
|
||||||
|
case "${?}" in
|
||||||
|
0|1) [ "${VERBOSE}" != no ] && log_end_msg 0 ;;
|
||||||
|
2) [ "${VERBOSE}" != no ] && log_end_msg 1 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
|
||||||
|
reload|force-reload)
|
||||||
|
[ "${VERBOSE}" != no ] && log_daemon_msg "Reloading ${DESC}" "${DAEMON_NAME}"
|
||||||
|
do_reload
|
||||||
|
|
||||||
|
case "${?}" in
|
||||||
|
0|1) [ "${VERBOSE}" != no ] && log_end_msg 0 ;;
|
||||||
|
2) [ "${VERBOSE}" != no ] && log_end_msg 1 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
|
||||||
|
restart )
|
||||||
|
do_stop
|
||||||
|
do_start
|
||||||
|
;;
|
||||||
|
|
||||||
|
status )
|
||||||
|
status_of_proc -p "${PIDFILE}" "${DAEMON}" "${DAEMON_NAME}" 2>/dev/null
|
||||||
|
ret=${?}
|
||||||
|
;;
|
||||||
|
|
||||||
|
* )
|
||||||
|
echo "Usage: ${SCRIPTNAME} {start|stop|restart|reload|force-reload|status}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
exit $ret
|
exit ${ret}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# version 0.1.0
|
|
||||||
|
|
||||||
function _generate_secret { ( umask 0077 ; dd if=/dev/urandom bs=24 count=1 2>/dev/null | base64 -w0 > "${1}" ) }
|
function _generate_secret { ( umask 0077 ; dd if=/dev/urandom bs=24 count=1 2>/dev/null | base64 -w0 > "${1}" ) }
|
||||||
|
|
||||||
if [[ -n ${SRS_DOMAINNAME} ]]
|
if [[ -n ${SRS_DOMAINNAME} ]]
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# version 0.2.1
|
|
||||||
#
|
|
||||||
# Starts the mailserver.
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# >> DEFAULT VARS
|
# >> DEFAULT VARS
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#! /bin/bash
|
||||||
|
|
||||||
# version v0.1.0 stable
|
# version v0.1.0 stable
|
||||||
# executed by TravisCI / manually
|
# executed by TravisCI / manually
|
||||||
|
@ -190,7 +190,7 @@ function _shellcheck
|
||||||
fi
|
fi
|
||||||
done < <(find test/ -maxdepth 1 -type f -iname "*.bats")
|
done < <(find test/ -maxdepth 1 -type f -iname "*.bats")
|
||||||
|
|
||||||
if [[ ERR -eq 1 ]]
|
if [[ ${ERR} -eq 1 ]]
|
||||||
then
|
then
|
||||||
__log_abort 'errors encountered'
|
__log_abort 'errors encountered'
|
||||||
return 101
|
return 101
|
||||||
|
|
|
@ -63,6 +63,7 @@ function teardown_file() {
|
||||||
assert_success
|
assert_success
|
||||||
run docker exec mail_smtponly /bin/sh -c "/etc/init.d/postfix reload"
|
run docker exec mail_smtponly /bin/sh -c "/etc/init.d/postfix reload"
|
||||||
assert_success
|
assert_success
|
||||||
|
sleep 5
|
||||||
run docker exec mail_smtponly /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/smtp-only.txt"
|
run docker exec mail_smtponly /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/smtp-only.txt"
|
||||||
assert_success
|
assert_success
|
||||||
run docker exec mail_smtponly /bin/sh -c 'grep -cE "to=<user2\@external.tld>.*status\=sent" /var/log/mail/mail.log'
|
run docker exec mail_smtponly /bin/sh -c 'grep -cE "to=<user2\@external.tld>.*status\=sent" /var/log/mail/mail.log'
|
||||||
|
|
Loading…
Reference in a new issue