Click here for "Error Codes for Commercial Air Conditioners".(Japanese Version)

CentOS7.9 ; Mail Server, Clamav, SpamAssassin

Clamav ( anti-virus software )

1.Clam AntiVirus Install

2.Edit Clam AntiVirus configuration file

3.Virus definition file update settings

4.Virus definition file update

5.Start Clam AntiVirus

6.Perform virus scan

Download a test virus and perform a virus scan

7.Deployment of virus scan auto-execution scripts

Create in /var/www/system with the following contents

8.Virus scan exclusion directory settings

9.Scheduled virus scan

Mail Server Installation

1. Postfix Install

1.1 install
Install Postfix and build an SMTP server

Make sure Postfix is installed

1.2Register Postfix to the service
1.3 Backup postfix configuration files, and 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 Start Postfix

2.Dovecot install

2.1 dovecot install
2.2 Edit dovecot.conf file

2.3 Edit 10-auth.conf file

2.3 Edit 10-mail.conf file
2.4 Edit 10-master.conf file
2.5 Edit 10-ssl.conf  file
2.6 Register dovecot as a service and start it
2.7 Allow POP/IMAP services with firewalld

POP is [110/TCP], IMAP is [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 ①
3.4 Operation check ②
Set up and confirm your account in Mozilla Thunderbird

①Start Thunderbird, and click "Tools", "Account Settings".

②「Account Actions」「Add Mail Account」

③Enter as follows
Your full name  :  Any name
Email addtess :" that I just added.
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-mail

①Install Amavisd and Clamav Server
➁Configuration File Edit
➂Setup and start Amavisd

④Postfix Configuration

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

2.Email spam protection

 ①SpamAssassin installed to prevent spam

②SpamAssassin Settings

③SpamAssassin configuration file update script

cd /etc/mail/spamassassin
wget -q
[ $? -ne 0 ] && exit
unzip >/dev/null 2>&1
[ $? -ne 0 ] && exit
rm -f
mv spamassassin_user_prefs-main/user_prefs .
rm -rf spamassassin_user_prefs-main
diff user_prefs > /dev/null 2>&1
if [ $? -ne 0 ]; then
cp user_prefs
echo "report_safe 0" >>
echo "rewrite_header Subject ***SPAM***" >>

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

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

Verify that the SpamAssassin configuration file 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定
④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.
Copied title and URL