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

OpenSUSE Tumbleweed : Clamav , Mail Server

1. clamav ( anti-virus software )

1.1 Clamav Install

1.2 virus definition file update

①Configuration File Editing

②virus definition file update

1.3operation check

■If no virus is detected

■If a virus is detected
Download and scan for test viruses

1.4 Deployment of virus scan auto-execution scripts

①Create script storage directory

②Creation of auto-execution scripts

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

Grant execute permissions to scripts

The sys and proc directories are excluded from the scan because they cannot be scanned due to the specification.
OpenSUSE creates a large number of snapshots, so if necessary, set them in non-target directories.

Set up periodic virus scan

Execute "/srv/www/system/clamscan.sh" to scan the entire system

2. Mail server Install

2.1 Postfix Install

Install Postfix and build an SMTP server

Postfix Settings
To prevent unauthorized mail relay, use the SASL function of Dovecot, described below, and configure Postfix to require authentication for sending as well.

SMTP service permission is required if Firewalld is enabled; SMTP uses 25/TCP

2.3 Dovecot

①Install
This time we will install dovecot2.3 with additional repositories

Dovecot Settings
Configure Dovecot to provide SASL functionality for Postfix.

Dovecot startup and automatic execution

④POP/IMAP service permission required if Firewalld is enabled
POP uses 110/TCP, IMAP uses 143/TCP

2.4 User Account Registration

①Preprocessing for new users
When a new user is added, set up the system to automatically send and receive mail.

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

➂Mail client installation

④Mailboxes are set to refer to Maildir

2.5 Confirmation of operation

Set up an account in Thunderbird, a free email client, to check its operation.
However, depending on your provider, port 587 may be used for the outgoing server.
Please free up port 587 in your firewall settings.

Set up and confirm your account in Mozilla Thunderbird (for OS user huong as mail user)
Start Thunderbird and click [New Account][Email] in the [Three] menu in the upper right corner.

Full name : Arbitrary name
Email address : huong@<domain-name>
Enter each and click "Continue".

Click on "EDIT CONFIGURATION"

Incoming Server Settings
Set [Connection security] to [None] and click [Continue].

Configure the outgoing server
Set [Connection security] to [None] and click [Test].

Click "Continue"

Enter the user's password in the "Password" field and click "Continue"

Click "Continue"

Click "Finish" when the email account has been successfully created.

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

Set up Postfix and Clamav to work together to scan incoming and outgoing mail in real time.

3.1 clamav-milter Install

3.2 Configure clamav-milter

①Configuration File Editing

②Startup and Auto-Run Settings

3.3 Postfix and clamav-milter integration settings

3.4 Add postfix user to clamilt group

3.5 Check with Thunderbird

Send a blank email to yourself in Thunderbird and the following
"X-Virus-Scanned: clamav-milter 1.4.3 at Lepard" appears in the header display section of the received email.

X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
Return-Path: xxxxx@xxxxxxx.com
X-Original-To: xxxxx@xxxxxxx.comm
Delivered-To: xxxxx@xxxxxxx.com
Received: from [192.168.11.6] (buffalo.setup [192.168.11.1])
by mail.xxxxxxx.com (Postfix) with ESMTPA id 2AA85887B
forxxxxxx@xxxxxxx.com; Sat, 30 Aug 2025 11:40:54 +0900 (JST)
Message-ID: b87809e5-18b8-4ef2-afbf-13d2bea5954f@xxxxxxx.com
Date: Sat, 30 Aug 2025 11:40:54 +0900
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
From: xxxxx xxxxx@xxxxxxx.com
Content-Language: en-US
To: xxxxx xxxxx@xxxxxxx.com
Subject: 444
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: clamav-milter 1.4.3 at Lepard
X-Virus-Status: Clean

4.virus scan script substitution

Set up a notification to a specified e-mail address after virus check scan.

① Create virus scan exclusion directory list

②Disable existing script and create new virus scan script

Contents of new "clamscan.sh"

You will now be notified by email if there is a virus. If there is no virus, you will not be notified.

2.Email spam protection

2.1 SpamAssassin・spamass-milter・postfix setting

①SpamAssassin・spamass-milter Install

➁Launch SpamAssassin

➂SpamAssassin Settings

④Create script to update SpamAssassin configuration file

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

Confirm that the SpamAssassin configuration file (local.cf) is 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

⑦postfix restart

⑧Procmail configuration
procmail configuration file creation

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, a dedicated spam mailbox will be added to the mailbox.
For new users, a spam-only mailbox should be automatically created when a user is added.
①Created script to create spam-only mailboxes

Run script to create spam-only mailboxes

Measures for 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 4.0.1 (2024-03-26) on Lepard

X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
Return-Path: xxxxx@xxxxxxx.com
X-Original-To: xxxxx@xxxxxxx.com
Delivered-To: xxxxx@xxxxxxx.com
Received: from [192.168.11.6] (buffalo.setup [192.168.11.1])
by mail.xxxxxxx.com (Postfix) with ESMTPA id 92B895A84
for xxxxx@xxxxxxx.com; Mon, 01 Sep 2025 19:05:04 +0900 (JST)
Message-ID: 1fa32b8e-2091-440c-82be-aafddc244a0b@korodes.com
Date: Mon, 1 Sep 2025 19:05:03 +0900
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
From: xxxxx xxxxx@xxxxxxx.com
Content-Language: en-US
To: xxxxx xxxxx@xxxxxxx.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: clamav-milter 1.4.3 at Lepard
X-Virus-Status: Clean
X-Spam-Status: No, score=2.2 required=5.0 tests=ALL_TRUSTED,EMPTY_MESSAGE,
MISSING_SUBJECT,PDS_TONAME_EQ_TOLOCAL_VSHORT autolearn=no
autolearn_force=no version=4.0.1
X-Spam-Level: **
X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on Lepard

④Spam check confirmation
Send yourself an email with the body of the email "XJSC4JDBQADN1.NSBN32IDNENGTUBE-STANDARD-ANTI-UBE-TEST-EMAILC.34X" and make sure the email is not delivered and is sorted into the Spam folder
The header states

X-Spam-Flag: YES
X-Spam-Status: Yes, score=1003.3 required=13.0 tests=ALL_TRUSTED,
CONTENT_TYPE_PRESENT,GTUBE,HTML_MESSAGE,MPART_ALT_DIFF,
MULTIPART_ALTERNATIVE 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
* 0.1 MULTIPART_ALTERNATIVE Multipart/alternative
* 1000 GTUBE BODY: Generic Test for Unsolicited Bulk Email
* 2.2 MPART_ALT_DIFF BODY: HTML and text parts are different
* 1.0 HTML_MESSAGE BODY: HTML included in message
X-Spam-Level: *********************************************
X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on Lepard
Subject: SPAM

Copied title and URL