Clamd socket error in conjunction with amavisd (used for postfix) on CentOS 7

amaviscentos7clamavpostfix

I can't seem to figure out a problem after a few hours of trouble-shooting and looking for similar cases.

Like ohter email servers in the exact same configuration, the affected one is based on CentOS 7 running Postfix with Amavisd-new and ClamAV (besides the more or less irrelevant parts such as Dovecot, SpamAssassin and so on which all still work).

The problem consists of amavis all of a sudden not being able to connect to clamd anymore because the socket doesn't exist:

connect to /var/run/clamd.amavisd/clamd.sock failed, attempt #1: Can't connect to a UNIX socket /var/run/clamd.amavisd/clamd.sock: No such file or directory

The directory is always created by a tmpfiles.d entry of amavisd and has the correct user/group and labeling set:

drwxrwx—. amavis clamupdate system_u:object_r:antivirus_var_run_t:s0 clamd.amavisd

The relevant section in /etc/amavisd/amavisd.conf as well as /etc/clamd.d/amavisd.conf share the same sock option and clamd runs as user amavis:

grep clamd.sock /etc/clamd.d/amavisd.conf /etc/amavisd/amavisd.conf

/etc/clamd.d/amavisd.conf: LocalSocket /var/run/clamd.amavisd/clamd.sock

/etc/amavisd/amavisd.conf: \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamd.amavisd/clamd.sock"],

SELinux has antivirus_can_scan_system and clamd_use_jit on and was disabled by way of trial.

I tried manually creating the socket, creating an instantiated unit as clamd@amavisd.service as well as completely removing ClamAV and reinstalling it:

clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd

Now I've run out of ideas and therefore would like to aks if anyone came across this scenario and could have some tips.

I look forward to your thoughts. 🙂
Cora

Best Answer

systemctl daemon-reload followed by systemctl start clamd@amavisd worked in my case.

Related Topic