this is obsolete doc -- see http://doc.nethence.com/ instead

Setting up ClamAV-milter for Sendmail on FreeBSD 8 

 

Install the milter, 

  echo $PACKAGESITE 

  #pkg_delete clamav... 

  pkg_add -r clamav-milter 

  cp -v /usr/local/etc/rc.d/clamav-* /etc/rc.d/ 

Note. conflicts with the clamav package. 

 

Use the defaults for now, 

cd /usr/local/etc/ 

cp freshclam.conf.default freshclam.conf 

cp clamd.conf.default clamd.conf 

cp clamav-milter.conf.default clamav-milter.conf 

 

Provide some easy symlink configuration folder for ClamAV-milter, 

mkdir -p /etc/mail/clamav/ 

cd /etc/mail/clamav/ 

ln -s /usr/local/etc/freshclam.conf 

ln -s /usr/local/etc/clamd.conf 

ln -s /usr/local/etc/clamav-milter.conf 

 

Make sure the clamav user and group exist, 

  grep clam /etc/passwd /etc/group 

 

Check the paths, 

cd /etc/mail/clamav/ 

grep ^DatabaseDirectory * 

grep ^PidFile * 

grep .sock$ * 

ll /var/run/clamav/clamd.pid 

ll /var/run/clamav/freshclam.pid 

ll /var/run/clamav/clamav-milter.pid 

 

Enable and start the daemons in that order, 

cd /etc/ 

cat >> rc.conf <<EOF9 

clamav_clamd_enable=YES 

clamav_freshclam_enable=YES 

clamav_milter_enable=YES 

EOF9 

start the updater in the first place, 

ls -alkF /var/db/clamav/ 

/etc/rc.d/clamav-freshclam restart 

ls -alkF /var/db/clamav/ 

wait until you get those files in that folder (the clamav-xxxxxxxxxxxx folder is temporary), 

bytecode.cvd 

daily.cvd 

main.cvd 

mirrors.dat 

then start the other daemons, 

  /etc/rc.d/clamav-clamd restart 

  /etc/rc.d/clamav-milter restart 

and check that everything is just fine, 

  ls -lF /var/run/clamav/clmilter.sock 

  ls -lF /var/run/clamav/clamd.sock 

  ls -lF /var/run/clamav/clamd.sock 

  ps aux | grep clam 

 

Setting up the milter within Sendmail 

Add this to your <hostname>.mc Sendmail configuration file, 

INPUT_MAIL_FILTER(`clmilter', `S=local:/var/run/clamav/clmilter.sock, F=, T=S:4m;R:4m') 

dnl define(`confINPUT_MAIL_FILTERS', `clmilter') 

note. no "define confINPUT_MAIL_FILTER" is needed, as "INPUT_MAIL_FILTER" populates it already. (ref. cf/README or https://www.sendmail.com/sm/open_source/docs/m4/adding_mailfilters.html) 

and apply, 

  make 

  make install 

  make restart 

Note. no define confINPUT_MAIL_FILTER is needed, as INPUT_MAIL_FILTER populates it already. (ref. cf/README) 

 

Troubleshooting 

If you encouter this error, 

  Missing /var/db/clamav/clamav/*.cvd or *.cld files. You must run freshclam first 

then you will have to wait until the freshclam daemon process finishes to update the /var/db/clamav/ folder, see above in the guide.