{"id":213,"date":"2011-05-03T16:28:22","date_gmt":"2011-05-03T16:28:22","guid":{"rendered":"http:\/\/songoku.homelinux.com\/wordpress\/?p=213"},"modified":"2011-05-03T16:28:22","modified_gmt":"2011-05-03T16:28:22","slug":"havpclamav-freezing-on-pfsense-1-2-3","status":"publish","type":"post","link":"https:\/\/ndk.sytes.net\/wordpress\/?p=213","title":{"rendered":"HAVP\/CLAMAV freezing on pfSense 1.2.3"},"content":{"rendered":"<p>hi, i don&#39;t know if you already had this problem with pfSense 1.2.3 but my havp or better said, clamd quits sometimes unexpectly. I searched the internet for some solutions but i couldn&#39;t find any. Some people were reporting that they had a hardware problem and that the freezing was solved after replacing e.g. the hard drive. Well, because i&#39;m using a relatively new drive (or new compact flash as a drive), i wasn&#39;t too satisfied with this and wrote my own script to test the clamd socket and restart havp if needed.<\/p>\n<p>My logs showed some of the following errors:<\/p>\n<p>\/var\/log\/havp\/access.log:<br \/>\n\t{DATE} {IP} GET 200 {URL} 331+951 SCANERROR Detected dead scanner<\/p>\n<p>\/var\/log\/havp\/havp.log:<br \/>\n\t{DATE} Scanner errors: Clamd: Could not read from scanner socket (lasturl: {URL})<\/p>\n<p>So here is my script:<\/p>\n<p>#! \/usr\/local\/bin\/php -qC<br \/>\n\t&lt;?php<br \/>\n\t# open clamd socket<br \/>\n\t$socket = @fsockopen(&quot;localhost&quot;, 3310, $errno, $errstr, 1);<br \/>\n\t# if socket connection fails, restart clamd and havp<br \/>\n\tif (!$socket) {<br \/>\n\t&nbsp;&nbsp;&nbsp; print &quot;Unable to connect to CLAMD&#8230; socket down?\\n&quot;;<br \/>\n\t&nbsp;&nbsp;&nbsp; print &quot;Stopping HAVP&#8230;\\n&quot;;<br \/>\n\t&nbsp;&nbsp;&nbsp; system(&quot;\/usr\/local\/etc\/rc.d\/havp stop&quot;);<br \/>\n\t&nbsp;&nbsp;&nbsp; print &quot;Restarting CLAMD&#8230;\\n&quot;;<br \/>\n\t&nbsp;&nbsp;&nbsp; system(&quot;\/usr\/local\/etc\/rc.d\/clamd stop&quot;);<br \/>\n\t&nbsp;&nbsp;&nbsp; system(&quot;\/usr\/local\/etc\/rc.d\/clamd start&quot;);<br \/>\n\t&nbsp;&nbsp;&nbsp; print &quot;Starting HAVP&#8230;\\n&quot;;<br \/>\n\t&nbsp;&nbsp;&nbsp; system(&quot;\/usr\/local\/etc\/rc.d\/havp start&quot;);<br \/>\n\t}<br \/>\n\t# close socket<br \/>\n\telse fclose($socket);<br \/>\n\t?&gt;<\/p>\n<p>Save this to a file on the pfSense filesystem, set executable permissions on that file (chmod 755 &lt;script&gt;), add following lines to \/etc\/crontab and replace the &lt;path_to_file&gt; with your path and scriptname:<\/p>\n<p># check for havp every minute<br \/>\n\t*\/1 * * * * root &lt;path_to_file&gt;<\/p>\n<p>From then on, my pfSense box ran smoothly again.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>hi, i don&#39;t know if you already had this problem with pfSense 1.2.3 but my havp or better said, clamd quits sometimes unexpectly. I searched the internet for some solutions but i couldn&#39;t find any. Some people were reporting that they had a hardware problem and that the freezing was solved after replacing e.g. the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,7],"tags":[],"class_list":["post-213","post","type-post","status-publish","format-standard","hentry","category-linuxunix","category-servers"],"_links":{"self":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=213"}],"version-history":[{"count":0,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/213\/revisions"}],"wp:attachment":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}