[CentOS] clamd at amavisd fails under systemd

Tue Nov 8 11:24:32 UTC 2016
Rob Kampen <rkampen at kampensonline.com>

Trying to set up a mail server under CentOS7 - having done this with 
CentOS5 and CentOS6 over the last decade with no issues and reliable 
service, it was time to upgrade (?) to CentOS7. Shouldn't be a problem, 
right?

Getting to grips with systemd has been challenging - to say the least.

So a brief overview of what I am trying to set up:

postfix / amavisd-new / spamassassin / clamav so we can receive mail and 
deal with the major rubbish that gets thrown at any open port 25 smtp 
service.

no problems installing each of the above and their configuration files. 
Just as an aside, there are many recipes for this combo of packages - 
none of which work as advertised. There was a time when one could safely 
follow a how-to guide and have things working - I have regularly used 
the CentOS wiki guides - however they have become stale and what worked 
fine for 5 & 6 DO NOT WORK for CentOS7 - mainly due to systemd and firewalld

So we have:

systemctl status postfix.service
● postfix.service - Postfix Mail Transport Agent
    Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; 
vendor preset: disabled)
    Active: active (running) since Wed 2016-10-26 18:13:25 EDT; 1 weeks 
5 days ago
  Main PID: 2762 (master)
    CGroup: /system.slice/postfix.service
            ├─ 2762 /usr/libexec/postfix/master -w
            ├─ 2782 qmgr -l -t unix -u
            └─25274 pickup -l -t unix -u

systemctl status spamassassin.service
● spamassassin.service - Spamassassin daemon
    Loaded: loaded (/usr/lib/systemd/system/spamassassin.service; 
enabled; vendor preset: disabled)
    Active: active (running) since Tue 2016-11-08 05:18:04 EST; 50min ago
   Process: 27412 ExecStart=/usr/bin/spamd --pidfile /var/run/spamd.pid 
$SPAMDOPTIONS (code=exited, status=0/SUCCESS)
   Process: 27410 ExecStartPre=/sbin/portrelease spamd (code=exited, 
status=0/SUCCESS)
  Main PID: 27417 (/usr/bin/spamd )
    CGroup: /system.slice/spamassassin.service
            ├─27417 /usr/bin/spamd --pidfile /var/run/spamd.pid -d -c -m5 -H
            ├─27418 spamd child
            └─27419 spamd child

systemctl status amavisd.service
● amavisd.service - Amavisd-new is an interface between MTA and content 
checkers.
    Loaded: loaded (/usr/lib/systemd/system/amavisd.service; enabled; 
vendor preset: disabled)
    Active: active (running) since Tue 2016-11-08 05:18:05 EST; 50min ago
      Docs: http://www.ijs.si/software/amavisd/#doc
   Process: 27426 ExecStart=/usr/sbin/amavisd -c 
/etc/amavisd/amavisd.conf (code=exited, status=0/SUCCESS)
  Main PID: 27427 (/usr/sbin/amavi)
    CGroup: /system.slice/amavisd.service
            ├─27427 /usr/sbin/amavisd (master)
            ├─27479 /usr/sbin/amavisd (ch1-avail)
            └─27480 /usr/sbin/amavisd (ch1-avail)

but for the life of me, I cannot get clamd at amavisd to stay up.

It always comes up and then dies after about 1 second :

systemctl status clamd at amavisd.serviceclamd at amavisd.service - clamd scanner (amavisd) daemon
    Loaded: loaded (/usr/lib/systemd/system/clamd at .service; enabled; 
vendor preset: disabled)
    Active: inactive (dead) since Tue 2016-11-08 05:18:13 EST; 34min ago
   Process: 27421 ExecStart=/usr/sbin/clamd -c /etc/clamd.d/%i.conf 
(code=exited, status=0/SUCCESS)
  Main PID: 27421 (code=exited, status=0/SUCCESS)

Nov 08 05:18:11 media.xxxx.xxx clamd[27481]: OLE2 support enabled.
Nov 08 05:18:11 media.xxxx.xxx clamd[27481]: PDF support enabled.
Nov 08 05:18:11 media.xxxx.xxx clamd[27481]: SWF support enabled.
Nov 08 05:18:11 media.xxxx.xxx clamd[27481]: HTML support enabled.
Nov 08 05:18:11 media.xxxx.xxx clamd[27481]: XMLDOCS support enabled.
Nov 08 05:18:11 media.xxxx.xxx clamd[27481]: HWP3 support enabled.
Nov 08 05:18:11 media.xxxx.xxx clamd[27481]: Self checking every 600 
seconds.
Nov 08 05:18:13 media.xxxx.xxx clamd[27481]: Pid file removed.
Nov 08 05:18:13 media.xxxx.xxx clamd[27481]: --- Stopped at Tue Nov  8 
05:18:13 2016
Nov 08 05:18:13 media.xxxx.xxx clamd[27481]: Socket file removed.

I can run the clamd service manually just fine and everything works - i.e.

/usr/sbin/clamd -c /etc/clamd.d/amavisd.conf –nofork=yes

returns a functioning service - thus my config files must be okay

but try it with systemd and you hit a brick wall - nothing in any logs 
to give me a clue why it comes up and then closes down

After many days of google chasing,
I have found a number of folk hitting the same issue, yet none of these 
have posted anything resembling a solution, most have had other issues 
that were in error.

If there is anyone that has this combo of services working under CentOS7 
and can shed any insight on why I cannot get this service to actually 
run, it would be very much appreciated.

TIA
Rob