Saturday, March 26, 2005

ClamAV 0.83 on OpenBSD 3.6

ClamAVClamAV, the GPL antivirus package for *nix will be included in OpenBSD 3.7 (which will be released on May 19). Before ClamAV was added to OpenBSD's ports tree, had been maintaining a port. After the addition of the port, this site stopped providing the port.

Using fatbsd's last port (clamav-0.80_3.6.tgz) and the port in OpenBSD's -current ports tree, I was able to backport ClamAV 0.83 for OpenBSD 3.6...

Notes: I'm logged in as a non-priviledged user who is a member of wheel. Wheel is allowed to run any command with sudo. Also, my user is a member of the wsrc group. Finally, my /etc/mk.conf contains "SUDO=/usr/bin/sudo".

  1. Set CVSROOT to your favorite CVS mirror.

  2. If necessary, create a build directory: sudo mkdir -p /usr/local/ports ; sudo chgrp wsrc /usr/local/ports ; chmod 775 /usr/local/ports

  3. Change to a directory above your build directory: cd /usr/local

  4. Get the code: cvs -d $CVSROOT get ports/security/clamav

  5. Change to the clamav directory: cd ports/security/clamav

  6. Download my patchfile to your home directory: clamav-0.83_openbsd_3.6.patch

  7. Apply my patch: patch -p0 < ~/clamav-0.83_openbsd_3.6.patch

  8. Build the port in the usual way: make install

  9. Follow the directions in the post-install comments to add the necessary components to /etc/rc.conf.local and /etc/rc.local.

  10. The next part assumes that you have not modified your /etc/mail/ copy the OpenBSD prototype mc file: sudo cp /usr/share/sendmail/cf/ /etc/mail

  11. Download my patchfile to your home directory: sendmail-milter-clamav.patch

  12. Change to the mail directory: cd /etc/mail

  13. Apply my patch: patch -p0 < ~/sendmail-milter-clamav.patch

  14. Create new m4 /etc/mail/ > ~/

  15. Copy new to /etc/mail: sudo cp ~/ /etc/mail ; rm ~/
  16. Add the following line to your /etc/rc.conf.local file: sendmail_flags="-L sm-mta -bd -q30m"

  17. Either reboot or manually launch clamav-milter and freshclam with the options you used in your /etc/rc.conf.local file and run: /usr/sbin/sendmail -L sm-mta -bd -q30m

Note: If you are also using SpamAssassin + SpamAss Milter, you should substitute my sendmail-milter-clamav-spamass.patch instead of my sendmail-milter-clamav.patch.