Click here for "Safe Air Conditioner Repair and Proper Freon Recovery".(Japanese Version)

Fedora38 ; Clamav , Mail Server

Clamav ( anti-virus software )

1.Clam AntiVirus Install

2.Edit Clam AntiVirus configuration file

3.Virus definition file update settings

4.Update virus definition files

5.Start Clam AntiVirus

6.Conducted virus scan
Download a test virus and perform a virus scan

7.Deployment of virus scan auto-execution scripts

Create script storage directory

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

8.Virus scan exclusion directory settings

Exclude sys and proc directories.

9.Scheduled virus scan execution

Mail Server Installation

1. Postfix

1.1 Install
Install Postfix and build an SMTP server

Check if Postfix is installed

1.2 Register Postfix to the service

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

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

1.4 Release SMTP port (port 25)

1.5 Postfix restart

2.Dovecot

2.1 dovecot Install

2.2 Edit 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.8 Permission 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(huong) 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 probinfg 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.

Mail Server : Postfix + Clamav + Amavisd+SpamAssassin

1.Real-time scanning of e-mails

①Amavisd ,Clamav Server Install

➁Configuration File Editing

➂Setup and start Amavisd

Automatic startup settings and start

Postfix Configuration

postfix restart

Check with Thunderbird
I sent a test email to myself in Thunderbird, and the following appears in the header display of the received email
X-Virus-Scanned: amavisd-new at korodes.com

2.Email spam protection

①SpamAssassin installed to prevent spam

②SpamAssassin Settings

③SpamAssassin configuration file modernization script

Contents of spamassassin-update.sh

#!/bin/bash

cd /etc/mail/spamassassin
wget -q https://github.com/kittyfreak/spamassassin_user_prefs/archive/refs/heads/main.zip
[ $? -ne 0 ] && exit
unzip main.zip >/dev/null 2>&1
[ $? -ne 0 ] && exit
rm -f main.zip
mv spamassassin_user_prefs-main/user_prefs .
rm -rf spamassassin_user_prefs-main
diff user_prefs user_prefs.org > /dev/null 2>&1
if [ $? -ne 0 ]; then
cp user_prefs local.cf
echo "report_safe 0" >> local.cf
echo "rewrite_header Subject SPAM" >> local.cf

# SpamAssassin restart
if [ -f /etc/rc.d/init.d/spamassassin ]; then
/etc/rc.d/init.d/spamassassin restart > /dev/null
else
systemctl restart spamassassin > /dev/null
fi
fi
cp user_prefs user_prefs.org

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.
「XJSC4JDBQADN1.NSBN32IDNENGTUBE-STANDARD-ANTI-UBE-TEST-EMAILC.34X」

Copied title and URL