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

Ubuntu22.04 Server : Anti-virus , Mail Server

1.Introduced Clamav antivirus software

1.1 Install

The clamav-related configuration files are installed in the /etc/clamav/ folder.

1.2 Virus Definition Update

⚫Modify configuration file

1.3 Virus Check Confirmation

①Run virus check manually

Infected files: 0 No virus.

②Virus detection by downloading test viruses
Download a harmless virus and test it for detection.
Log in as a general user and check

The virus is notified with the message "FOUND" and "Infected files: 1". Also, since the "--remove" option is attached, the test virus has been removed.

1.4 Create a script file to do a full scan

①Contents of clam-full.sh (new)

②grant execution authority

③Create a folder for virus quarantine
④Execution.
LibClamAV Warning: cli_scanxz: decompress file size exceeds limits - only scanning 27262976 bytes
If you see the above

Run with the options "--max-filesize=200M" "--max-scansize=200M"

⑤Scheduled virus scan execution with cron

2.Email software installation

2.1 Postfix : Installation/Configuration

Install Postfix and build an SMTP server; SMTP uses 25/TCP.
To prevent unauthorized mail relay, use the SASL function of Dovecot, described below, and configure Postfix so that authentication is also required for sending mail.

①Install

Installation Status Screen
You will be asked to select a general configuration setting, select "No Configuration" to set it manually later

②Configuration File Editing

Editorial content

③master.cf edit

Editorial content

④Set content reflects

2.2 Dovecot : Installation/Configuration

Install Dovecot and build a POP/IMAP server, using 110/TCP for POP and 143/TCP for IMAP
①Configure Dovecot to provide SASL functionality for Postfix

②Settings reflect

2.3 Email User Account Registration

Register a user account for e-mail.
This setting is for when a user account on the OS is also used for e-mail.
①Mail client installed

②Mailboxes are set to refer to Maildir

③Test sending mail
Send test mail to yourself [mail (user name)@(host name)].

Ctrl + D key to exit the main text

④Check incoming mail

2.4 Applied ClamAV to mail server Postfix

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

①Install Amavisd and Clamav Daemon and start Clamav Daemon

If the server is not using a fully qualified domain name (FQDN) as the hostname, Amavis may fail to start. Also, since the OS hostname may change, set a valid hostname directly in the Amavis configuration file

②15-content_filter_mode edit

③Register your own domain name

④Main.cf edit

⑤master.cf edit

Editorial content

⑥Settings reflect

⑦When you send an e-mail to yourself on Thuderbird, etc., if you see the following message in the header of the incoming e-mail, you have succeeded.

2.5 Applied spamassassin to mail server Postfix

2.5.1 Install spamassassin

①Install

②SpamAssassin Settings
The configuration file is "/etc/mail/spamassassin/local.cf".

  • Use default without additional settings
  • Creation of Maildir for storing spam mails
  • Create a directory in Maildir format to store spam emails
  • Create a directory ".Spam" in Maildir format for storing spam mails.
  • Creation is done by the target user.
2.5.2Procmail Preparation

①Install Procmail

If installed, the following results are returned

②Procmail Settings
If you put it in "/etc/procmailrc", which is in charge of the entire mail filter, it will be applied to all users.
The filter will be applied only to that user if it is written in "/home/username/.procmailrc", which is an individual mail filter file for each user.
This time, to apply to all users, we will write the following in "/etc/procmailrc".

procmailrc description (newly created)

2.5.3 Postfix Configuration

① Edit main.cf

②Reflecting and activating settings

2.5.4 Spam Email Learning

Allows all users to learn the entire contents of their ".Spam" directory as spam mail
①Spam Email Learning

②Normal mail learning

③Create a script and register it with Cron
Name the file "spam-learns.sh" and place it under /opt/script/.
After saving the script, give it executable access as "chmod 750 spam-learns.sh".

spam-learns.sh Contents

After spam-learns.sh is created, create a definition file directly under /lib/systemd/system. The name should end in .service, such as spam-learns.service.
Type is defined by simple
Contents of spam-learns.service

④Send a blank email to yourself in Thunderbird, etc., and if you see the following message in the header of the received email, you have succeeded.

Copied title and URL