Skip to content

Commit c15b978

Browse files
committed
Downgrade DKIM_KEYFILE mode and owner setting to warning on failure
1 parent dff2181 commit c15b978

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

etc/opendkim.conf.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ if [ ! -f "${DKIM_KEYFILE}" ]; then
2525
s6-svscanctl -t /etc/s6
2626
exit 128
2727
else
28-
echo "dkim >> Setting mode and owner on $DKIM_KEYFILE"
29-
chown root:root ${DKIM_KEYFILE}
30-
chmod 400 ${DKIM_KEYFILE}
28+
echo "dkim >> Checking mode and owner on $DKIM_KEYFILE"
29+
if [ "$(stat -c "%U:%G" "${DKIM_KEYFILE}")" != "root:root" ]; then
30+
chown root:root "${DKIM_KEYFILE}" || { echo "dkim >> Warning: could not set owner on DKIM_KEYFILE"; }
31+
fi
32+
if [ "$(stat -c "%a" "${DKIM_KEYFILE}")" != "400" ]; then
33+
chmod 400 "${DKIM_KEYFILE}" || { echo "dkim >> Warning: could not set mode on DKIM_KEYFILE"; }
34+
fi
3135
fi
3236

3337
# Status Output

0 commit comments

Comments
 (0)