OpenDKIM icon indicating copy to clipboard operation
OpenDKIM copied to clipboard

Statistics file not available

Open rfmoz opened this issue 1 year ago • 3 comments

OpenDKIM 2.11.0~beta2-8 Debian package has these compile options:

override_dh_auto_configure:
        CONFIG_SHELL=/bin/sh dh_auto_configure -- \
                CFLAGS="$(CFLAGS) $(CPPFLAGS)" \
                LDFLAGS="$(LDFLAGS) -Wl,-z,defs -L/usr/lib/libmilter" \
                --disable-live-testing \
                --enable-vbr \
                --enable-rbl \
                --enable-atps \
                --enable-stats \
                --enable-replace_rules \
                --enable-query_cache \
                --enable-sender_macro \
                --with-libmemcached \
                --with-openldap \
                --with-db \
                --with-sql-backend \
                --with-sasl \
                --with-domain=localhost \
                --with-lua \
                $(UNBOUND) \
                $(ODBX}

which generate this binary:

# opendkim -V
opendkim: OpenDKIM Filter v2.11.0
	Compiled with OpenSSL 3.0.11 19 Sep 2023
	SMFI_VERSION 0x1000001
	libmilter version 1.0.1
	Supported signing algorithms:
		rsa-sha1
		rsa-sha256
		ed25519-sha256
	Supported canonicalization algorithms:
		relaxed
		simple
	Active code options:
		QUERY_CACHE
		USE_DB
		USE_LDAP
		USE_LUA
		USE_ODBX
		USE_UNBOUND
		_FFR_ATPS
		_FFR_RBL
		_FFR_REPLACE_RULES
		_FFR_SENDER_MACRO
		_FFR_STATS
		_FFR_VBR
	libopendkim 2.11.0: atps query_cache

Stats looks available, but setting on the configuration file /etc/opendkim/opendkim.conf:

Statistics /var/lib/opendkim/stats.dat

Doesn't produce any stats file. Looking into the fd open by the opendkim worker process, doesn't report it on the list:

/proc/1167052/fd
├── 0 -> /dev/null
├── 1 -> /dev/null
├── 10 -> socket:[620656224]
├── 11 -> socket:[620656225]
├── 2 -> /dev/null
├── 3 -> socket:[620654469]
├── 4 -> socket:[620654477]
├── 5 -> pipe:[620654478]
├── 6 -> pipe:[620654478]
├── 8 -> socket:[620656222]
└── 9 -> socket:[620656223]

rfmoz avatar May 06 '24 06:05 rfmoz

I glanced the code, then it seems opendkim does not create statistics file, but fopen with "a" (append) in dkimf_stats_record() in opendkim/stats.c. Also it reports on failure by using syslog if loging is enabled. Isn't there any error log?

futatuki avatar May 06 '24 12:05 futatuki

... it seems opendkim does not create statistics file, but ...

I'm sorry, mode "a" in fopen(3) create the file if it does not exist.

futatuki avatar May 06 '24 14:05 futatuki

Hi Futatuki,

Restarting via system only produces one line on the log: 2024-05-15T12:15:14.865994+02:00 servername opendkim[3413459]: OpenDKIM Filter v2.11.0 starting (args: -x /etc/opendkim/opendkim.conf)

Executing the same instruction via strace, doesn't report any reference, good or bad, to the stats file: strace -f /usr/sbin/opendkim -x /etc/opendkim/opendkim.conf

rfmoz avatar May 15 '24 10:05 rfmoz