Another problem is that the systemd service definition (on 20.04) defaults to "Type=simple", so clamav-daemon.service appears as active even though it's not ready to accept connections yet.
--- /dev/null 2021-06-04 15:21:19.232000000 +0100
+++ /etc/systemd/system/clamav-daemon.service.d/amavis.conf 2021-06-04 15:19:37.335686866 +0100
@@ -0,0 +1,10 @@
+[Unit]
+Before=amavis.service
+
+[Service]
+# clamd allows its clients to shut it down! So access to /run/clamav/clamd.ctl
+# is restricted to a strict minimum. That's only members of the clamav group.
+# The amavis process can only be in one group. It also doesn't need access to
+# any of clamav's private resources. So we're only granting it access to the
+# socket.
+ExecStartPost=/usr/bin/setfacl -m u:amavis:rw /run/clamav/clamd.ctl
Another problem is that the systemd service definition (on 20.04) defaults to "Type=simple", so clamav- daemon. service appears as active even though it's not ready to accept connections yet.
That can be fixed with:
--- /lib/systemd/ system/ clamav- daemon. service 2021-06-04 15:05:34.272466670 +0100 system/ clamav- daemon. service 2021-06-04 15:05:36.072489235 +0100 xistsGlob= /var/lib/ clamav/ daily.{ c[vl]d, inc}
+++ /etc/systemd/
@@ -6,11 +6,11 @@
ConditionPathE
[Service] /usr/sbin/ clamd --foreground=true /usr/sbin/ clamd /bin/kill -USR2 $MAINPID =syslog c=420 c=7min
-ExecStart=
+Type=forking
+ExecStart=
# Reload the database
ExecReload=
-StandardOutput
-TimeoutStartSe
+TimeoutStartSe
[Install] multi-user. target
WantedBy=
after which I can add a:
--- /dev/null 2021-06-04 15:21:19.232000000 +0100 system/ clamav- daemon. service. d/amavis. conf 2021-06-04 15:19:37.335686866 +0100 amavis. service clamd.ctl /usr/bin/ setfacl -m u:amavis:rw /run/clamav/ clamd.ctl
+++ /etc/systemd/
@@ -0,0 +1,10 @@
+[Unit]
+Before=
+
+[Service]
+# clamd allows its clients to shut it down! So access to /run/clamav/
+# is restricted to a strict minimum. That's only members of the clamav group.
+# The amavis process can only be in one group. It also doesn't need access to
+# any of clamav's private resources. So we're only granting it access to the
+# socket.
+ExecStartPost=
(needs the "acl" package).
To grant access to the socket to amavis.