Install spandyke by ports
Issue the following commands as root:
<br /> # cd /usr/ports/security/clamav<br /> # make <del>DWITH<em>MILTER<br />
Be sure to specify the "DWITHMILTER" command line option to make. Otherwise clamav won’t run as a stand-alone sendmail milter.
If you don’t specify "-DWITHMILTER" and are installing clamav for the first time, a configuration menu will prompt you for options and let you to select the MILTER option by pressing the space bar to make an "X" to the left of "MILTER", then press tab and Enter.The install "remembers" what you specified the first time you installed clamav and uses those options for all subsequent clamav builds. If you prefer using the menu interface and want to revisit that menu, you can instead issue the following commands:
<br /> # cd /usr/ports/security/clamav<br /> # make config<br />
When the compilation completes, issue the following command to install clamav:
<br /> # make install <br />
If you have installed an earlier version of clamav, the above will tell you about it, asking you to issue the commands "make deinstall" followed by "make reinstall". If that happens to you, issue both commands.
The installation should add a user and group named clamav. You can verify that this happened by examining /etc/passwd and /etc/group after the installation completes.
The make install should install these executables:<br /> /usr/local/bin/clamav-config<br /> /usr/local/bin/clamdscan<br /> /usr/local/bin/clamscan<br /> /usr/local/bin/freshclam<br /> /usr/local/bin/sigtool<br /> /usr/local/sbin/clamav-milter<br /> /usr/local/sbin/clamd<br />as well as the following startup files:
<br /> /usr/local/etc/rc.d/clamav-clamd.sh<br /> /usr/local/etc/rc.d/clamav-freshclam.sh<br /> /usr/local/etc/rc.d/clamav-milter.sh<br />documentation at:
<br /> /usr/local/man/man8/clamav-milter.8.gz<br />and a few other files. (If your shell is csh or tcsh, you might need to type "rehash" to let "which" find them.)
Additionally, make install will install the following pairs of (duplicate, initially) configuration files:
<br /> /usr/local/etc/clamd.conf<br /> /usr/local/etc/clamd.conf.default<br /> /usr/local/etc/freshclam.conf<br /> /usr/local/etc/freshclam.conf.default<br />
2. Edit the clamd configuration file
The clamd configuration file has changed significantly over time. Formerly named clamav.conf, it was recently renamed to clamd.conf. At about the same time, it became unnecessary to edit the configuration file in most cases—and this step (step 2) became unnecessary.
Previous to ClamAV version 0.801, it was necessary to uncomment the line "StreamSaveToDisk" in /usr/local/etc/clamav.conf (now named /usr/local/etc/clamd.conf). A September 2004 note in the change log states that clamav-milter no longer checks StreamSaveToDisk, and that clamd has removed the "obsolete StreamSaveToDisk directive.") You might, however, want to browse the clamd.conf file to see what sorts of directives are there.
3. Verify that the installation downloaded the virus database using freshclam
One of ClamAV’s strengths is freshclam daemon, which periodically updates the ClamAV virus signatures. The ports installation should have automatically installed an initial set of virus signatures in the directory /var/db/clamav.
To verify the installation of initial virus signatures, issue these commands:
<br /> # cd /usr/ports/security/clamav/work/clamav-0.86.2/test<br />
Your clamav version number in the above directory name will likely be more recent than the one above.
<br /> # clamscan clam.cab<br />
You can replace clam.cab with clam.exe, clam.exe.bz2, clam.rar, clam.zip, or mbox; the test should produce similar results.
The test should produce output something like the following:
<br /> test1: ClamAV-Test-Signature FOUND<br /> <br /> ----------- SCAN SUMMARY -----------<br /> Known viruses: 36934<br /> Engine version: 0.86.2<br /> Scanned directories: 0<br /> Scanned files: 1<br /> Infected files: 1<br /> Data scanned: 0.00 MB<br /> Time: 6.186 sec (0 m 6 s)<br />
4. Start the clamd daemon
The setup described in this document uses three daemons: The first (clamd) scans the mail. It communicates with a second daemon (clamav-milter) via a unix-domain socket. The clamav-milter daemon communicates with sendmail using a second unix-domain socket. The third (freshclam) was just mentioned above.
To start the clamd daemon, issue the command:
<br /> # clamd<br />
When clamd starts, it creates the unix-domain socket /var/run/clamav/clamd.
If you prefer another socket name, you can specify it in the /usr/local/etc/clamd.conf file by modifying the line:<br /> LocalSocket /var/run/clamav/clamd<br />Alternately, you can add a line to /etc/rc.conf that reads:
<br /> clamav<em>clamd</em>socket=/some/other/socket/file<br />The startup file in /usr/local/etc/rc.d/clamav-clamd.sh (invoked when the server boots up) reads the above value if specified in /etc/rc.conf. (See 9. Modify server startup files below.)
The clamd daemon also creates the file /var/run/clamav/clamd.pid, which contains the process ID (pid) of the clamd daemon.
5. Configure clamav-milter in the sendmail.cf
Edit your sendmail macro configuration (mc) file and insert the following line:
<br /> INPUT<em>MAIL</em>FILTER(clmilter',S=local:/var/run/clamav/clmilter.sock, F=, T=S:4m;R:4m’)
Note: If your configuration includes more than one milter and you are uncertain about their interactions or sequencing, search on INPUTMAILFILTER, MAILFILTER and confINPUTMAILFILTER in the cf/README or consult the "Bat" book. Configuring multiple milters is beyond the scope of this tutorial.If you’re new to the FreeBSD procedure for modifying sendmail.cf, click here.
Then rebuild and install your sendmail.cf, and restart sendmail:
<br /> # cd /etc/mail<br /> # make<br /> # make install<br /> # make restart
To install the port: cd /usr/ports/mail/spamdyke/ && make install clean To add the package: pkgadd -r spamdyke















