I'm having some trouble getting spampd to work in OpenBSD. First off, if I try to specify the daemon flags in my /etc/rc.conf.local
like so:
spampd_flags="--port=10025 --relayhost=127.0.0.1:10027 --tagall -aw"
The service does not start with those flags at startup. I have to restart the service before it will pick up those flags. I found the following article mentioning the same issue from back in 2015:
http://technoquarter.blogspot.com/2015/02/openbsd-mail-server-part-4-spamassassin.html
As a workaround, I created a /etc/rc.d/spampd_custom
script that looks like the following:
#!/bin/ksh
daemon="/usr/local/sbin/spampd --port=10025 --relayhost=127.0.0.1:10027 --tagall -aw"
. /etc/rc.d/rc.subr
rc_cmd $1
..and I added spampd_custom
to the pkg_scripts
in my /etc/rc.conf/local
. This does start up the service with the correct flags, but the service will fail when attempting to make an SMTP connection. I ran it in the foreground and see this in the output:
# /usr/local/sbin/spampd --port=10025 --relayhost=127.0.0.1:10027 --tagall -aw
Jul 14 04:32:24 lori spampd[40465]: Pid_file "/var/run/spampd.pid" already exists. Overwriting!
Jul 14 04:32:24 lori spampd[4112]: Process Backgrounded
lori# Jul 14 04:32:24 lori spampd[4112]: 2018/07/14-04:32:24 SpamPD (type Net::Server::PreForkSimple) starting! pid(4112)
Jul 14 04:32:24 lori spampd[4112]: Binding to TCP port 10025 on host 127.0.0.1 with IPv4
Jul 14 04:32:24 lori spampd[4112]: Setting gid to "746 746"
Jul 14 04:32:24 lori spampd[4112]: Setting uid to "746"
Jul 14 04:32:39 lori spampd[93147]: WARNING!! Error in process_request eval block: /usr/local/sbin/spampd: socket connect failure: Connection refused
WARNING!! Error in process_request eval block: /usr/local/sbin/spampd: socket connect failure: Connection refused
I've tried several searches for this and have found some bug reports on the Debian tracker, but can't seem to find a solution. It seems like this is a socket used by the parent spampd to communicate with its children that doesn't seem to be setup correctly.
What is wrong with my configuration?
This ended up being a bug, which I did a full write-up on. The spampd maintainer created an issue and the OpenBSD team pulled the changed downstream. This should be fixed in newer releases of OpenBSD/spampd.