ClamXav on OS X Server
I recently migrated an OS X client setup to a new Mac Mini running OS X Server. One installation problem that arose was ClamXav [www.clamxav.com], a free front-end to the clamav virus checker that comes pre-installed with OS X server.
I got this working along with ClamXav Sentry, and I'm posting my notes here in case it's useful to others or someone can suggest alternatives. The main idea is change the configuration so that OS X Server uses the ClamXav binaries, and that the server handles all the freshclam updating details. You could also do the same thing with binaries installed using MacPorts "port install clamav" in /opt/local.
Notes on setting up ClamXav Sentry on OS X Server 10.6:
Based mostly on "Updating ClamAV on OS X Server >= 10.5.5" from http://osx.topicdesk.com/content/view/139/41/
This will use the clamav binaries that come with clamXav in /usr/local/clamXav/{bin,sbin}
1. Create and copy all the conf and plist files:
% cd ~/Downloads
% mkdir ~/Downloads/SourceCache
% cd ~/Downloads/SourceCache
% curl -O http://downloads.topicdesk.com/docextras/clamavextras_105096.tar.gz
% tar xzf clamav extras_105096.tar.gz
% cd clamav extras_105096
% sudo chown root:wheel ~/Downloads/SourceCache/clamav extras_105096/*
% sudo vi net.clamav.clamd.plist
/usr/local/sbin/clamd -> /usr/local/clamXav/sbin/clamd
% sudo vi net.clamav.clamd.plist
/usr/local/bin/freshclam -> /usr/local/clamXav/bin/freshclam
% sudo vi freshclam.conf
#DatabaseDirectory /var/clamav
# Path to the log file (make sure it has proper permissions)
# Default: disabledUpdateLogFile /usr/local/clamXav/share/clamav/freshclam.log
UpdateLogFile /usr/local/clamXav/share/clamav/freshclam.log
% sudo mv /usr/local/clamXav/etc/clamd.conf /usr/local/clamXav/etc/clamd.conf.orig
% sudo mv /usr/local/clamXav/etc/freshclam.conf /usr/local/clamXav/etc/freshclam.conf.orig
% sudo chown clamav:wheel freshclam.conf
% sudo cp *.conf /usr/local/clamXav/etc
% sudo cp *.plist /System/Library/LaunchDaemons
% sudo mkdir -p /var/clamav/tmp
% sudo chown amavisd:amavisd /var/clamav/tmp
2. Setup launchctl to use the new files
% sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/org.clamav.freshclam.plist
% sudo /bin/launchctl load -w /System/Library/LaunchDaemons/net.clamav.freshclam.plist
% sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/org.clamav.clamd.plist
% sudo /bin/launchctl load -w /System/Library/LaunchDaemons/net.clamav.clamd.plist
% sudo /bin/launchctl unload /System/Library/LaunchDaemons/org.amavis.amavisd.plist
% sudo /bin/launchctl load /System/Library/LaunchDaemons/org.amavis.amavisd.plist
3. Restart
I got this working along with ClamXav Sentry, and I'm posting my notes here in case it's useful to others or someone can suggest alternatives. The main idea is change the configuration so that OS X Server uses the ClamXav binaries, and that the server handles all the freshclam updating details. You could also do the same thing with binaries installed using MacPorts "port install clamav" in /opt/local.
Notes on setting up ClamXav Sentry on OS X Server 10.6:
Based mostly on "Updating ClamAV on OS X Server >= 10.5.5" from http://osx.topicdesk.com/content/view/139/41/
This will use the clamav binaries that come with clamXav in /usr/local/clamXav/{bin,sbin}
1. Create and copy all the conf and plist files:
% cd ~/Downloads
% mkdir ~/Downloads/SourceCache
% cd ~/Downloads/SourceCache
% curl -O http://downloads.topicdesk.com/docextras/clamavextras_105096.tar.gz
% tar xzf clamav extras_105096.tar.gz
% cd clamav extras_105096
% sudo chown root:wheel ~/Downloads/SourceCache/clamav extras_105096/*
% sudo vi net.clamav.clamd.plist
/usr/local/sbin/clamd -> /usr/local/clamXav/sbin/clamd
% sudo vi net.clamav.clamd.plist
/usr/local/bin/freshclam -> /usr/local/clamXav/bin/freshclam
% sudo vi freshclam.conf
#DatabaseDirectory /var/clamav
# Path to the log file (make sure it has proper permissions)
# Default: disabledUpdateLogFile /usr/local/clamXav/share/clamav/freshclam.log
UpdateLogFile /usr/local/clamXav/share/clamav/freshclam.log
% sudo mv /usr/local/clamXav/etc/clamd.conf /usr/local/clamXav/etc/clamd.conf.orig
% sudo mv /usr/local/clamXav/etc/freshclam.conf /usr/local/clamXav/etc/freshclam.conf.orig
% sudo chown clamav:wheel freshclam.conf
% sudo cp *.conf /usr/local/clamXav/etc
% sudo cp *.plist /System/Library/LaunchDaemons
% sudo mkdir -p /var/clamav/tmp
% sudo chown amavisd:amavisd /var/clamav/tmp
2. Setup launchctl to use the new files
% sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/org.clamav.freshclam.plist
% sudo /bin/launchctl load -w /System/Library/LaunchDaemons/net.clamav.freshclam.plist
% sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/org.clamav.clamd.plist
% sudo /bin/launchctl load -w /System/Library/LaunchDaemons/net.clamav.clamd.plist
% sudo /bin/launchctl unload /System/Library/LaunchDaemons/org.amavis.amavisd.plist
% sudo /bin/launchctl load /System/Library/LaunchDaemons/org.amavis.amavisd.plist
3. Restart
Mac Mini, Mac OS X (10.6.4)