{"id":619,"date":"2015-09-29T12:04:16","date_gmt":"2015-09-29T18:04:16","guid":{"rendered":"http:\/\/wmbuck.net\/blog\/?p=619"},"modified":"2016-07-17T07:10:30","modified_gmt":"2016-07-17T13:10:30","slug":"setting-up-amavisd-and-clamav","status":"publish","type":"post","link":"https:\/\/wmbuck.net\/blog\/?p=619","title":{"rendered":"Setting up amavisd and clamav"},"content":{"rendered":"<p>I set up a new server instance on Amazon, tarragon_3, which is Fedora 22. I&#8217;ve had a lot of trouble over the years with clamav and amavisd, mostly with the nonsense about having to mess about with the user under which clamav runs, allowing a shared group, location of the socket, ability to create logs. I&#8217;ve never had it operate satifsactorily for a long time, and never looked into why. I resolved to look closer this time.<\/p>\n<p>I installed amavisd-new clamav clamav-server-systemd clamav-scanner clamav-update. I am not sure but I think:<br \/>\nclamav is the basic package, and has the engine, and perhaps libraries;<br \/>\nclamav-server-systemd is the machinery to start the clam daemon under systemd;<br \/>\nclamav-scanner I expect has clamscan and clamdscan for command line scanning;<br \/>\nclamav-update is probably freshclam, the stuff for getting updates.<\/p>\n<p>Initially, I was making the same sort of blind changes I&#8217;d made in the past, but I read around a little. It seems that some of this has been changed, so I&#8217;m trying a new approach. I&#8217;m somewhat following instructions in <a href=\"http:\/\/www.server-world.info\/en\/note?os=Fedora_21&amp;p=mail&amp;f=6\">http:\/\/www.server-world.info\/en\/note?os=Fedora_21&amp;p=mail&amp;f=6<\/a>. Part of the reason for trusting those instructions a little is that they refer to new things which are in the distro, for example, the \/etc\/tmpfiles.d which I haven&#8217;t seen before now. So I think the instructions are relatively recent. On the other hand, the instructions called for modifying \/usr\/lib\/systemd\/system\/clamd@.service, which is simply wrong.<br \/>\n<!--more--><br \/>\nI did not change the user under which clamav runs in the config files. The only config changes I made were as follows:<br \/>\n1. modify \/etc\/freshclam.conf to remove the failsafe COMMENT-&gt;#COMMENT. Then I checked that freshclam would run correctly and download the sigs.<br \/>\n2. copy \/usr\/share\/doc\/clamav-server\/clamd.sysconfig -&gt;\/etc\/sysconfig\/clamd.amavisd and update the text to substitute \u201camavis\u201d for &lt;Service&gt;<br \/>\n3. copied \/usr\/lib\/systemd\/system\/clamd@.service to \/etc\/system\/system\/clamd@.service and added :[Install] WantedBy=multi-user.target<br \/>\n4. start and enable <a href=\"mailto:clamd@amavisd\">clamd@amavisd<\/a> service<\/p>\n<p>My changes to amavis.conf were as usual, just setting the domains, the spamassassin levels, etc. After about a month and several updates, I have not experienced any of the issues of the past.<\/p>\n<p>July, 2016:<\/p>\n<p>Something happened and it began to fail. clamd@amavis would not start. I did some research, flailed around a bit, got it working, but have only a vague understanding of what happened.<\/p>\n<p>One thing was that the systemd script in \/etc\/systemd\/system\/clamd@.service was a copy of the one in \/usr\/lib\/systemd\/system\/clamd@.service and the latter was changed in June with an update. There used to be a parameter &#8211;nofork=yes, and that is gone, and replaced with a parameter &#8211;foreground-yes, and the former syntax now generates an error.<\/p>\n<p>The other thing has to do with the name under which the config file is sought. The systemd script (currently) has ExecStart = \/usr\/sbin\/clamd -c \/etc\/clamd.d\/%i.conf, aiming to have the config file named with the service (all this machinery to allow there to be multiple clamd daemons for different purposes I think). The config file I have in \/etc\/clamd.d\/amavisd.conf isn&#8217;t found with this &#8211; it is looking for \/etc\/clamd.d\/amavis.conf. Here I am not exactly sure what has changed, but it is clear that if the daemon is launched with a name that doesn&#8217;t match the actual config file, it fails. In trying to fix it, my first fix was just to put in a symlink, amavis.conf=&gt;amavisd.conf and that worked. Maybe the %i.conf is new in the script, I&#8217;m not sure &#8211; I was too quick on the trigger replaceing the file.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I set up a new server instance on Amazon, tarragon_3, which is Fedora 22. I&#8217;ve had a lot of trouble over the years with clamav and amavisd, mostly with the nonsense about having to mess about with the user under which clamav runs, allowing a shared group, location of the socket, ability to create logs. &hellip; <a href=\"https:\/\/wmbuck.net\/blog\/?p=619\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Setting up amavisd and clamav<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,4],"tags":[],"class_list":["post-619","post","type-post","status-publish","format-standard","hentry","category-fedora","category-linux"],"_links":{"self":[{"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/619"}],"collection":[{"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=619"}],"version-history":[{"count":5,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/619\/revisions"}],"predecessor-version":[{"id":736,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/619\/revisions\/736"}],"wp:attachment":[{"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}