后端队列集成

2024年7月4日

ID 43923

当使用了“后端队列”集成且将邮件转发至 Kaspersky Security 8 for Linux Mail Server 进行扫描,然后再返回 Postfix 邮件服务器时,必须满足以下条件:

  • 过滤器必须配置为通过 socket-in 从 Postfix 邮件服务器拦截邮件。该套接字在以下说明的第 9 步中的程序配置文件中指定。
  • 过滤器必须通过 scanner 套接字将邮件转发至“扫描逻辑”进行扫描。该套接字是在运行初始配置脚本时指定的。
  • 过滤器必须通过 socket-out 将邮件返回 Postfix 邮件服务器。该套接字在以下说明的第 9 步中的程序配置文件中指定。

当 Kaspersky Security 8 for Linux Mail Server 与 Postfix 邮件服务器集成时, socket-in 可能仅指向网络套接字scannersocket-out 可以指向网络套接字或本地套接字。

执行 Kaspersky Security 8 for Linux Mail Server 与 Postfix 的后端队列集成:

  1. 打开配置文件 main.cf。
  2. 将以下字符串添加到 main.cf 文件的末端:

    #klms-begin-afterqueue-filter

    content_filter = klms_postfix-afterqueue:$sock_postfix_format

    #klms-end-afterqueue-filter

    其中 $sock_postfix_format 是过滤器侦听传入连接的 IP 地址和端口号,采用<IP 地址>:<端口>格式(对于网络套接字)。

  3. 打开配置文件 master.cf。
  4. 将以下字符串添加到 master.cf 文件的末端:
    • 对于 inet 套接字:

      #klms-begin-afterqueue-filter

      klms_postfix-afterqueue unix - - n - 20 smtp

      -o smtp_send_xforward_command=yes

      127.0.0.1:$forward_port inet n - n - 10 smtpd

      -o content_filter=

      -o receive_override_options=no_unknown_recipient_checks, no_header_body_checks,no_address_mappings

      -o smtpd_helo_restrictions=

      -o smtpd_client_restrictions=

      -o smtpd_sender_restrictions=

      -o smtpd_recipient_restrictions=permit_mynetworks,reject

      -o mynetworks=127.0.0.0/8,[::1]/128

      -o smtpd_authorized_xforward_hosts=127.0.0.0/8,[::1]/128

      -o smtpd_tls_security_level=none

      -o message_size_limit=0

      #klms-end-afterqueue-filter

      其中 127.0.0.1:$forward_port inet n - n - 10 smtpd 字符串是必需的,以使 Postfix 能够从过滤器接受已处理的消息并在 $forward_port 上监听数据。

    • 对于 Unix 套接字:

      #klms-begin-afterqueue-filter

      klms_postfix-afterqueue unix - - n - 20 smtp

      -o smtp_send_xforward_command=yes

      $unix_socket_name unix n - n - 100 smtpd

      -o receive_override_options=no_unknown_recipient_checks, no_header_body_checks,no_address_mappings

      -o smtpd_helo_restrictions=

      -o smtpd_client_restrictions=

      -o smtpd_sender_restrictions=

      -o smtpd_recipient_restrictions=permit_mynetworks,reject

      -o mynetworks=127.0.0.0/8,[::1]/128

      -o smtpd_authorized_xforward_hosts=127.0.0.0/8,[::1]/128

      -o smtpd_tls_security_level=none

      -o message_size_limit=0

      #klms-end

      其中 $unix_socket_name unix n - n - 100 smtpd 字符串是必需的,以使 Postfix 能够从过滤器接受已处理的消息并在 $unix_socket_name unix 套接字上监听数据。

  5. 打开文件 /var/opt/kaspersky/klms/installer.dat(Linux 环境下)或 /var/db/kaspersky/klms/installer.dat(FreeBSD 环境下)。
  6. 在文件中添加下列行:

    POSTFIX_INTEGRATION_TYPE=afterqueue

    START_SMTP_PROXY=1

  7. 打开文件 /etc/opt/kaspersky/klms/klms_filters.conf(Linux 环境下)或 /usr/local/etc/kaspersky/klms/klms_filters.conf(FreeBSD 环境下)。
  8. [global] 区域中,为 header-guard 设置设置 true 值。
  9. [smtp_proxy] 区域中,指定以下设置:

    socket-in=<IP 地址和端口号> 指定在向导的步骤 2,用于 $sock_postfix_format

    socket-out=<IP 地址和端口号><UNIX 套接字> 指定在说明的步骤 4,用于 $forward_port 或 $unix_socket_name,格式为 inet:<端口>@<IP 地址>(对于网络套接字)或 unix:<UNIX 套接字的路径>(对于 UNIX 套接字)

    示例 1:

    socket-in=inet:10025@127.0.0.1

    socket-out=inet:10026@127.0.0.1

    示例 2:

    socket-in=inet:10025@127.0.0.1

    socket-out=unix:/var/spool/postfix/public/ksmg_forward_sock

  10. 重新启动 klms 服务。
  11. 重新启动 Postfix 邮件服务器。

Did you find this article helpful?
What can we do better?
Thank you for your feedback! You're helping us improve.
Thank you for your feedback! You're helping us improve.