FreeBSD14.1 ; Postfix ClamAV + Amavis + SpamassAssin

Install ClamAV on FreeBSD 14.1 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

clamav version check

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

start

1.5 manual virus check

To manually check for viruses, do the following(Scanning range is /home/)

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

①Edit main.cf

➁Edit master.cf

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.7 Edit 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.
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

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

X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on Lepard
X-Spam-Flag: YES
X-Spam-Level:
X-Spam-Status: Yes, score=1001.8 required=13.0 tests=ALL_TRUSTED,
CONTENT_TYPE_PRESENT,GTUBE,HTML_MESSAGE,MPART_ALT_DIFF,
MULTIPART_ALTERNATIVE,T_SCC_BODY_TEXT_LINE autolearn=no
autolearn_force=no version=4.0.1
X-Spam-Report:
* 0.1 ALL_TRUSTED Passed through trusted hosts only via SMTP
* 0.1 MULTIPART_ALTERNATIVE Multipart/alternative
* -0.1 CONTENT_TYPE_PRESENT exists:Content-Type
* 1000 GTUBE BODY: Generic Test for Unsolicited Bulk Email
* 1.0 HTML_MESSAGE BODY: HTML included in message
* 0.7 MPART_ALT_DIFF BODY: HTML and text parts are different
* -0.0 T_SCC_BODY_TEXT_LINE No description available.

Copied title and URL