Skip to content
Browse files

Generate opendkim configuration in stretch when alternc.install is run

The default configuration in stretch doesn't work very well and
needs a couple of tweaks. This will generate the service files and
make sure opendkim is run as the opendkim user instead of root.

The alternc opendkim.conf template is updated so that the connection
can be made locally through a socket.
  • Loading branch information...
kienanstewart authored and vincib committed Jun 14, 2018
1 parent e2edab6 commit 9efd1d715407979b44afa26578a40cbbf0bfc487
Showing with 13 additions and 0 deletions.
  1. +4 −0 etc/alternc/templates/opendkim.conf
  2. +9 −0 install/alternc.install
@@ -14,3 +14,7 @@ KeyTable /etc/opendkim/KeyTable
SigningTable /etc/opendkim/SigningTable
ExternalIgnoreList /etc/opendkim/TrustedHosts
InternalHosts /etc/opendkim/TrustedHosts

# The value from /etc/default/opendkim doesn't seem to be taken into account
# @see
Socket local:/var/run/opendkim/opendkim.sock
@@ -595,6 +595,15 @@ touch /etc/opendkim/TrustedHosts /etc/opendkim/SigningTable /etc/opendkim/KeyTab
grep -q "^\$" /etc/opendkim/TrustedHosts || echo "" >>/etc/opendkim/TrustedHosts
grep -q "^localhost\$" /etc/opendkim/TrustedHosts || echo "localhost" >>/etc/opendkim/TrustedHosts
grep -q "^$PUBLIC_IP\$" /etc/opendkim/TrustedHosts || echo "$PUBLIC_IP" >>/etc/opendkim/TrustedHosts
if [ "$(lsb_release -s -c)" == 'stretch' ] ; then
# Without adding '-u opendkim' after the service file is generated, opendkim
# will run as root, which we do not want.
if [ "$(grep -c 'u opendkim' /etc/systemd/system/opendkim.service.d/override.conf)" == 0 ] ; then
sed 's/inet:8891@ -u opendkim/' /etc/systemd/system/opendkim.service.d/override.conf
systemctl daemon-reload

# Add opendkim to service to restart

0 comments on commit 9efd1d7

Please sign in to comment.
You can’t perform that action at this time.