If, during initial configuration of the application, you skip the automatic integration of the application with the mail server, you must integrate KSMG with the mail server manually.
You can manually configure before-queue integration of KSMG with the Exim mail server using a dynamically linked library (dlfunc). With before-queue integration, KSMG scans the messages before they end up in the queue of the Exim mail server. After-queue integration is not supported.
Depending upon the specific distribution of the operating system, you have to modify one or several configuration files of the Exim mail server:
To perform the before-queue integration of KSMG with Exim:
exim -bV
The Exim mail server supports the dlfunc dynamically loaded library if the Support for
section contains the Expand_dlfunc
line.
acl_smtp_data
. To do that, find in the Exim configuration file(s) the line that looks like:acl_smtp_data = acl_check_data
(a different variable or macro can be used in place of acl_check_data
)
and after the line
acl_check_data:
(or a string containing a different variable or macro)
add the following lines:
# Manually added block ksmg-exim-filter-dflunc begin
warn set acl_m_ksmg_input_directory = ${spool_directory}/input
set acl_m_ksmg_lookup_result = ${lookup {$message_id-D} dsearch {$acl_m_ksmg_input_directory}}
warn condition = ${if eq {$acl_m_ksmg_lookup_result}{}{yes}{no}}
set acl_m_ksmg_input_directory = ${spool_directory}/input/${substr{5}{1}{$message_id}}
warn set acl_m_ksmg_answer = ${dlfunc{DLFUNC_LIBRARY_FULLPATH}{scan}{$acl_m_ksmg_input_directory}}
defer condition = ${if match {$acl_m_ksmg_answer}{^[245]}{no}{yes}}
log_message = KSMG check failed, unexpected answer: $acl_m_ksmg_answer
defer condition = ${if match {$acl_m_ksmg_answer}{^4}{yes}{no}}
log_message = KSMG check defer: $acl_m_ksmg_answer
deny condition = ${if match {$acl_m_ksmg_answer}{^5}{yes}{no}}
log_message = KSMG check reject: $acl_m_ksmg_answer
message = This message is blocked due to security reason
warn condition = ${if match {$acl_m_ksmg_answer}{^2}{yes}{no}}
logwrite = KSMG check accept: $acl_m_ksmg_answer
# Manually added block ksmg-exim-filter-dlfunc ends here
where DLFUNC_LIBRARY_FULLPATH is the path to the dlfunc library. The path to the library depends on the version of Exim and may look like this:
kluser
user to the group that includes the user that starts the exim process.By default, this group is called 'exim' in Red Hat Enterprise Linux and Rocky Linux, and 'Debian-exim' in Ubuntu.
klusers
and kl_var_users
groups.By default, the user name is 'exim' in Red Hat Enterprise Linux and Rocky Linux and 'Debian-exim' in Ubuntu.
[global]
section, set the following parameter values:scanner=unix:/var/run/ksmg/klms_scanner_sock
header-guard=false
PrivateTmp
is set to false
or not specified in the Exim Unit file:workdir=/tmp
PrivateTmp
is set to true
in the Exim Unit file:workdir=/var/opt/kaspersky/ksmg/tmp
MTA_INTEGRATION_METHOD=dlfunc
MTA_INTEGRATION_MODE=prequeue
filters_workdir=<value of the 'workdir' parameter from step 7>
mta=manual
START_SMTP_PROXY=0
START_MILTER=0
Integration with Exim is completed.
Page top