add better mail security

This commit is contained in:
rnsrk 2026-01-19 08:57:23 +01:00
parent a7585e1bc9
commit f670bec1b1
63 changed files with 2569 additions and 491 deletions

View file

@ -1,9 +1,39 @@
#!/bin/bash
source ./core/.env
set -e
source ./core/.env
source ./drupal/.env
create_mta_sts_policy() {
local template_path="./core/mta-sts/.well-known/mta-sts.txt.template"
local output_path="./core/mta-sts/.well-known/mta-sts.txt"
local mailcow_conf="./mailcow/mailcow.conf"
local mailcow_hostname=""
if [ ! -f "$template_path" ]; then
return 0
fi
if [ -f "$mailcow_conf" ]; then
mailcow_hostname=$(grep '^MAILCOW_HOSTNAME=' "$mailcow_conf" | cut -d= -f2)
fi
if [ -z "$mailcow_hostname" ] && [ -n "$DOMAIN" ]; then
mailcow_hostname="mail.${DOMAIN}"
fi
if [ ! -f "$output_path" ]; then
mkdir -p "$(dirname "$output_path")"
sed "s/{{MAILCOW_HOSTNAME}}/${mailcow_hostname}/g" "$template_path" > "$output_path"
echo "Created MTA-STS policy at ${output_path}"
else
echo "MTA-STS policy already exists at ${output_path}"
fi
}
create_mta_sts_policy
if [ ! -d "./drupal/drupal/root" ]; then
echo "Creating Drupal infrastructure..."
mkdir -p ./drupal/drupal/root