Skip to content

Integração com Exim do cPanel SPFBL

Leandro Carlos Rodrigues edited this page Jul 22, 2021 · 11 revisions

Se a configuração do Exim for feita for cPanel, basta seguir na guia "Advanced Editor", e ativar a opção "custom_begin_rbl" com o seguinte código:

  accept
    condition = ${if eq {$received_port}{25}{false}{true}}
  accept
    authenticated = *
  warn
    set acl_c_spfbl = ${run{/usr/local/bin/spfbl.sh query "$sender_host_address" "$sender_address" "$sender_helo_name" "$local_part@$domain"}{ERROR}{$value}}
    set acl_c_spfreceived = $runrc
    set acl_c_spfblticket = ${sg{$acl_c_spfbl}{(PASS |SOFTFAIL |NEUTRAL |NONE |FAIL |LISTED |BLOCKED |FLAG |WHITE )}{}}
  deny
    message = 5.7.1 SPFBL $sender_host_address is not allowed to send mail from $sender_address.
    log_message = SPFBL check failed.
    condition = ${if eq {$acl_c_spfreceived}{3}{true}{false}}
  defer
    message = A transient error occurred when checking SPF record from $sender_address, preventing a result from being reached. Try again later.
    log_message = SPFBL check error.
    condition = ${if eq {$acl_c_spfreceived}{6}{true}{false}}
  deny
    message = One or more SPF records from $sender_address_domain could not be interpreted. Please see http://www.openspf.org/SPF_Record_Syntax for details.
    log_message = SPFBL check unknown.
    condition = ${if eq {$acl_c_spfreceived}{7}{true}{false}}
  deny
    message = 5.7.1 SPFBL sender has non-existent internet domain. See https://spfbl.net/en/feedback
    log_message = SPFBL check nxdomain.
    condition = ${if eq {$acl_c_spfreceived}{13}{true}{false}}
  deny
    message = 5.7.1 SPFBL IP or sender is invalid. See https://spfbl.net/en/feedback
    log_message = SPFBL check invalid.
    condition = ${if eq {$acl_c_spfreceived}{14}{true}{false}}
  defer
    message = 4.7.2 SPFBL LISTED $acl_c_spfblticket
    log_message = SPFBL check listed.
    condition = ${if eq {$acl_c_spfreceived}{8}{true}{false}}
    condition = ${if match {$acl_c_spfblticket}{^https?://}{true}{false}}
  defer
    message = 4.7.2 SPFBL you are temporarily blocked on this server. See https://spfbl.net/en/feedback
    log_message = SPFBL check listed.
    condition = ${if eq {$acl_c_spfreceived}{8}{true}{false}}
  deny
    message = 5.7.1 SPFBL BLOCKED $acl_c_spfblticket
    log_message = SPFBL check blocked.
    condition = ${if eq {$acl_c_spfreceived}{10}{true}{false}}
    condition = ${if match {$acl_c_spfblticket}{^https?://}{true}{false}}
  deny
    message = 5.7.1 SPFBL you are permanently blocked on this server. See https://spfbl.net/en/feedback
    log_message = SPFBL check blocked.
    condition = ${if eq {$acl_c_spfreceived}{10}{true}{false}}
  discard
    log_message = SPFBL check spamtrap.
    condition = ${if eq {$acl_c_spfreceived}{11}{true}{false}}
  defer
    message = 4.7.1 SPFBL you are greylisted on this server. See https://spfbl.net/en/feedback
    log_message = SPFBL check greylisting.
    condition = ${if eq {$acl_c_spfreceived}{12}{true}{false}}
  defer
    message = A transient error occurred when checking SPF record from $sender_address, preventing a result from being reached. Try again later.
    log_message = SPFBL check timeout.
    condition = ${if eq {$acl_c_spfreceived}{9}{true}{false}}
  warn
    log_message = SPFBL check flag.
    condition = ${if eq {$acl_c_spfreceived}{16}{true}{false}}
    add_header = X-Spam-Status: Yes
    add_header = Received-SPFBL: $acl_c_spfbl
  warn
    condition = ${if eq {$acl_c_spfreceived}{16}{false}{true}}
    add_header = X-Spam-Status: No
    add_header = Received-SPFBL: $acl_c_spfbl
  warn
    set acl_c_spfblticket = ${sg{$acl_c_spfblticket}{https?://.+/([0-9a-zA-Z_-]+)\\n}{\$1}}
  accept
    condition = ${if eq {$acl_c_spfreceived}{17}{true}{false}}

Para que a mensagem seja roteada pelo cPanel para a pasta ".Junk" do destinatário, é necessário criar o arquivo ".spamassassinboxenable" dentro da pasta home deste mesmo destinatário.