業務用エアコン関連の技術情報、エラーコード、環境問題対策に関する別サイト「エアコンの安全な修理・適切なフロン回収」

CentOS Stream10 : Clamav , Mail Server

1. Clamav

1.1  Clam AntiVirus Install

1.2 Edit Clam AntiVirus configuration file

1.3 Virus definition file update settings

1.4 Update virus definition files

1.5 Start Clam AntiVirus

1.6 Conducted virus scan
Download a test virus and perform a virus scan

1.7 Deployment of virus scan auto-execution scripts

clamscan.sh Create in /var/www/system with the following contents

1.8 Virus scan exclusion directory settings
Exclude sys and proc directories.

1.9 Scheduled virus scan execution

2. Mail Server Installation

1. Postfix Install

1.1 Install
Install Postfix and build an SMTP server

Check if Postfix is installed

1.2Register Postfix to the service

1.3 Backup postfix configuration files, main.cf and master.cf files

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

Release SMTP port (port 25)

1.5 Postfix restart

2.Dovecot

2.1 dovecot Install

2.2Edit dovecot.conf file

2.3 Edit 10-auth.conf file

2.4 Edit 10-mail.conf file

2.5 Edit 10-master.conf file

2.6 Edit 10-ssl.conf file

2.7 Register dovecot as a service and start it

2.8Permission port opening for POP/IMAP service with firewalld
POP : [110/TCP], IMAP : [143/TCP]

3.Create mail user and check operation

3.1 advance preparation
①Pretreatment for new users
When a new user is added, set up the system to automatically send and receive e-mail.

②Mail environment pre-processing for existing users
Configure the already created users to be able to send and receive e-mail.

3.2 User Account Creation
Mail client installation

Add user [linux]

3.3 Operation check ①
Log in as an email user and send a test email.

②Email Confirmation

3.4 Operation check ②
Set up and confirm your account in Mozilla Thunderbird (for OS user huong as mail user)
①Start Thunderbird
Your full name : Any name
Email addtess : huong@korodes.com
Password : Password for huong
Click on "Configure manually"

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

➂"The following settings were found by probing the given server" Displayed

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

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

4.Mail server : Postfix + Clamav + Amavisd+SpamAssassin

4.1 Real-time scanning of e-mails

①Amavisd ,Clamav Server Install
If you have not yet installed the epel repository, install and activate it in the following

Configuration File Editing

Create log directory, activate and auto-start clamd@scan

Setup and start Amavisd

Postfix Configuration

Check with Thunderbird
I sent a test email to myself in Thunderbird and the following appears in the header display section of the received email

X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
Return-Path: xxxxx@korodes.com
X-Original-To: xxxxx@korodes.com
Delivered-To: xxxxx@korodes.com
Received: from localhost (localhost [127.0.0.1])
by mail.korodes.com (Postfix) with ESMTP id 18553317EF48
for xxxxx@korodes.com; Mon, 17 Mar 2025 19:29:07 +0900 (JST)
X-Virus-Scanned: amavis at korodes.com
Received: from mail.korodes.com ([127.0.0.1])
by localhost (mail.korodes.com [127.0.0.1]) (amavis, port 10024) with ESMTP
id BFSLsnrOlLhp for xxxxx@korodes.com;

Mon, 17 Mar 2025 19:29:06 +0900 (JST)
Received: from [192.168.11.8] (xxxxxxx.setup [192.168.11.1])
by mail.korodes.com (Postfix) with ESMTPA id D25F2317EF41
for xxxxx@korodes.com; Mon, 17 Mar 2025 19:29:06 +0900 (JST)

4.2  Email spam protection

SpamAssassin installed to prevent spam

SpamAssassin Settings

SpamAssassin configuration file modernization script

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

Check that the SpamAssassin configuration file in the /etc/mail/spamassassin directory has been created as of today.

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

Integrate SpamAssassin into Postfix

Restart postfix

⑥If you send an e-mail to yourself in Thunderbird with the following information in the body, the following will appear in the header.
「XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X」

X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
Return-Path:xxxxx@korodes.com
X-Original-To: xxxxx@korodes.com
Delivered-To: xxxxx@korodes.com
Received: from localhost (localhost [127.0.0.1])
by mail.korodes.com (Postfix) with ESMTP id BEF2931AAA14
for xxxxx@korodes.com; Mon, 17 Mar 2025 19:37:04 +0900 (JST)
X-Virus-Scanned: amavis at korodes.com
Received: from mail.korodes.com ([127.0.0.1])
by localhost (mail.korodes.com [127.0.0.1]) (amavis, port 10024) with ESMTP
id BALBPGnUuuFZ for xxxxx@korodes.com;
Mon, 17 Mar 2025 19:37:04 +0900 (JST)
Received: by mail.korodes.com (Postfix, from userid 65534)
id 8E6B831AAA03; Mon, 17 Mar 2025 19:37:04 +0900 (JST)
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=1000.0 required=13.0 tests=ALL_TRUSTED,
CONTENT_TYPE_PRESENT,GTUBE 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 CONTENT_TYPE_PRESENT exists:Content-Type
* 1000 GTUBE BODY: Generic Test for Unsolicited Bulk Email
Received: from [192.168.11.8] xxxx.setup [192.168.11.1])
by mail.korodes.com (Postfix) with ESMTPA id 49E1831AAA05
for xxxxx@korodes.com; Mon, 17 Mar 2025 19:37:04 +0900 (JST)

Copied title and URL