Image

Knowledge base → Installing Kaspersky AntiSpam Mail Server Linux on Debian 12

[Virtual servers]
Date of publication: 29.09.2023

To protect your corporate mail server, we recommend using a product from Kaspersky - Linux Mail Server. You can download it from the official site. This product is paid and it has official installation and configuration instructions. This manual contains some nuances and points that will allow you to quickly install this product and put it into operation.

1. Fill in your data on the official website to receive a trial version of the software link. You can also buy a license for this product with us, specifying the required number of mailboxes in the order.

2. Download Kaspersky Security for Linux Mail Server for Debian. Since the Debian version is for x32, and in our case the server runs on the x64 operating system, we will install the necessary packages for compatibility.

apt install lib32ncurses5-dev lib32z1
dpkg --add-architecture i386
apt update
apt upgrade
apt-get install libc6-i386
apt install libcrypt1:i386

3. Next, let's perform the installation:

dpkg -i klms_8.0.3-30_i386.deb 

Selecting previously unselected package klms:i386.
(Reading database ... 52107 files and directories currently installed.)
Preparing to unpack klms_8.0.3-30_i386.deb ...
Unpacking klms:i386 (8.0.3-30) ...
Setting up klms:i386 (8.0.3-30) ...
Kaspersky Security for Linux Mail Server has been installed successfully,
but it must be properly configured before using.
Please run /opt/kaspersky/klms/bin/klms-setup.pl script manually to
configure it.

Please note that at the time of writing this guide, there is no official support for Debian 12 for this product. If you did everything correctly as described in step 2, then the product is successfully installed and works great.

If you are using our ready-made build of the mail server, in order to avoid problems with the simultaneous operation of dkim and kaspersky mail security server, we used integration according to the 3rd version of the installation script (after-queue).

/opt/kaspersky/klms/bin/klms-setup.pl

4. After the installation is complete, comment out the settings related to spamassasin in the postfix configuration file

/etc/postfix/master.cf

smtp inet n - y - - smtpd

#-o content_filter=spamassassin #spamassassin unix - n n - - pipe #user=spamd argv=/usr/bin/spamc -f -e #/usr/sbin/sendmail -oi -f ${sender} ${recipient}

5. Check the correctness of the configuration and restart the postfix service

postconf
service postfix restart

6. Check the sending and receiving of letters to your mailbox and run the following script to see that all letters go through kaspersky mail security.

/opt/kaspersky/klms/bin/klms-control --dashboard

7. Now we need to make sure that all spam emails and mailings end up in the spam folder. Let's make settings in the sieve sorting file.

/etc/dovecot/dovecot.sieve

require "fileinto"; if header :contains "SPAM" "YES" { fileinto "Junk"; } if header :contains "X-Spam-Flag" "YES" { fileinto "Junk"; } if header :contains "X-KLMS-AntiSpam-Status" "mass_mail" { fileinto "Junk"; } if header :contains "X-KLMS-AntiSpam-Status" "spam" { fileinto "Junk"; } if allof (header :contains "subject" "[MASSMAIL]") { fileinto "Junk"; } if allof (header :contains "subject" "[Spam]") { fileinto "Junk"; }

8. Restart the Dovecot Service

service dovecot restart

9. If you need to modify existing accounts, you can add these rules to each user's sort settings file.

cp /etc/dovecot/dovecot.sieve /home/mail/domain.tld/user@domain.tld/sieve/dovecot.sieve

10. After purchasing a license you need to install it, use the following commands

To install a key file:
/opt/kaspersky/klms/bin/klms-control --licenser --install-active-key file-name
To set the code:
/opt/kaspersky/klms/bin/klms-control --licenser --activate-license-code XXXXX-XXXXX-XXXXX-XXXXX
Don't forget to update the databases and restart the MTA

Done, now all unwanted emails flagged by kaspersky will be moved to the spam folder.





No Comments Yet