1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-04 15:54:48 +01:00
Upstream is adding handling for utf8 domains by creating a domain alias @utf8 -> @idna. I'm deviating from this approach by setting multiple email address (idna and utf8) per user and alias where a domain contains non-ascii characters. The maildrop (mailbox) remains the same - all mail goes to the user's mailbox regardless of which email address was used. This is more in line with how other systems (eg. active directory), handle multiple email addresses for a single user.

# Conflicts:
#	README.md
#	management/mailconfig.py
#	management/templates/index.html
#	setup/dns.sh
#	setup/mail-users.sh
This commit is contained in:
downtownallday
2021-10-01 17:43:48 -04:00
30 changed files with 1326 additions and 458 deletions

View File

@@ -39,3 +39,7 @@ export NC_ADMIN_PASSWORD="${NC_ADMIN_PASSWORD:-Test_1234}"
# For setup scripts that install upstream versions
export MIAB_UPSTREAM_GIT="${MIAB_UPSTREAM_GIT:-https://github.com/mail-in-a-box/mailinabox.git}"
export UPSTREAM_TAG="${UPSTREAM_TAG:-}"
# For setup scripts that install miabldap releases
export MIABLDAP_GIT="${MIABLDAP_GIT:-https://github.com/downtownallday/mailinabox-ldap.git}"
export MIABLDAP_RELEASE_TAG="${MIABLDAP_RELEASE_TAG:-v0.54}"

View File

@@ -224,6 +224,14 @@ miab_ldap_install() {
die "Cannot install: the working directory is not MiaB-LDAP!"
fi
# setup/questions.sh installs the email_validator python3 module
# but only when in interactive mode. make sure it's also installed
# in non-interactive mode
if [ ! -z "${NONINTERACTIVE:-}" ]; then
H2 "Install email_validator python3 module"
pip3 install -q "email_validator>=1.0.0" || die "Unable to install email_validator python3 module!"
fi
# if EHDD_KEYFILE is set, use encryption-at-rest support
if [ ! -z "$EHDD_KEYFILE" ]; then
ehdd/start-encrypted.sh

View File

@@ -96,13 +96,13 @@ upstream_install() {
echo "$F_RESET"
die "Upstream setup failed!"
fi
popd >/dev/null
workaround_dovecot_sieve_bug
H2 "Upstream info"
echo "Code version: $(git describe)"
echo "Migration version: $(cat "$STORAGE_ROOT/mailinabox.version")"
popd >/dev/null
}
@@ -154,9 +154,7 @@ else
fi
# capture upstream state
pushd "$upstream_dir" >/dev/null
installed_state_capture "/tmp/state/upstream"
popd >/dev/null
installed_state_capture "/tmp/state/upstream" "$upstream_dir"
fi
# install miab-ldap and capture state

111
tests/system-setup/upgrade.sh Executable file
View File

@@ -0,0 +1,111 @@
#!/bin/bash
# setup MiaB-LDAP by:
# 1. installing upstream MiaB
# 2. adding some data (users/aliases/etc)
# 3. upgrading to MiaB-LDAP
#
# See setup-defaults.sh for usernames and passwords.
#
usage() {
echo "Usage: $(basename "$0")"
echo "Install MiaB-LDAP after installing upstream MiaB"
exit 1
}
# ensure working directory
if [ ! -d "tests/system-setup" ]; then
echo "This script must be run from the MiaB root directory"
exit 1
fi
# load helper scripts
. "tests/lib/all.sh" "tests/lib" || die "Could not load lib scripts"
. "tests/system-setup/setup-defaults.sh" || die "Could not load setup-defaults"
. "tests/system-setup/setup-funcs.sh" || die "Could not load setup-funcs"
# ensure running as root
if [ "$EUID" != "0" ]; then
die "This script must be run as root (sudo)"
fi
init() {
H1 "INIT"
init_test_system
init_miab_testing || die "Initialization failed"
}
install_release() {
install_dir="$1"
H1 "INSTALL RELEASE $MIABLDAP_RELEASE_TAG"
[ ! -x /usr/bin/git ] && apt-get install -y -qq git
if [ ! -d "$install_dir" ] || [ -z "$(ls -A "$install_dir")" ] ; then
H2 "Cloning $MIABLDAP_GIT"
rm -rf "$install_dir"
git clone "$MIABLDAP_GIT" "$install_dir"
if [ $? -ne 0 ]; then
rm -rf "$install_dir"
die "git clone failed!"
fi
fi
pushd "$install_dir" >/dev/null
H2 "Checkout $MIABLDAP_RELEASE_TAG"
git checkout "$MIABLDAP_RELEASE_TAG" || die "git checkout $MIABLDAP_RELEASE_TAG failed"
H2 "Run setup"
if ! setup/start.sh; then
echo "$F_WARN"
dump_file /var/log/syslog 100
echo "$F_RESET"
die "Release $RELEASE_TAG setup failed!"
fi
workaround_dovecot_sieve_bug
H2 "Release info"
echo "Code version: $(git describe)"
echo "Migration version (miabldap): $(cat "$STORAGE_ROOT/mailinabox-ldap.version")"
popd >/dev/null
}
# install basic stuff, set the hostname, time, etc
init
# install release
release_dir="$HOME/miabldap_$MIABLDAP_RELEASE_TAG"
install_release "$release_dir"
. /etc/mailinabox.conf
# populate some data
if [ $# -gt 0 ]; then
populate_by_name "$@"
else
populate_by_name "basic" "totpuser"
fi
# capture release state
installed_state_capture "/tmp/state/release" "$release_dir"
# install master miab-ldap and capture state
H2 "New miabldap"
echo "git branch: $(git branch | grep '*')"
miab_ldap_install
installed_state_capture "/tmp/state/master"
# compare states
if ! installed_state_compare "/tmp/state/release" "/tmp/state/master"; then
dump_file "/tmp/state/release/info.txt"
dump_file "/tmp/state/master/info.txt"
die "Release $RELEASE_TAG and master states are different !"
fi
#
# actual verification that mail sends/receives properly is done via
# the test runner ...
#