Menu

#79 Start script should try to get pid file from opendkim.conf

2.4.0
closed-accepted
opendkim (95)
6
2011-06-28
2011-06-06
No

opendkim -V
opendkim: OpenDKIM Filter v2.4.0
Compiled with OpenSSL 1.0.0d 8 Feb 2011
SMFI_VERSION 0x1000001
libmilter version 1.0.1
Supported signing algorithms:
rsa-sha1
rsa-sha256
Supported canonicalization algorithms:
relaxed
simple
Active code options:
USE_DB
libopendkim 2.4.0:

ldd `which opendkim`
linux-gate.so.1 => (0xf57fe000)
libopendkim.so.4 => /usr/local/lib/libopendkim.so.4 (0xb7714000)
libresolv.so.2 => /lib/libresolv.so.2 (0xb76fd000)
libssl.so.1.0.0 => /usr/local/ssl/lib/libssl.so.1.0.0 (0xb76ab000)
libcrypto.so.1.0.0 => /usr/local/ssl/lib/libcrypto.so.1.0.0 (0xb752f000)
libdl.so.2 => /lib/libdl.so.2 (0xb752a000)
libz.so.1 => /lib/libz.so.1 (0xb7513000)
libdb-4.5.so => /usr/lib/libdb-4.5.so (0xb73ce000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb73b3000)
libc.so.6 => /lib/libc.so.6 (0xb7246000)
/lib/ld-linux.so.2 (0xb774b000)

opendkim -x /usr/local/etc/opendkim.conf
opendkim: smfi_opensocket() failed

Not sure what other/additional info is needed or helpful.

Discussion

  • Murray S. Kucherawy

    The contents of your opendkim.conf would be helpful.

     
  • Murray S. Kucherawy

    • status: open --> pending
     
  • Todd A. Lyons

    Todd A. Lyons - 2011-06-06

    Is this a new install or an upgrade? Which distro and version? Seems like you compiled from source since you are using /usr/local/etc/opendkim.conf.

    egrep -i ^Socket /usr/local/etc/opendkim.conf

    If it's a local unix socket, make sure the path can be accessed by the user that opendkim runs as. If it's a TCP socket, make sure nothing is listening already on that port:

    CentOS49[root@smtp4 ~]# egrep -i ^socket /usr/local/etc/opendkim.conf
    Socket inet:49999@localhost
    CentOS49[root@smtp4 ~]# netstat -ltnp | grep :49999
    tcp 0 0 127.0.0.1:49999 0.0.0.0:* LISTEN 5892/opendkim

     
  • Anonymous

    Anonymous - 2011-06-06
    • status: pending --> open
     
  • Anonymous

    Anonymous - 2011-06-06

    it looks like the PID's not acting like I think it should.

    > Is this a new install or an upgrade?

    new install. well, technically, a new build installed over an old install.

    > Which distro and version?

    opensuse 11.4/64

    > Seems like you compiled from source since you are using /usr/local/etc/opendkim.conf.

    that's correct.

    > egrep -i ^Socket /usr/local/etc/opendkim.conf

    egrep -i ^Socket /usr/local/etc/opendkim.conf
    Socket inet:9999@localhost

    > If it's a TCP socket, make sure nothing is listening already on that port:

    service opendkim start
    opendkim: smfi_opensocket() failed

    netstat -ltnp | grep :9999
    tcp 0 0 127.0.0.1:9999 0.0.0.0:* LISTEN 12877/opendkim
    service opendkim stop
    OpenDkim is already stopped.
    netstat -ltnp | grep :9999
    tcp 0 0 127.0.0.1:9999 0.0.0.0:* LISTEN 12877/opendkim

    ???

    kill -9 12877
    netstat -ltnp | grep :9999
    tcp 0 0 127.0.0.1:9999 0.0.0.0:* LISTEN 12877/opendkim

    really ???

    shutdown -r now

    tic ... toc ... tic ... toc ...

    netstat -ltnp | grep :9999
    service opendkim-custom start
    Starting OpenDkim.
    NO Error ...
    netstat -ltnp | grep :9999
    tcp 0 0 127.0.0.1:9999 0.0.0.0:* LISTEN 11927/opendkim
    opendkim -x /usr/local/etc/opendkim.conf
    opendkim: smfi_opensocket() failed
    service opendkim stop
    OpenDkim is already stopped.
    netstat -ltnp | grep :9999
    tcp 0 0 127.0.0.1:9999 0.0.0.0:* LISTEN 12927/opendkim

    Confusion.

    > The contents of your opendkim.conf would be helpful.

    cat /etc/init.d/opendkim
    ----------------
    #!/bin/sh
    set -e

    ### BEGIN INIT INFO
    # Provides: opendkim
    # Required-Start: $local_fs $remote_fs $network $syslog $time
    # Required-Stop: $local_fs $remote_fs $network $syslog
    # Should-Start:
    # Should-Stop:
    # Default-Start: 3 5
    # Default-Stop: 0 1 2 4 6
    # Short-Description: OpenDkim init script
    # Description: Init script for OpenDkim services
    ### END INIT INFO

    OPENDKIM_BIN=/usr/local/sbin/opendkim
    OPENDKIM_CONF=/usr/local/etc/opendkim.conf
    OPENDKIM_PID=/var/run/opendkim.pid

    # Uncomment to allow Dovecot daemons to produce core dumps.
    #ulimit -c unlimited

    if test -f $OPENDKIM_PID; then
    running=yes
    else
    running=no
    fi

    case "$1" in
    start)
    echo -n "Starting OpenDkim"
    $OPENDKIM_BIN -x $OPENDKIM_CONF
    echo "."
    ;;
    stop)
    if test $running = yes; then
    echo "Stopping OpenDkim"
    kill `cat $OPENDKIM_PID`
    echo "."
    else
    echo "OpenDkim is already stopped."
    fi
    ;;
    restart)
    $0 stop
    $0 start
    echo "."
    ;;
    *)
    echo "Usage: /etc/init.d/opendkim-custom {start|stop|restart}" >&2
    exit 1
    ;;
    esac
    exit 0
    ----------------

    killall opendkim
    service opendkim start
    Starting OpenDkim.
    cat /var/run/opendkim.pid
    cat: /var/run/opendkim.pid: No such file or directory

    ???

    grep -i pid /usr/local/etc/opendkim.conf
    PidFile /var/run/opendkim.pid

    cat /usr/local/etc/opendkim.conf
    ----------------
    Background Yes
    Canonicalization relaxed/simple
    ClockDrift 300
    Diagnostics yes
    DNSTimeout 10
    Domain eval.loc
    DomainKeysCompat no
    EnableCoredumps no
    FixCRLF no
    InternalHosts /var/db/dkim/internal_hosts
    KeepTemporaryFiles no
    KeyFile /home/eval/dkim/dkim.eval.loc.pem
    LogWhy yes
    MaximumHeaders 65536
    MilterDebug 0
    Minimum 0
    Mode sv
    MultipleSignatures no
    NoHeaderB no
    PidFile /var/run/opendkim.pid
    Quarantine no
    ReportAddress eval@localhost
    RequireSafeKeys Yes
    ResolverTracing no
    Selector key1.eval
    SendADSPReports No
    SendReports No
    SignatureAlgorithm rsa-sha256
    SignatureTTL 0
    Socket inet:9999@localhost
    StrictHeaders no
    StrictTestMode no
    SubDomains No
    Syslog yes
    SyslogFacility mail
    SyslogSuccess yes
    TemporaryDirectory /var/tmp
    UserID dkim:dkim
    X-Header yes
    ----------------

     
  • Anonymous

    Anonymous - 2011-06-06

    opendkim -x /usr/local/etc/opendkim.conf -P /var/run/opendkim.pid
    ls -al /var/run/opendkim.pid
    /bin/ls: cannot access /var/run/opendkim.pid: No such file or directory
    killall opendkim
    mkdir -p /var/run/opendkim
    chown dkim:dkim /var/run/opendkim
    opendkim -x /usr/local/etc/opendkim.conf -P /var/run/opendkim/opendkim.pid
    ls -al /var/run/opendkim/opendkim.pid
    -rw-r--r-- 1 dkim dkim 6 Jun 6 14:27 /var/run/opendkim/opendkim.pid
    cat /var/run/opendkim/opendkim.pid
    13113
    ps ax | grep opendkim
    13113 ? Ssl 0:00 opendkim -x /usr/local/etc/opendkim.conf -P /var/run/opendkim/opendkim.pid

    Changing to THAT pid dir in the init.d should do it.

     
  • Murray S. Kucherawy

    If you're using contrib/init/redhat/opendkim as your start/stop script, it just means your config file and the pid file it expects aren't the same.

    You can have the auto-build stuff use a matching pathname by specifying "--localstatedir=/var" to ./configure.

     
  • Murray S. Kucherawy

    • status: open --> pending
     
  • Anonymous

    Anonymous - 2011-06-06

    > If you're using contrib/init/redhat/opendkim as your start/stop script, it
    > just means your config file and the pid file it expects aren't the same.

    i of course mad any mods necessary before launch -- this was, after all, running find with opendkim 2.3.2.

    both @ cmd line, and using PidFile spec in config file should be sufficient to override any/all build-time localstatedir spec, right?

    the issue seems to have been that, since exec was as uid:gid(dkim:dkim), that perms on /var/run were no longer sufficient. creating /var/run/opendkim, setting it to dkim:dkim ownership, and putting the pid in there did the trick.

    in any case, all better now.

     
  • Anonymous

    Anonymous - 2011-06-06
    • status: pending --> open
     
  • Murray S. Kucherawy

    Changing the description accordingly. Will try to fix this for 2.4.1.

     
  • Murray S. Kucherawy

    • summary: v2.4.0 exec fails @ "opendkim: smfi_opensocket() failed" --> Start script should try to get pid file from opendkim.conf
     
  • Murray S. Kucherawy

    • priority: 5 --> 6
     
  • Murray S. Kucherawy

    • assigned_to: nobody --> cm-msk
     
  • Murray S. Kucherawy

    Done for 2.4.1.

     
  • Murray S. Kucherawy

    This change to the script has been reverted. After talking to other Linux users in our community, consensus appears to be that if you are going to use a pid file different from the one hard-coded in the script, you're tinkering enough already that you should be able to make your config file and the script match on your own.

    Nevertheless, 2.4.1 includes a method to extract config values via the binary (new "-e" switch) so you can hack this back in easily if you like.

     
  • Murray S. Kucherawy

    • status: open --> pending
     
  • Murray S. Kucherawy

    • status: pending --> closed-accepted
     
  • Murray S. Kucherawy

    Fix for this bug included in new release.

     

Log in to post a comment.

MongoDB Logo MongoDB