Ban/block an email address

OK, final post to detail exim config changes. Only three I notice, as one of them in my config was mirroring a non-standard addition to spamassassin. So:

# Top of file
#SPAMASSASSIN = yes
RSPAMD=yes


# First conditional block 
.ifdef RSPAMD
spamd_address = 127.0.0.1 11333 variant=rspamd
.endif

# Second conditional block in acl_check_receipt
.ifdef RSPAMD
  warn    set acl_m1    = no
  warn    condition     = ${if exists {/etc/exim4/domains/$domain/antispam}{yes}{no}}
          set acl_m1    = yes
.endif


# Third conditional block in acl_check_data

.ifdef RSPAMD
  accept hosts = +relay_from_hosts
  accept condition = ${if eq{$interface_port}{587}}
  accept authenticated = *

  # If message size is less than 500k and the domain has antispam enabled, scan the message with rspamd
  # This will set variables as follows: $spam_action, $spam_score, $spam_score_int (spam score x10), $spam_report, $spam_bar
  # So we add these as headers, first removing any existing ones
  warn  condition      = ${if < {$message_size}{1M}}
        condition      = ${if eq{$acl_m1}{yes}{yes}{no}}
        spam = nobody:true
        remove_header = x-spam-bar : x-spam-score : x-spam-report : x-spam-status
        add_header     = X-Spam-Score: $spam_score_int
        add_header     = X-Spam-Report: $spam_report
  add_header     = X-Spam-Action: $spam_action
        set acl_m2     = $spam_score_int

  # add x-spam-bar header if score is positive
  warn  condition = ${if >{$spam_score_int}{0}}
        add_header = X-Spam-Bar: $spam_bar

  # use greylisting if action is soft reject
  defer message    = Please try again later
        condition  = ${if eq{$spam_action}{soft reject}}

  # Hard reject if spam action is reject 
  deny  message    = Message discarded as high-probability spam
        condition  = ${if eq{$spam_action}{reject}}

  # add spam-score and spam-report header when "add header" action is recommended by rspamd
  warn
    condition  = ${if eq{$spam_action}{add header}}
    add_header = X-Spam-Status: Yes
    # Subject Re-write
    add_header     = X-Spam-Subject: [*SPAMINESS=$spam_score_int*] $h_Subject
    message        = Detected spam (from $sender_address to $recipients).

  # add x-spam-status header if message action is 'rewrite subject'
  warn
    #! condition  = ${if match{$spam_action}{^no action\$|^greylist\$}}
    condition  = ${if eq{$spam_action}{rewrite subject}}
    add_header = X-Spam-Status: Yes
    # Subject Re-write
    add_header     = X-Spam-Subject: [*SPAMINESS=$spam_score_int*] $h_Subject
    message        = Detected spam (from $sender_address to $recipients).
.endif


1 Like