Click here for "Safe Air Conditioner Repair and Proper Freon Recovery".

FreeBSD13.2 ; Postfix ClamAV + Amavis + SpamassAssin

Install ClamAV on FreeBSD 13 and link it with Amavis against Postfix.
ClamAV is anti-virus software.
We will proceed on the assumption that you have already implemented Postfix.
Before proceeding, update the Ports Collection.

1. ClamAV

1.1 Install

Each option is installed by default for now

1.2 Configuration File Editing

①Edit clamd.conf
Run ClamAV as root user

➁Edit freshclam.conf
Settings about virus pattern files

1.3 Virus database update

1.4 ClamAV start

ClamAV auto-start configuration


1.5 manual virus check

To manually check for viruses, do the following

1.6 automatic virus scanning

• Scanning range is /home/.
• Output scan results to /var/log/clamav.log
• Automatic deletion of detected viruses
• Executed daily
Create an execution script with the above conditions

①Creation of virus storage directory

➁Shell Script Creation

Grant execution permissions to scripts

Register in cron to be executed at 0:00 AM

Run the following as a test

If you look at /var/log/clamav/clamav.log, you will see the same log as above

2. Amavis

Install Amavis, which links ClamAV and Postfix

2.1 Install

The option settings are as follows
SPAMASSASIN should be included.
IPv6 is not required, so remove the item.
Otherwise, proceed with defaults.

2.2 Configuration File Editing

Edit amavisd.conf

2.3 Amavis Auto-Startup Configuration

Amavis start

2.4 Postfix Configuration



3. Anti-Spam with SpamAssassin

3.1 SpamAssassin Install

If you did not select spamassassin as an option when you installed Amavis, install it as follows

3.2 Configuration File Editing

3.3 Spamassassin start

3.4 SpamassAssin Update

Create an update script

Grant execution rights to scripts

When the script is executed, a local.cff is created for the date and time of execution

3.5 postfix restart

3.6 Spam mailbox creation

When using IMAP in this case

①Create spam mailboxes for existing users
Let's assume the existing user is huong

➁Create spam mailboxes for additional users

3.7Edit procmailrc (for IMAP)

3.8 Spam Mail Learning

Create spam email learning scripts

3.9 Spam Mail Sending Test

Fill in the following in the body of the message in Thunderbird and send it to yourself.

The following message appears in the header of an incoming e-mail

X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on Lepard
X-Spam-Level: ****
X-Spam-Status: No, score=4.9 required=13.0 tests=ALL_TRUSTED,

autolearn_force=no version=4.0.0
Received: from lepard (localhost [])
by (Postfix) with ESMTP id E79F03D601
for; Fri, 4 Aug 2023 17:49:23 +0900 (JST)
X-Virus-Scanned: amavisd-new at xxxxxxxx
Received: from ([])
by lepard ( []) (amavisd-new, port 10024)

with ESMTP id 2Gem2M1jf1Rt for;
Fri, 4 Aug 2023 17:49:23 +0900 (JST)