mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-02 17:14:31 +02:00
* Add new configuration for multi-domain relay hosts (#922) * Creates new environment variables (replacing existing AWS_SES variables) * Optionally allows more advanced setups using config files * Update relay hosts during change detection (#922) * Add helper scripts for adding relay hosts and per-domain auth * Allow the possibility to deliver some mail directly * adding a domain with no destination will exclude it from the relayhost_map and so Postfix will attempt to deliver the mail directly * tests for setup.sh script * tests for relay host configuration * these tests cover the code in `start-mailserver.sh` dealing with both the env vars and the configuration files
This commit is contained in:
parent
86ea0bbae1
commit
f28e9843ce
13 changed files with 388 additions and 11 deletions
35
target/bin/addsaslpassword
Executable file
35
target/bin/addsaslpassword
Executable file
|
@ -0,0 +1,35 @@
|
|||
#! /bin/bash
|
||||
|
||||
DATABASE=${DATABASE:-/tmp/docker-mailserver/postfix-sasl-password.cf}
|
||||
|
||||
DOMAIN="$1"
|
||||
USER="$2"
|
||||
PASSWD="$3"
|
||||
|
||||
usage() {
|
||||
echo "Usage: addsaslpassword <domain> <username> <password>"
|
||||
}
|
||||
|
||||
errex() {
|
||||
echo "$@" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
escape() {
|
||||
echo "${1//./\\.}"
|
||||
}
|
||||
|
||||
[ -z "$DOMAIN" ] && { usage; errex "no domain specified"; }
|
||||
[ -z "$USER" ] && { usage; errex "no username specified"; }
|
||||
|
||||
if [ -z "$PASSWD" ]; then
|
||||
read -s -p "Enter Password: " PASSWD
|
||||
echo
|
||||
[ -z "$PASSWD" ] && errex "Password must not be empty"
|
||||
fi
|
||||
|
||||
if grep -qi "^@$DOMAIN" $DATABASE 2>/dev/null; then
|
||||
sed -i "s ^@"$DOMAIN".* "@$DOMAIN"\t\t"$USER":"$PASSWD" " $DATABASE
|
||||
else
|
||||
echo -e "@$DOMAIN\t\t$USER:$PASSWD" >> $DATABASE
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue