How to configure the socket for opendkim on Debian Testing/Stretch

You are configuring it correctly, but this is an open bug with Debian Stretch where it ignores configuration:

See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864162


Editing a systemd unit isn't a best practice of course. Here is how we should go:

sudo systemctl edit opendkim

and insert:

[Service]
ExecStart=
ExecStart=/usr/sbin/opendkim -P /var/run/opendkim/opendkim.pid -p local:/var/spool/postfix/opendkim/opendkim.sock

(note the double ExecStart - this is not a typo)