SpamAssassin 규칙은 'spamc'를 사용한 첫 번째 스캔 중에만 유효합니다.

SpamAssassin 규칙은 'spamc'를 사용한 첫 번째 스캔 중에만 유효합니다.

SpamAssassin 설정에 사용자 정의 규칙 세트가 있습니다. 서비스( systemctl start spamassassin)를 시작하면 다음 규칙이 테스트 스팸에 대해 올바르게 평가됩니다.

[antek@mailgate ~]$ cat /tmp/spam.txt | spamc -R -l
23.4/5.0
Spam detection software, running on the system "mailgate.anadoxin.org",
has identified this incoming email as possible spam.  The original
message has been attached to this so you can view it or label
similar future email.  If you have any questions, see
the administrator of that system for details.

Content preview:  jeśli wiadomość nie wyświetliła się poprawnie, kliknij
tutaj by przejść do oferty. astra jesienne ceny opla od 89 900 zł lub
760 zł netto/mies. f gg 9086 sprawdź opel niniejszy materiał ni [...]

Content analysis details:   (23.4 points, 5.0 required)

pts rule name              description
---- ---------------------- --------------------------------------------------
-5.0 RCVD_IN_DNSWL_HI       RBL: Sender listed at https://www.dnswl.org/, high
                            trust
                            [91.185.184.51 listed in list.dnswl.org]
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was blocked.
                            See
                            http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
                            for more information.
                            [URI: xya.pl]
                            [URI: doubleclick.net]
                            [URI: dobrebazy.pl]
                            [URI: brightsender.pl]
                            [URI: ddtracker.pl]
                            [URI: lrmailr.pl]
-0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
-0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from author's
domain
-0.1 DKIM_VALID             Message has at least one valid DKIM or DK signature
 0.1 DKIM_SIGNED            Message has a DKIM or DK signature, not necessarily valid
-0.5 BAYES_05               BODY: Bayes spam probability is 1 to 5%
                            [score: 0.0121]
 2.5 GENERIC_MAILING        mailing@ in From: email address
 20 NIP_SPAM_1             BODY: No description available.
 0.5 NUMER_NIP              BODY: No description available.
 1.0 KLIKNIJ_TUTAJ          BODY: No description available.
 1.0 OFERT                  BODY: Ofert
 0.2 BAD_WORDS_2            BODY: No description available.
 0.0 HTML_MESSAGE           BODY: HTML included in message
 0.0 HTML_IMAGE_RATIO_02    BODY: HTML has a low ratio of text to image area
 0.3 CEN_IN_BODY            RAW: cen
-0.3 CENTER_IN_BODY         RAW: No description available.
 0.5 UNSUBSCRIBE            RAW: Unsubscribe in body
 0.5 NO_TO_NAME             No Real Name in To: header
 0.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors
                            in HTML
 0.9 RAZOR2_CHECK           Listed in Razor2 (http://razor.sf.net/)
 1.9 RAZOR2_CF_RANGE_51_100 Razor2 gives confidence level above 50%
                            [cf: 100]

...하지만 첫 번째 시도 후 이메일을 다시 평가하기 위해 "spamc"를 사용하면 내 맞춤 규칙이 더 이상 존재하지 않고 이메일이 스팸으로 평가되지 않습니다.

-2.8/5.0
Spam detection software, running on the system "mailgate.anadoxin.org",
has NOT identified this incoming email as spam.  The original
message has been attached to this so you can view it or label
similar future email.  If you have any questions, see
the administrator of that system for details.

Content preview:  jeśli wiadomość nie wyświetliła się poprawnie, kliknij
tutaj by przejść do oferty. astra jesienne ceny opla od 89 900 zł lub
760 zł netto/mies. f gg 9086 sprawdź opel niniejszy materiał ni [...]

Content analysis details:   (-2.8 points, 5.0 required)

pts rule name              description
---- ---------------------- --------------------------------------------------
-5.0 RCVD_IN_DNSWL_HI       RBL: Sender listed at https://www.dnswl.org/, high
                            trust
                            [91.185.184.51 listed in list.dnswl.org]
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was blocked.
                            See
                            http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
                            for more information.
                            [URI: xya.pl]
                            [URI: doubleclick.net]
                            [URI: ddtracker.pl]
                            [URI: brightsender.pl]
                            [URI: dobrebazy.pl]
                            [URI: lrmailr.pl]
-0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
-0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from author's
domain
-0.1 DKIM_VALID             Message has at least one valid DKIM or DK signature
 0.1 DKIM_SIGNED            Message has a DKIM or DK signature, not necessarily valid
-0.5 BAYES_05               BODY: Bayes spam probability is 1 to 5%
                           [score: 0.0121]
 0.0 HTML_MESSAGE           BODY: HTML included in message
 0.0 HTML_IMAGE_RATIO_02    BODY: HTML has a low ratio of text to image area
 0.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors
                           in HTML
 0.9 RAZOR2_CHECK           Listed in Razor2 (http://razor.sf.net/)
 1.9 RAZOR2_CF_RANGE_51_100 Razor2 gives confidence level above 50%
[cf: 100]

결과는 "spamc"를 사용한 후속 테스트에서도 동일합니다.

spamassassin 서비스를 다시 시작하면 내 사용자 정의 규칙이 평가되기 때문에 "이 이메일은 스팸입니다"라는 결론이 다시 나오지만 다시 한 번 시도할 때만 마찬가지입니다. 이후의 모든 호출은 내 사용자 정의 규칙을 무시하며 이메일은 더 이상 스팸이 아닙니다.

디버그 모드에서 실행 하면 spamd내 사용자 정의 프로필이 표시되지만 "이미 로드되어" 있기 때문에 로드되지 않습니다. 이것이 spamassassin의 버그입니까?

Oct 18 07:51:51.935 [1105763] dbg: prefork: ordered 1105768 to accept
Oct 18 07:51:51.938 [1105768] dbg: spamd: select() on fd bit field 00000110, timeout 0.5, not locked
Oct 18 07:51:51.939 [1105763] dbg: prefork: sysread(7) not ready, wait max 300.0 secs
Oct 18 07:51:51.941 [1105768] dbg: spamd: accept() on fd 5
Oct 18 07:51:51.943 [1105763] dbg: prefork: child 1105768: entering state 2
Oct 18 07:51:51.944 [1105763] dbg: prefork: new lowest idle kid: 1105769
Oct 18 07:51:51.951 [1105768] dbg: netset:  cached lookup on ::1, 2 networks, result: 1
Oct 18 07:51:51.952 [1105768] info: spamd: connection from ::1 [::1]:44452 to port 783, fd 5
Oct 18 07:51:51.954 [1105768] dbg: util: get_user_groups: uid is 1000
Oct 18 07:51:51.956 [1105768] dbg: util: get_user_groups: added 10 (wheel) to group list which is now: 1000 10
Oct 18 07:51:51.959 [1105768] info: spamd: setuid to antek succeeded
Oct 18 07:51:51.961 [1105768] dbg: config: parsing file /home/antek/.spamassassin/user_prefs
Oct 18 07:51:51.963 [1105768] dbg: config: fixed relative path: /home/antek/.spamassassin/custom.cf
Oct 18 07:51:51.964 [1105768] dbg: config: using "/home/antek/.spamassassin/custom.cf" for included file
Oct 18 07:51:51.966 [1105768] dbg: config: skipping already read file: /home/antek/.spamassassin/custom.cf
Oct 18 07:51:51.967 [1105768] dbg: config: parsing file /home/antek/.spamassassin/user_prefs
Oct 18 07:51:51.968 [1105768] dbg: config: fixed relative path: /home/antek/.spamassassin/playfire.cf
Oct 18 07:51:51.969 [1105768] dbg: config: using "/home/antek/.spamassassin/playfire.cf" for included file
Oct 18 07:51:51.970 [1105768] dbg: config: skipping already read file: /home/antek/.spamassassin/playfire.cf
Oct 18 07:51:51.971 [1105768] dbg: config: parsing file /home/antek/.spamassassin/user_prefs
Oct 18 07:51:51.972 [1105768] dbg: config: fixed relative path: /home/antek/.spamassassin/listonic.cf
Oct 18 07:51:51.973 [1105768] dbg: config: using "/home/antek/.spamassassin/listonic.cf" for included file
Oct 18 07:51:51.974 [1105768] dbg: config: skipping already read file: /home/antek/.spamassassin/listonic.cf
[... snip ...]

여기서 무엇이 잘못되었을 수 있습니까?

현재 소스 코드를 변경하면 작동합니다.

1887 sub read_cf_file {
1888   my($self, $path) = @_;
1889   my $txt = '';
1890
1891   #if ($self->{cf_files_read}->{$path}++) {
1892   #dbg("config: skipping already read file: $path");
1893   #return $txt;
1894   #}

하지만 내 생각에는 이 문제가 더 나은 방법으로 해결되어야 한다는 것입니다. :)

관련 정보