trusteddomainproject / OpenDKIM

Other
90 stars 51 forks source link

Can't connect to memcached #218

Open mattparlane opened 1 month ago

mattparlane commented 1 month ago

Hi all... Not sure if this is a bug, but I'm stumped.

I'm trying to connect opendkim with memcached, but I'm getting the following error:

root@ad66fb76c1d5:~# /usr/sbin/opendkim -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim.pid
opendkim: opendkim-db.c:6433: dkimf_db_walk: Assertion `0' failed.
Aborted (core dumped)

Here are the relevant lines from my opendkim.conf:

KeyTable memcache:localhost/key
SigningTable memcache:localhost/sign

and here is my command line:

/usr/sbin/opendkim -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim.pid

memcached is indeed running and accessible:

root@ad66fb76c1d5:~# telnet localhost 11211
Trying ::1...
Connected to localhost.
Escape character is '^]'.
stats
STAT pid 7
STAT uptime 4018
...

I'm using the Ubuntu distribution of opendkim, and it is compiled with memcache support.

Any ideas? Thanks!

futatuki commented 1 month ago

The function dkimf_db_walk() don't have the code for db->db_type == DKIMF_DB_TYPE_MEMCACHE.

Function dkimf_db_walk() is used for SigningTable in opendkim.c (opendkim(8)), for KeyTable in opendkim-genzone.c (opendkim-genzone(8)) and opendkim-testkey.c (opendkim-testkey(8)), for ReputationLimits and ReputationLimitModifiers in reputation.c (opendkim(8)), and for ATPS db in opedkim-atpszone.c (opendkim-atpszone(8); obsolete).

So we can't use memecache DB for SigningTable, ReputationLimits and ReputationLimitModifiers datasets, and if we use memcache DB for KeyTable, we cant use opendkim-genzone(8) and opendkim-testkey(8).

futatuki commented 1 month ago

With the patch in PR #219, opendkim(8) might avoid assertion failure caused by unhandled DB type in dkimf_db_walk(). opendkim(8) would not crash on the verification of SigningTable even if it is memecache, although it is not mean directly that we can use memecached for SigningTable.