summaryrefslogtreecommitdiff
path: root/mail/entrypoint.sh
diff options
context:
space:
mode:
authoryyamashita <yyamashita@hetzner.yyamashita.com>2026-06-01 21:14:58 +0900
committeryyamashita <yyamashita@hetzner.yyamashita.com>2026-06-01 21:14:58 +0900
commitc55ae2d5daf229b12556d6283ba4e5e8161a5eb5 (patch)
treeadb08f555e56ece4792421dfdb40b457c8f75140 /mail/entrypoint.sh
parent5bf46bbac5feda06ec10575c6293974d80b2e3df (diff)
Add Postfix+OpenDKIM MTA with txt-based domain management
- mail/ ディレクトリ追加: Postfix + OpenDKIM の Docker コンテナ - mail/domains.txt で送信ドメインを管理(現在: golive.yyamashita.com) - install.sh が domains.txt から KeyTable/SigningTable を動的生成 - setup-route53.py で SPF/DKIM/DMARC を Route 53 に一括設定 - post-receive フックに mail/deploy.sh を追加 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'mail/entrypoint.sh')
-rwxr-xr-xmail/entrypoint.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/mail/entrypoint.sh b/mail/entrypoint.sh
new file mode 100755
index 0000000..2dc8f26
--- /dev/null
+++ b/mail/entrypoint.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+set -e
+
+KEY_FILE=/etc/opendkim/keys/mail.private
+
+# Wait for DKIM key (mounted from host)
+for i in $(seq 1 30); do
+ [[ -f "$KEY_FILE" ]] && break
+ echo "Waiting for DKIM key at $KEY_FILE ... (run mail/install.sh on host)"
+ sleep 2
+done
+if [[ ! -f "$KEY_FILE" ]]; then
+ echo "ERROR: DKIM key not found at $KEY_FILE" >&2
+ exit 1
+fi
+
+chmod 600 "$KEY_FILE"
+chown opendkim:opendkim "$KEY_FILE"
+
+# Start rsyslog for Postfix logging
+rsyslogd
+
+# Start OpenDKIM (inet socket on localhost:8891)
+opendkim -x /etc/opendkim.conf
+sleep 2
+
+# Start Postfix
+postfix start
+
+# Keep container alive, forward mail log to stdout
+touch /var/log/mail.log
+exec tail -f /var/log/mail.log