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 / 问题 / 851021
Accepted
Laurent
Laurent
Asked: 2017-05-19 18:22:49 +0800 CST2017-05-19 18:22:49 +0800 CST 2017-05-19 18:22:49 +0800 CST

使用 exim4 添加 X-Spam-Flag

  • 772

我是 exim4 的新手。我有这个配置:

.ifdef SA_ENABLE
        warn
            !authenticated = *
            hosts = !127.0.0.1/24
            condition = ${if < {$message_size}{1K}}
            spam       = SA_SPAMD_USER:true
            add_header = X-Spam_score: $spam_score\n\
                   X-Spam_score_int: $spam_score_int\n\
                   X-Spam_bar: $spam_bar\n\
                   X-Spam_report: $spam_report

        warn
            !authenticated = *
            hosts = !+relay_from_hosts
            spam       = SA_SPAMD_USER:true/defer_ok
            add_header = X-Spam_score: $spam_score\n\
                    X-Spam_score_int: $spam_score_int\n\
                    X-Spam_bar: $spam_bar\n\
                    X-Spam_report: $spam_report
            set acl_m4 = $spam_score_int
            condition = ${if and{{<{$message_size}{100K}}{<{$acl_m4}{SA_SCORE_REJECT}}} {yes}{no}}
            logwrite = From $sender_address to $recipients X-Spam_score: $acl_m4.

        deny
            condition = ${if and{{>{$message_size}{10K}}{!eq{$acl_m4}{}}{>{$acl_m4}{SA_SCORE_REJECT}}} {yes}{no}}
            message = Content analisis tool detect spam (from $sender_address to $recipients). Contact SA_ABUSE_ADDR.
.endif

如果分数超过/低于某个值,我如何调整添加 X-Spam-Flag(是或否),如果超过另一个值则拒绝。(目前 SA_SCORE_REJECT = 50)

exim
  • 1 1 个回答
  • 534 Views

1 个回答

  • Voted
  1. Best Answer
    Mikhail Khirgiy
    2017-05-20T04:13:06+08:002017-05-20T04:13:06+08:00

    如果我想强制执行两个单独条件的 AND,我发现将它们写成两个单独的条件子句更清楚。我认为这会起作用:

    # Define constants
    SA_MESSAGE_SIZE=100K
    SA_SCORE_FLAG=50
    SA_SCORE_REJECT=100
    

    和

    .ifdef SA_ENABLE
        warn
            !authenticated = *
            hosts = !127.0.0.0/8 : !+relay_from_hosts
            condition = ${if <{$message_size}{SA_MESSAGE_SIZE}}
            spam       = SA_SPAMD_USER:true
            set acl_m4 = $spam_score_int
            add_header = X-Spam_score: $spam_score\n\
                   X-Spam_score_int: $spam_score_int\n\
                   X-Spam_bar: $spam_bar\n\
                   X-Spam_report: $spam_report
    
        warn
            !authenticated = *
            hosts = !127.0.0.0/8 : !+relay_from_hosts
            condition = ${if <{$message_size}{SA_MESSAGE_SIZE}}
            condition = ${if >{$acl_m4}{SA_SCORE_FLAG}}
            add_header = X-Spam-Flag: YES
            logwrite = From $sender_address to $recipients X-Spam_score: $acl_m4.
    
    # Reject spam messages with score*10 over SA_SCORE_REJECT=100
        deny
            !authenticated = *
            hosts = !127.0.0.0/8 : !+relay_from_hosts
            message = Content analysis tool detect spam (from $sender_address to $recipients). Contact SA_ABUSE_ADDR.
            condition = ${if <{$message_size}{SA_MESSAGE_SIZE}}
            condition = ${if >{$acl_m4}{SA_SCORE_REJECT}}
            logwrite = From $sender_address to $recipients spam message was rejected X-Spam_score: $acl_m4. 
    .endif
    

    $spam_score_int=100 等于 $spam_score=10.0

    • 1

相关问题

  • 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