postfix의 Sieve 필터에 문제가 있습니까?

postfix의 Sieve 필터에 문제가 있습니까?

누군가 내가 겪고 있는 문제에 대해 밝힐 수 있는지 궁금합니다. 현재 나는 간단한 postfix 서버를 가지고 있고 그 앞에 PMG 게이트웨이가 있습니다. PMG 게이트웨이에는 스팸 필터가 있으므로 스팸을 사용자 정크 폴더로 이동하도록 리디렉션해야 합니다. 나는 이미 이 zimbra를 완성했지만 postfix에서 뭔가 빠진 것 같습니다. 이것이 내가 취한 단계였습니다

  1. 패키지를 설치하고 이것을 main.cf 하단에 추가하여 수정하세요.
sudo apt-get install dovecot-sieve dovecot-managesieved



mailbox_command=/usr/lib/dovecot/deliver
  1. 그런 다음 편집

    /etc/dovecot/conf.d/90-sieve.conf
    

기본 위치를 구성하기 위해 이 줄을 추가했습니다.

sieve_default = /etc/dovecot/default.sieve

그런 다음 dovecot 사용자가 파일을 읽도록 만듭니다.

chgrp dovecot /etc/dovecot/conf.d/90-sieve.conf
  1. lda 플러그인으로 가서 주석 처리를 해제하세요.

    /etc/dovecot/conf.d/15-lda.conf
    mail_plugins = sieve
    
  2. 파일 체를 만들고 컴파일하십시오.

         root@mail:/etc/dovecot# cat /etc/dovecot/default.sieve
      require "fileinto";
      #Filter email based on a subject
      if header :contains "X-Spam-Flag" "YES" {
      fileinto "Junk";
     }

그 다음에

cd /etc/dovecot

sievec default.sieve

그리고 비둘기장에 권한을 부여하세요

chgrp dovecot /etc/dovecot/default.svbin
  1. postfix와 dovecot을 다시 시작하세요

나는 다음에서 테스트 스팸 이메일을 보낸다[이메일 보호됨]

xspam 플래그를 yes로 표시했지만 정크 폴더 대신 받은 편지함으로 계속 이동합니다.

프로토콜을 확인해 봤어

root@mail:/etc/dovecot# doveconf | grep protocols
protocols = " imap sieve pop3"
ssl_protocols = !SSLv2 !SSLv3
Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from mail.mydomain.com (unknown [192.168.1.248])
    (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))
    (No client certificate requested)
    by mail.mydomain.com (Postfix) with ESMTPS id CB3162033C
    for <[email protected]>; Sun, 25 Jul 2021 10:54:03 -0500 (COT)
Received: from mail.mydomain.com (localhost.localdomain [127.0.0.1])
    by mail.mydomain.com (Proxmox) with ESMTP id 3DC215C2F3E
    for <[email protected]>; Sun, 25 Jul 2021 10:48:19 -0500 (-05)
Received-SPF: softfail (gmail.com ... _spf.google.com: Sender is not authorized by default to use '[email protected]' in 'mfrom' identity, however domain is not currently prepared for false failures (mechanism '~all' matched)) receiver=mail.mydomain.com; identity=mailfrom; envelope-from="[email protected]"; helo=emkei.cz; client-ip=101.99.94.155
Authentication-Results: mail.mydomain.com; dmarc=fail (p=none dis=none) header.from=gmail.com
Authentication-Results: mail.mydomain.com; dkim=none; dkim-atps=neutral
Received: from emkei.cz (emkei.cz [101.99.94.155])
    (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))
    (No client certificate requested)
    by mail.mydomain.com (Proxmox) with ESMTPS id 6003D5C0F66
    for <[email protected]>; Sun, 25 Jul 2021 10:48:16 -0500 (-05)
Received: by emkei.cz (Postfix, from userid 33)
    id B52D62413E; Sun, 25 Jul 2021 17:48:13 +0200 (CEST)
To: [email protected]
subject: SPAM: test
From: "test" <[email protected]>
X-Priority: 3 (Normal)
Importance: Normal
Errors-To: [email protected]
Reply-To: [email protected]
Content-Type: text/plain; charset=utf-8
Message-Id: <[email protected]>
Date: Sun, 25 Jul 2021 17:48:13 +0200 (CEST)
X-SPAM-LEVEL: Spam detection results:  6
    BAYES_50                  0.8 Bayes spam probability is 40 to 60%
    DKIM_ADSP_CUSTOM_MED    0.001 No valid author signature, adsp_override is CUSTOM_MED
    FORGED_GMAIL_RCVD           1 'From' gmail.com does not match 'Received' headers
    FREEMAIL_FROM           0.001 Sender email is commonly abused enduser mail provider (vhfgyut[at]hotmail.com) (test[at]gmail.com) (test[at]gmail.com) (test[at]gmail.com) (test[at]gmail.com) (test[at]gmail.com)
    NML_ADSP_CUSTOM_MED       0.9 ADSP custom_med hit, and not from a mailing list
    SPF_HELO_PASS          -0.001 SPF: HELO matches SPF record
    SPF_SOFTFAIL            0.665 SPF: sender does not match SPF record (softfail)
    SPOOFED_FREEMAIL        1.224 -
    SPOOF_GMAIL_MID         1.498 From Gmail but it doesn't seem to be...
X-Spam-Flag: Yes

test

답변1

Dovecot 구성을 확인하여 sieve_default=기본 시브 스크립트의 의도된 경로를 구성했는지 확인하세요.

# doveconf | grep sieve_default
 sieve_default = /var/lib/dovecot/sieve/default.sieve

또한 시브 필터 평가는 모든 작업에서 중지되지 않습니다. 항목을 여러 폴더에 보관하는 것은 완벽하게 유효합니다. 한 폴더에만 메일을 보관하려면 해당 폴더에만 해당 블록 stop끝 앞에 명령 을 추가하세요.{}

# cat /etc/dovecot/default.sieve
require "fileinto";
# filter email based on a header added by proxmox mail gateway
if header :contains "X-Spam-Flag" "YES" {
   fileinto "Junk";
   stop;
}

에 의해기본, 체 스크립트의 끝에 도달하면암시적 keep행동, 끝나지 않는 모든 호출(예: 작업에서 stop)은 이것이 명시되지 않은 경우에도 유지됩니다.

답변2

답장을 보내주셔서 정말 감사합니다. 기본 위치를 이것으로 변경해야 했고 트릭을 수행했습니다. 감사합니다

##
## Settings for the Sieve interpreter
##

# Do not forget to enable the Sieve plugin in 15-lda.conf and 20-lmtp.conf
# by adding it to the respective mail_plugins= settings.

plugin {
  # The path to the user's main active script. If ManageSieve is used, this the
  # location of the symbolic link controlled by ManageSieve.
 # sieve = ~/.dovecot.sieve

  # The default Sieve script when the user has none. This is a path to a global
  # sieve script file, which gets executed ONLY if user's private Sieve script
  # doesn't exist. Be sure to pre-compile this script manually using the sievec
  # command line tool.
  # --> See sieve_before fore executing scripts before the user's personal
  #     script.
  #sieve_default = /var/lib/dovecot/sieve/default.sieve
 sieve_default = /etc/dovecot/default.sieve

관련 정보