oneuptime/Haraka/init.sh

27 lines
1014 B
Bash
Raw Normal View History

2023-08-15 13:39:57 +00:00
# Setup auth
echo "domain = $DOMAIN" >> /harakaapp/config/dkim_sign.ini
echo "$DOMAIN" > /harakaapp/config/host_list
echo "$DOMAIN" > /harakaapp/config/me
echo "$SMTP_USERNAME=$SMTP_PASSWORD" >> /harakaapp/config/auth_flat_file.ini
openssl req -x509 -nodes -days 2190 -newkey rsa:2048 -keyout /harakaapp/config/tls_key.pem -out /harakaapp/config/tls_cert.pem -subj "/C=US/ST=Massachusetts/L=Boston/O=Hackerbay/CN=$DOMAIN"
# DKIM
mkdir -p /harakaapp/config/dkim/$DOMAIN
touch /harakaapp/config/dkim/$DOMAIN/selector
2023-08-15 20:59:44 +00:00
echo "$DKIM_SELECTOR" > /harakaapp/config/dkim/$DOMAIN/selector
2023-08-15 13:39:57 +00:00
# Decode keys from base64
echo "$DKIM_PUBLIC_KEY" | base64 -d > /harakaapp/config/dkim/$DOMAIN/public
echo "$DKIM_PRIVATE_KEY" | base64 -d > /harakaapp/config/dkim/$DOMAIN/private
2023-08-15 20:59:44 +00:00
echo "IMPORTANT: Add this to your DNS"
echo "You need to add this to DNS"
echo "Type: TXT"
echo "Key: $DKIM_SELECTOR._domainkey"
echo "v=DKIM1;p=$(grep -v '^-' /harakaapp/config/dkim/$DOMAIN/public | tr -d '\n')"
2023-08-15 13:39:57 +00:00
# Run haraka
haraka -c /harakaapp