AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 804339
Accepted
James Swift
James Swift
Asked: 2016-09-21 15:11:59 +0800 CST2016-09-21 15:11:59 +0800 CST 2016-09-21 15:11:59 +0800 CST

在 ubuntu 16.04 上使用 Exim 设置 spammassin 和 clamav

  • 772

我一直在寻找使用 Exim 设置 Spammassassin 和 ClamAV 的帮助(在 ubuntu-16.04 上),但所有指南都已经过时了。有人可以分享他们的设置吗?

exim spamassassin clamav ubuntu-16.04
  • 2 2 个回答
  • 1355 Views

2 个回答

  • Voted
  1. Best Answer
    BillThor
    2016-09-21T16:54:05+08:002016-09-21T16:54:05+08:00

    指南可能相当陈旧,但设置过程并没有真正改变。Exim4 规范包括关于在 ACL 时进行内容扫描的一章,应该可以帮助您入门。我相信您需要安装exim4-daemon-heavy才能进行扫描。

    这是我的配置的一个摘要。我已经剥离了一些研究功能。

    安装clamav后,您需要取消注释主配置读取中的行:

    av_scanner = clamd:/var/run/clamav/clamd.ctl
    

    如果/etc/exim4/conf.d/main/02_exim4-config_options您使用的是拆分配置,或者/etc/exim4/exim4.conf.template您使用的是单个配置文件选项,则会出现此选项。

    进行扫描的最简单方法是像这样创建本地数据 acl /etc/exim4/acls/40_local-config_check-data。

    # --------------------------------------------------------------------
    # Anti-Virus scanning
    # This requires an 'av_scanner' setting in the main section.
    
    # Defer if we find malware
    defer
      malware = */defer_ok retry=60
    
    # --- BEGIN EXISCAN configuration ---
    # Invoke SpamAssassin to obtain $spam_score and $spam_report.
    # SA: log messages emulate sa-exim output for eximstats
    #
    # If the message is classified as spam, and we have not previously
    # set $acl_m_sa to indicate that we want to accept it anyway,
    # reject it.
    
    # Add a spam flag
    warn
      spam = mail:true
      add_header = X-Spam-Connect-Host: $sender_fullhost
      add_header = X-Spam-Mail-From: $sender_address
      add_header = X-Spam-Recipients: $recipients
      add_header = X-Spam-Flag: ${if >= {$spam_score_int}{SPAM_LIMIT}{YES}{NO}}
      add_header = X-Spam-Level: ${tr{$spam_bar}{+}{*}}
    
    # Add headers for data we will be reporting
    warn
      condition = ${if >= {$spam_score_int}{SPAM_REPORT}}
      add_header = X-Spam-Report: $spam_report
    
    # New Subject for BACN and SPAM
    warn
      condition = ${if >= {$spam_score_int}{SPAM_IS_HAM}}
      add_header = X-Spam-Subject: $h_Subject
      remove_header = Subject
      add_header = Subject: ${if < {$spam_score_int}{SPAM_IS_BACN} \
          {BACN}{SPAM}} $spam_score: $h_Subject
    
    # Blackhole serious Spam
    discard
      condition = ${if eq {$acl_m_sa}{canreject}}
      condition = ${if >= {$spam_score_int}{SPAM_BLACKHOLE}}
      message = Discard recipients for this message spam $spam_score.
      logwrite = SA: Action: Blackholed message: score=$spam_score. \
          From \<$sender_address\> $sender_fullhost for $recipients
    
    # Deny Spam
    deny
      condition = ${if eq {$acl_m_sa}{canreject}}
      condition = ${if >= {$spam_score_int}{SPAM_REJECT}}
      message = This message looks like spam $spam_score.
      logwrite = SA: Action: permanently rejected message: score=$spam_score. \
          From \<$sender_address\> $sender_fullhost for $recipients
    

    您需要定义垃圾邮件限制值。这些进入/etc/exim4/conf.d/main/00_local_macros或/etc/exim4/exim4.conf.localmacros取决于您使用的配置文件方法。

     # Spamassassin
    SPAM_REPORT = -10
    SPAM_IS_HAM = 25
    SPAM_LIMIT = 35
    SPAM_IS_BACN = 50
    SPAM_REJECT = 100
    SPAM_BLACKHOLE = 200
    

    该变量acl_m_sa设置为指示这是邮件管理员/滥用邮件还是发送给用户。这记录在sa-exim包的注释中。您可能更喜欢使用sa-exim而不是EXISCAN上面的 ACL 部分。

    • 2
  2. user591906
    2020-09-16T09:48:16+08:002020-09-16T09:48:16+08:00
        # order of lines matters
        warn
          spam = nobody:true #this line needed to define spam_score_int
          condition = ${if >{$spam_score_int}{60}{true}{false}} 
          add_header = X-Spam_score: $spam_score #this line must be after
          # to ensure X-Spam_score is only added when the condition is met
          # (lines before the condition are not subject to the condition)  
          add_header = X-Spam_bar: $spam_bar # this line subject to condition
          # spam_score_int = spam_score * 10 so 60 above corresponds to 6.0
    
    • -2

相关问题

  • Postfix 或 exim:自动/程序化和转发电子邮件设置

  • 将所有(未被拒绝的)垃圾邮件重定向到 sa-exim 中的特殊邮箱

  • 设置 Exim 转发邮件

  • 我可以在 Exchange 2007 的服务器端强制执行邮件规则吗?

  • 用于从多个 IP 地址发送电子邮件的 Linux 电子邮件服务器

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve