oneuptime/Haraka/haraka.sh
Nawaz Dhandala a981683d81
fix
2022-04-10 22:50:28 +01:00

322 lines
14 KiB
Bash
Executable File

#! /bin/sh
#
# haraka.sh
echo "${TIMEZONE}" >/etc/TZ
cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime
initDkim() {
# Create a directory for each DKIM signing domain
mkdir -p "$DOMAIN"
cd "$DOMAIN" || exit
# The selector can be any value that is a valid DNS label
echo 'oneuptime' >selector
# Generate private and public keys
# - Key length considerations -
# The minimum recommended key length for short duration keys (ones that
# will be replaced within a few months) is 1024. If you are unlikely to
# rotate your keys frequently, choose 2048, at the expense of more CPU.
#
# grab the generated private key and write it to private file
# DKIM_PRIVATE_KEY must be in base64 for this to work
# This is a workaround for issue with passing private key through env
(echo $DKIM_PRIVATE_KEY | base64 -d) >private
chmod 0400 private
openssl rsa -in private -out public -pubout
DNS_NAME="$(tr -d '\n' <selector)._domainkey"
DNS_ADDRESS="v=DKIM1;p=$(grep -v '^-' public | tr -d '\n')"
cd ..
}
#run if there is no existing haraka config
if [[ ! -d "${DATADIR}/config" ]]; then
haraka -i ${DATADIR}
if [[ -n "$DOMAIN" ]]; then
echo "$DOMAIN" >${DATADIR}/config/host_list
echo "$DOMAIN" >${DATADIR}/config/me
# setup bounce message template
cat <<-EOF >>${DATADIR}/config/outbound.bounce_message
Received: (Haraka {pid} invoked for bounce); {date}
Date: {date}
From: mailer-daemon@${DOMAIN}
To: {to}
Auto-Submitted: auto-replied
Subject: failure notice
Message-Id: {msgid}
Hi. This is the Haraka Mailer program at {me}.
I'm afraid I wasn't able to deliver your message
"{subject}"
to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.
Intended Recipients: {recipients}
Failure Reason: {reason}
{extended_reason}
EOF
cat <<-EOF >>${DATADIR}/config/outbound.bounce_message_html
<html>
<head>
<style>
* {
font-family:Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
</style>
</head>
<body>
<table cellpadding="0" cellspacing="0" class="email-wrapper" style="padding-top:32px;background-color:#ffffff;"><tbody>
<tr><td>
<table cellpadding=0 cellspacing=0><tbody>
<tr><td style="max-width:560px;padding:24px 24px 32px;background-color:#fafafa;border:1px solid #e0e0e0;border-radius:2px">
<img style="padding:0 24px 16px 0;float:left" width=72 height=72 alt="Foutpictogram" src="cid:icon.png">
<table style="min-width:272px;padding-top:8px"><tbody>
<tr><td><h2 style="font-size:20px;color:#212121;font-weight:bold;margin:0">
Message not delivered
</h2></td></tr>
<tr><td style="padding-top:20px;color:#757575;font-size:16px;font-weight:normal;text-align:left">
A problem has occurred when trying to deliver your mail to <a style='color:#212121;text-decoration:none'><b>{recipients}</b></a> . Look below for the technical details.
</td></tr>
</tbody></table>
</td></tr>
</tbody></table>
</td></tr>
<tr style="border:none;background-color:#fff;font-size:12.8px;width:90%">
<td align="left" style="padding:48px 10px">
Reaction of the server: <br/>
<p style="font-family:monospace">
{reason}
</p>
</td>
</tr>
</tbody></table>
</body>
</html>
EOF
cat <<-EOF >>${DATADIR}/config/outbound.bounce_message_image
Content-Type: image/png; name="icon.png"
Content-Disposition: attachment; filename="icon.png"
Content-Transfer-Encoding: base64
Content-ID: <icon.png>
iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAYAAADnRuK4AAAAAXNSR0IArs4c6QAAFi1JREFUeAHt
XUmMHVcVrfo9eYgUWDBsEsAxCQQFFCkSzsQgBQeMQGIBScSwYFoghg0CNoAlhgWjWLBhB0gMYsEO
Z7AgQOwECRRCxBBwOwwLIGwwsdPt7v9/cc6571ZVO2771++q/6uq37N/1Xt3elX3nn9fVfXt6iSJ
LXogeiB6IHogeiB6IHogeiB6IHogeiB6IHogeiB6IHogeiB6IHogeiB6IHogeiB6IHogeiB6IHog
eiB6IHogeiB6IHogeiB6IHogeiB6IHogeiB6IHqgux5Iu3vozRx5dvTo4PRD9909TrIjmOF6zZIm
vx9k6bEDt935g/To0XEzM3fTagRQKW6n7rz19dl49M0ky15eIhfdNP1jspB86KX3PvJgQdzdvQig
EP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+k
nyS/oHyVVhlAePT9HR5rlUn6KLtXyxl/Q9WDgrOUVyxE7BNIwgTjGkJHIQaU8bdm3lS9TyAKcFAM
5iTPWWxJQo+64HvmUV8TBkAQudK3PVRNlsdAoyI/W39haenb4aAm3lUG0NXHTq7i0eXUj74nPrIO
CO5bxDWR/5ozgpIHBl2G3zMQT4VjirARAAokg6mOVIs+BfCRSaHI5GiB/9yS9jKqjfTzLCV9SOSs
0AkWyCjr49nUF69/4Fd/4fFVaW61ig7OOUtXDx/6Ns793ZUUeyrMdwc9s4G3duD8GG9/UEhYKB/J
y9iA6QG123UjeBD8Fl4PLGXJLcIOujaiTTQSBK5glH0JGGhs2aKgMSxbFXp59iJ/MPjeDT/99bsw
P4UrtcoZiNY50cEHfvUevMf47TiPSk8uKx1dR4T3IhPt5XMiNIXXg8l4eJyNacFHPyQeUulQfbh0
MWsRdHkkyWMDQToc8oMB4y1VMCVGAXQwEo9yomNPmimSBvsSTf+FWN79yp/95p3TgAcGZZX7qVt2
9HWLp0+cfy3+puPbcJA34sBegMX/hTji/VMb7agiM9Ea/kqzoh3OAYEJF9UWQNzp4F/Z8eDza2wB
zTmUZuPeNWjLaUSGgGaIsynBVsajjtZPGeWAafEc2P8G6194W95vs6WFH99w2/4H06MP7vzvkuuo
4iZ6IHogeiB6IHogeiB6IHogeiB6IHogeiB6IHogeiB6IHogeiB6IHogeiB6IHogeiB6IHogeiB6
IHogeiB6IHogeiB6IHogeiB6IHogemBaD/wfWl0tzAXA/nAAAAAASUVORK5CYII=
EOF
fi
#enable toobusy plugin
sed -i 's/^#toobusy$\?/toobusy/g' ${DATADIR}/config/plugins
sed -i 's/^#relay$\?/relay/g' ${DATADIR}/config/plugins
#smtp
sed -i "s/^;listen=\[::0\]:25$\?/listen=\[::0\]:${SMTP_PORT}/g" ${DATADIR}/config/smtp.ini
echo "true" >${DATADIR}/config/header_hide_version
echo "$HEADER" >${DATADIR}/config/ehlo_hello_message
#enable spf
sed -i 's/^#spf$\?/spf/g' ${DATADIR}/config/plugins
sed -i '/max_unrecognized_commands/d' ${DATADIR}/config/plugins
if [[ -n "$TLS_KEY" ]] && [[ -n "$TLS_CERT" ]]; then
#enable tls
# grab tls_key and tls_cert values from the env and generate the relevant files
# TLS_KEY AND TLS_CERT env must be an encoded base64 for this to work
(echo $TLS_KEY | base64 -d) >${DATADIR}/config/tls_key.pem
(echo $TLS_CERT | base64 -d) >${DATADIR}/config/tls_cert.pem
#enable tls
sed -i "s/^#\s*tls/tls/" ${DATADIR}/config/plugins
cat <<-EOF >>${DATADIR}/config/tls.ini
[outbound]
key=tls_key.pem
cert=tls_cert.pem
dhparam=dhparams.pem
EOF
fi
if [[ -n "$DKIM_PRIVATE_KEY" ]] && [[ -n "$DOMAIN" ]]; then
#enable dkim sign
sed -i 's/^#dkim_sign$\?/dkim_sign/g' ${DATADIR}/config/plugins
cd ${DATADIR}/config/dkim/
initDkim
cd -
selector=$(cat ${DATADIR}/config/dkim/${DOMAIN}/selector)
cat <<-EOF >>${DATADIR}/config/dkim_sign.ini
disabled = false
selector = $selector
domain=$DOMAIN
headers_to_sign = From, Sender, Reply-To, Subject, Date, Message-ID, To, Cc, MIME-Version
dkim.private.key=${DATADIR}/config/dkim/${DOMAIN}/private
EOF
fi
#enable outbound
cat <<-EOF >>${DATADIR}/config/outbound.ini
relaying = true
received_header = ${HEADER}
received_header_disabled=true
EOF
#enable log
cat <<-EOF >${DATADIR}/config/log.ini
level=${LOGLEVEL}
timestamps=false
format=logfmt
EOF
#enable spf
cat <<-EOF >>${DATADIR}/config/spf.ini
[relay]
context=sender
context=myself
EOF
#enable data.header check
cat <<-EOF >>${DATADIR}/config/data.headers.ini
[check]
duplicate_singular=true
missing_required=true
invalid_return_path=true
invalid_date=true
user_agent=true
direct_to_mx=true
from_match=true
mailing_list=true
delivered_to=true
[reject]
missing_required=true
invalid_date=true
EOF
#enable auth_flat_file
sed -i "s/^#\s*auth\/flat_file/auth\/flat_file/" ${DATADIR}/config/plugins
cat <<-EOF >>${DATADIR}/config/auth_flat_file.ini
[core]
methods=PLAIN,LOGIN,CRAM-MD5
[users]
${SMTP_USER}=${SMTP_PASSWORD}
EOF
fi
#start haraka
stat -c "%U" ${DATADIR} | grep -q smtp || chown -R smtp:smtp ${DATADIR}
exec haraka -c ${DATADIR}