Files
NewSzxcn-Email/deploy/opendkim/entrypoint.sh
T
LanQin 3ef8caa319 feat(email): 初始化自建邮箱 MVP
- 新增 Go + SQLite 后端,支持登录、域名、邮箱、别名、联系人、规则、统计与邮件收发。
- 新增 Webmail 前端,支持多邮箱切换、邮件列表/阅读/写信、附件、搜索、主题切换与个人中心。
- 新增 Docker Compose 部署骨架,补充 Postfix、Dovecot、OpenDKIM、Nginx 配置与部署说明。
2026-06-15 00:38:50 +08:00

20 lines
793 B
Bash

#!/bin/sh
set -eu
mkdir -p /etc/opendkim/keys
: > /etc/opendkim/KeyTable
: > /etc/opendkim/SigningTable
if [ -f /data/lanqin.db ]; then
sqlite3 -separator '|' /data/lanqin.db "SELECT name, dkim_selector, dkim_private_key FROM domains WHERE status='active';" | while IFS='|' read -r domain selector private_key; do
[ -n "$domain" ] || continue
dir="/etc/opendkim/keys/$domain"
mkdir -p "$dir"
keyfile="$dir/$selector.private"
printf '%s' "$private_key" | base64 -d > "$keyfile"
chmod 600 "$keyfile"
echo "$selector._domainkey.$domain $domain:$selector:$keyfile" >> /etc/opendkim/KeyTable
echo "*@${domain} ${selector}._domainkey.${domain}" >> /etc/opendkim/SigningTable
done
fi
chown -R opendkim:opendkim /etc/opendkim
exec opendkim -f -x /etc/opendkim.conf