AlmaLinux8.8 ; Anti-virus(Clamav) , Mail Server

1.  Clamav (anti-virus software)Install

1.1  Clamav (anti-virus software)Install

1.2 Clam AntiVirus  Configuration File Edit

1.3 Virus definition file update settings

1.4 Virus definition file update

1.5 Clam AntiVirus Auto-Start Settings

1.6 Conducted virus scan

Download a test virus and perform a virus scan

1.7 Deployment of virus scan auto-execution scripts

Grant execution permission to scripts

1.8 Virus scan exclusion directory settings

Exclude sys and proc directories.

1.9 Scheduled virus scan execution

Run a trial script and do a full scan (takes a while)

2.  Mail Server Install

2.1 Postfix Install

Install Postfix and build an SMTP server

Confirm Postfix is installed

2.2 Register Postfix to the service

2.3 Edit postfix configuration file

Backup postfix configuration files, and files

To prevent unauthorized mail relay, configure Postfix to require authentication for outgoing mail as well, using Dovecot's SASL function.

2.4 Allow SMTP port (port 25)

2.5 Start Postfix

3. Dovecot

3.1 Dovecot Install

3.2 Edit dovecot.conf file

3.3 Edit 10-auth.conf file

3.4 Edit 10-mail.conf file

3.5 Edit 10-master.conf file

3.6 Edit 10-ssl.conf file

3.7 Register dovecot as a service and start it

3.8 Allow POP/IMAP services in Firewalld Port Allow

POP is [110/TCP], IMAP is [143/TCP].

4.Create mail user and check operation

4.1 advance preparation

①Pre-processing for new users
When a new user is added, the system is configured to automatically send and receive e-mail.

②Existing users
Configure already created users to be able to send and receive mail.

4.2 User Account Creation

Mail Client Install

Add user [linux]

4.3  operation check ①

Log in as an email user and send a test email.

4.4 operation check ②

Set up and confirm your account in Mozilla Thunderbird(For OS user huong as mail user)
①Start Thunderbird, and click "Tools", "Account Settings".

②「Account Actions」「Add Mail Account」

③Your full name : Any name
Email addtess :
Password : Password for huong
Enter each and click "Configure manually".

④Set "INCOMMING SERVER" and "OUTGOING SERVER" as shown below and click "Re-test".

⑤The following settings were found by probinfg the given server

「After clicking "Done", the following "Warning" appears, but there is no problem, so click "Confirm".

⑥Click "Finish" when "Account syccessfuly created" is displayed.

Mail Server : Postfix + Clamav + clamav-milter+SpamAssassin

1. Real-time scanning of e-mails

①clamav-milter Install
Virus checks are performed on the mail server side using Clam AntiVirus.
The mail server and Clam AntiVirus are linked using clamav-milter.

clamav-milter configuration

clamav-milter startup and auto-startup settings

Postfix and clamav-milter integration settings
Edit Postfix configuration file

⑤Add postfix user to clamilt group

Postfix Settings Reflected

Check with Thunderbird
I sent a blank email to myself in Thunderbird, and in the header display of the received email, I see the following
X-Virus-Scanned: clamav-milter 0.103.10 at Lepard

Try sending yourself an email with the body of the email "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" and confirm that the email is discarded and never received

2. Email spam protection

2.1 SpamAssassin, spamass-milter, and postfix settings

SpamAssassin・spamass-milter Install

SpamAssassin start

SpamAssassin Settings

SpamAssassin configuration file modernization script

Grant execute permission to the spamassassin-update script and run it

Confirm that the SpamAssassin configuration file ( has been created in the /etc/mail/spamassassin directory with the date of the day

Set up cron to automatically run a script daily that updates the SpamAssassin configuration file

spamass-milter startup and automatic startup settings

Postfix and spamass-milter integration settings

Restart postfix

Procmail Settings
Create procmail configuration file

Create procmail log rotation configuration file

Postfix and Procmail integration settings

Postfix Settings Reflected

2.2 Spam mail sorting settings

Mail marked as spam in the mail header by SpamAssassin will be delivered to a spam-only mailbox, while other mail will be delivered to a normal mailbox.

Create a dedicated spam mailbox
For existing users, add a spam-only mailbox to their mailboxes.
For new users, a spam-only mailbox will be automatically created when a user is added.
Created script to create spam-only mailboxes

Run script to create spam-only mailboxes

Measures against new users
Automatic spam-only mailbox creation when adding new users

spam mail sorting
Emails identified as spam by SpamAssassin are delivered to a spam-only mailbox.

➂spamass-milter confirmation
When you send a blank email to yourself, the following message is appended to the header of the received email
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on Lepard

④Spam check confirmation
Send yourself an email with the body of the email "XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X" and make sure the email is not delivered and is sorted into the Spam folder

Copied title and URL