수신 이메일에 대한 SPF 기록을 확인하고 수신 이메일에 'Received SPF' 헤더를 추가하도록 EXIM을 구성하는 방법은 무엇입니까?

수신 이메일에 대한 SPF 기록을 확인하고 수신 이메일에 'Received SPF' 헤더를 추가하도록 EXIM을 구성하는 방법은 무엇입니까?

저는 Exim을 가지고 놀면서 이메일을 제대로 보내고 보낼 수 있는 메일 서버를 만들었습니다. 이제 모든 수신 이메일에 대해 SPF 검사를 활성화하여 Received SPF해당 이메일에 헤더를 추가하고 싶습니다 . 하지만 이 작업을 수행하는 방법을 알아낼 수 없는 것 같습니다.

의사는 이렇게 말합니다.SPF verification support is built into Exim if SUPPORT_SPF=yes is set in Local/Makefile. The support uses the libspf2 library https://www.libspf2.org/.

하지만 소스에서 Exim을 빌드하는 경우에만 이 옵션을 yes로 설정할 수 있다고 가정합니다. 우분투 패키지에서 직접 설치했는데(그러면 libspf2가 자동 설치된다고 생각합니다) 위치가 어디에 있는지 모르겠습니다 Local/Makefile. 나는 이것이 꽤 쉽게 이루어질 수 있다고 확신하지만 지금은 이것에 대한 단서가 없습니다.

또한 Exim 구성 디렉터리를 확인하고 30_exim4-config_check_rcpt파일에서 다음과 같은 관련 코드 부분을 찾았습니다.

spf-tools-perl이는 SPF 검사가 활성화되고 설치된 경우 Exim이 RCPT 명령 후에 보낸 사람의 SPF 기록을 검사한다는 것을 분명히 의미합니다 . 설치했지만 spf-tools-perl여전히 헤더가 표시되지 않습니다 Received SPF. 그러면 이는 두 가지 질문을 불러일으킵니다.

  1. 이 코드를 실행할 수 있도록 SPF 검사를 활성화하는 방법은 무엇입니까?
  2. 문서에서 spf-tools-perl이 Exim이 libspf를 사용한다고 분명히 말하는 이유는 무엇입니까? 그렇다면 왜 두 개의 라이브러리가 있습니까?
  # Use spfquery to perform a pair of SPF checks.
  #
  # This is quite costly in terms of DNS lookups (~6 lookups per mail).  Do not
  # enable if that's an issue.  Also note that if you enable this, you must
  # install "spf-tools-perl" which provides the spfquery command.
  # Missing spf-tools-perl will trigger the "Unexpected error in
  # SPF check" warning.
  .ifdef CHECK_RCPT_SPF
  deny
    message = [SPF] $sender_host_address is not allowed to send mail from \
              ${if def:sender_address_domain {$sender_address_domain}{$sender_helo_name}}.
    log_message = SPF check failed.
    !acl = acl_local_deny_exceptions
    condition = ${run{/usr/bin/spfquery.mail-spf-perl --ip \
                   ${quote:$sender_host_address} --identity \
                   ${if def:sender_address_domain \
                       {--scope mfrom  --identity ${quote:$sender_address}}\
                       {--scope helo --identity ${quote:$sender_helo_name}}}}\
                   {no}{${if eq {$runrc}{1}{yes}{no}}}}

  defer
    message = Temporary DNS error while checking SPF record.  Try again later.
    !acl = acl_local_deny_exceptions
    condition = ${if eq {$runrc}{5}{yes}{no}}

  warn
    condition = ${if <={$runrc}{6}{yes}{no}}
    add_header = Received-SPF: ${if eq {$runrc}{0}{pass}\
                                {${if eq {$runrc}{2}{softfail}\
                                 {${if eq {$runrc}{3}{neutral}\
                  {${if eq {$runrc}{4}{permerror}\
                   {${if eq {$runrc}{6}{none}{error}}}}}}}}}\
                } client-ip=$sender_host_address; \
                ${if def:sender_address_domain \
                   {envelope-from=${sender_address}; }{}}\
                helo=$sender_helo_name

  warn
    log_message = Unexpected error in SPF check.
    condition = ${if >{$runrc}{6}{yes}{no}}
  .endif```  

관련 정보