Fix Dockerfile, again
parent
61de3c354c
commit
a7b854f7ce
|
@ -51,10 +51,35 @@ for file in $(ls /data/dkim/keys/); do
|
|||
domain=${file%.dkim}
|
||||
if [[ -f /data/dkim/txt/${file} ]]; then
|
||||
redis-cli -h redis-mailcow HSET DKIM_PUB_KEYS "${domain}" "$(cat /data/dkim/txt/${file})"
|
||||
redis-cli -h redis-mailcow HSET DKIM_PRIV_KEYS "${domain}" "$(cat /data/dkim/keys/${file})"
|
||||
redis-cli -h redis-mailcow HSET DKIM_PRIV_KEYS "dkim.${domain}" "$(cat /data/dkim/keys/${file})"
|
||||
redis-cli -h redis-mailcow HSET DKIM_SELECTORS "${domain}" "dkim"
|
||||
fi
|
||||
rm /data/dkim/{keys,txt}/${file}
|
||||
done
|
||||
|
||||
# Fix DKIM keys
|
||||
|
||||
# Fetch domains
|
||||
declare -a DOMAIN_ARRAY
|
||||
while read line
|
||||
do
|
||||
DOMAIN_ARRAY+=("$line")
|
||||
done < <(mysql -h mysql-mailcow -u ${DBUSER} -p${DBPASS} ${DBNAME} -e "SELECT domain FROM domain" -Bs)
|
||||
while read line
|
||||
do
|
||||
DOMAIN_ARRAY+=("$line")
|
||||
done < <(mysql -h mysql-mailcow -u ${DBUSER} -p${DBPASS} ${DBNAME} -e "SELECT alias_domain FROM alias_domain" -Bs)
|
||||
|
||||
# Loop through array and fix keys
|
||||
if [[ ! -z ${DOMAIN_ARRAY} ]]; then
|
||||
for domain in "${DOMAIN_ARRAY[@]}"; do
|
||||
WRONG_KEY=$(redis-cli -h redis-mailcow HGET DKIM_PRIV_KEYS ${domain} | tr -d \")
|
||||
if [[ ! -z ${WRONG_KEY} ]]; then
|
||||
echo "Migrating defect key for domain ${domain}"
|
||||
redis-cli -h redis-mailcow HSET DKIM_PRIV_KEYS "dkim.${domain}" ${WRONG_KEY}
|
||||
redis-cli -h redis-mailcow HDEL DKIM_PRIV_KEYS "${domain}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
|
|
Loading…
Reference in New Issue