opendkim Service unavailable

  • Ok. I'll fix the issue after some tests and provide a new version of the plugin.


    Thanks for your report and tests.


    BTW: Best is to copy the file under /etc/systemd/system and modify the copied file and then, run: systemctl daemon-reload. You shouldn't edit the files under the /lib/systemd directory ;)

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Systemd doesn't accept variables everywhere... and worse, will not resolve variable from the /etc/default/opendkim file. Eg:


    Shell-Script
    1. juil. 18 23:46:37 stretch systemd[1]: Starting OpenDKIM DomainKeys Identified Mail (DKIM) Milter...
    2. juil. 18 23:46:37 stretch opendkim[11280]: can't write pid to $RUNDIR/$NAME.pid: No such file or directory
    3. juil. 18 23:46:37 stretch opendkim[11280]: OpenDKIM Filter: Unable to bind to port local:$RUNDIR/opendkim.sock: No such file or directory


    So, we need also fix the default file or use static path in the service file... That a mess...


    I need to perform some tests...
    .

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • @TheCry


    I end with the folllowing service conffile:


    Shell-Script
    1. [Unit]Description=OpenDKIM DomainKeys Identified Mail (DKIM) MilterDocumentation=man:opendkim(8) man:opendkim.conf(5) man:opendkim-genkey(8) man:opendkim-genzone(8) man:opendkim-testadsp(8) man:opendkim-testkey http://www.opendkim.org/docs$After=network.target nss-lookup.target[Service]Type=forkingEnvironmentFile=-/etc/default/opendkim#PIDFile=/var/spool/postfix/var/run/opendkim/opendkim.pidUser=opendkimGroup=opendkimUMask=0007ExecStart=/usr/sbin/opendkim -x /etc/opendkim.conf -u $USER -P $PIDFILE -p $SOCKET#Restart=on-failureExecReload=/bin/kill -USR1 $MAINPID[Install]WantedBy=multi-user.target


    which work fine. I had in order to:

    • Install the service file above under /etc/systemd/system/opendkim.service
    • Reload systemd daemon: systemctl daemon-reload
    • Set both SOCKET and PIDFILE variables into the /etc/default/opendkim file
    • Create the /var/spool/postfix/var/run/opendkim directory with opendkim as ownershop

    I'll see if I really need define the PIDFile= parameter in the service file which I would avoid.


    Current result:


    Shell-Script
    1. root@stretch:/usr/local/src/imscp# service opendkim start && service opendkim status● opendkim.service - OpenDKIM DomainKeys Identified Mail (DKIM) MilterLoaded: loaded (/etc/systemd/system/opendkim.service; enabled; vendor preset: enabled)Active: active (running) since Wed 2017-07-19 00:28:51 CEST; 12ms agoDocs: man:opendkim(8)man:opendkim.conf(5)man:opendkim-genkey(8)man:opendkim-genzone(8)man:opendkim-testadsp(8)man:opendkim-testkeyhttp://www.opendkim.org/docs.htmlProcess: 12865 ExecStart=/usr/sbin/opendkim -x /etc/opendkim.conf -u $USER -P $PIDFILE -p $SOCKET (code=exited, status=0/SUCCESS)Main PID: 12866 (opendkim)Tasks: 7 (limit: 4915)CGroup: /system.slice/opendkim.service└─12866 /usr/sbin/opendkim -x /etc/opendkim.conf -u opendkim -P /var/spool/postfix/var/run/opendkim/opendkim.pid -p local:/var/spool/postfix/var/run/opendkim/opendkim.sockjuil. 19 00:28:51 stretch systemd[1]: Starting OpenDKIM DomainKeys Identified Mail (DKIM) Milter...juil. 19 00:28:51 stretch systemd[1]: Started OpenDKIM DomainKeys Identified Mail (DKIM) Milter.juil. 19 00:28:51 stretch opendkim[12866]: OpenDKIM Filter v2.11.0 starting (args: -x /etc/opendkim.conf -u opendkim -P /var/spool/postfix/var/run/opendkim/opendkim.pid -p local:/var/spool/postfix/var/run/opendkim/opendkim.sock)root@stretch:/usr/local/src/imscp#
    Shell-Script
    1. root@stretch:/usr/local/src/imscp# ls -la /var/spool/postfix/var/run/opendkim/total 12drwxr-xr-x 2 opendkim root 4096 juil. 19 00:30 .drwxr-xr-x 3 root root 4096 juil. 19 00:13 ..-rw-rw---- 1 opendkim opendkim 6 juil. 19 00:30 opendkim.pidsrwxrwx--- 1 opendkim opendkim 0 juil. 19 00:30 opendkim.sockroot@stretch:/usr/local/src/imscp#


    I should probably set socket permissions to 666... or add postfix user to opendkim group, else, Postfix will not be able to connect to the opendkim UDS...


    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • @Nuxwin
    I did the changes. But i did not use

    Quote

    Create the /var/spool/postfix/var/run/opendkim directory with opendkim as ownershop

    I still using

    Quote

    /var/spool/postfix/opendkim

    Otherwise the milter entry in the main.cf must be changed, too.


    On my system the OpenDKIM works now fine

  • @TheCry


    Thank you for your feedback.


    In fact, I want change the path only for consistency with the other services. For instance, in previous i-MSCP versions, the /var/run/courier/authdaemon directory was mounted into the /var/spool/postfix/private/authdaemon directory but with the new Postfix versions, the /etc/postfix/postfix-script check for ownership of directory/file stored inside its directories and raises warnings such as:


    Shell-Script
    1. Jul 19 08:42:32 stretch postfix/postfix-script[16999]: warning: not owned by postfix: /var/spool/postfix/private/authdaemon
    2. Jul 19 08:42:32 stretch postfix/postfix-script[17000]: warning: not owned by postfix: /var/spool/postfix/private/authdaemon/pid
    3. Jul 19 08:42:32 stretch postfix/postfix-script[17001]: warning: not owned by postfix: /var/spool/postfix/private/authdaemon/pid.lock
    4. Jul 19 08:42:32 stretch postfix/postfix-script[17031]: starting the Postfix mail system
    5. Jul 19 08:42:32 stretch postfix/master[17033]: daemon started -- version 3.1.4, configuration /etc/postfix

    when the directory/files are not owned by the postfix user.


    So yes, for the /var/spool/postfix/opendkim directory, there is no problem as this directory doesn't directly belong to Postfix but, I just like to be consistent:

    • /var/spool/postfix/var/run/courier/authdaemon directory
    • /var/spool/postfix/var/run/opendkim directory
    • ...

    In short, the layout should be in my eyes: <POSTFIX_CHROOT_PATH>/<SERVICE_RUNDIR_PATH>

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • You have to change this manually or is the next update corrected?

    Please open your eyes. The thread is still set with to be fixed.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206