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 / 问题 / 1149562
Accepted
TommyPeanuts
TommyPeanuts
Asked: 2023-12-11 22:55:01 +0800 CST2023-12-11 22:55:01 +0800 CST 2023-12-11 22:55:01 +0800 CST

sasl-auth 客户端有不同的垃圾邮件过滤方法吗?

  • 772

使用标准的 Ubuntu postfix 设置(Ubuntu 22.04),我想按如下方式过滤邮件:

  1. 传入提交和 smtps(绝大多数邮件):SPF 和 RBL 检查(我使用的是policyd.pl),然后使用 Amavis 通过 spamassassin 和 clamav 检查。
  2. 来自外部网络上的客户端的经过 Sasl 验证的邮件:速率限制/检查(我正在使用postfwd该功能),然后 Amavis 检查,但不检查 SPF 和 RBL(因为我们不想根据客户端的发送网络拒绝)。

我是否正确地认为,如果我让 Amavis 检查链中的最后一个,并且仅在 master.cf“重新进入”侦听器中具有许可选项,我可以确保来自 sasl 身份验证的用户的邮件不会收到和其他邮件一样的支票吗?例如:

smtpd_client_restrictions =
    permit_mynetworks,
    # Rate limiting with postfwd: 
    check_policy_service inet:127.0.0.1:10040,
    permit_sasl_authenticated,
    # RBLs, SPF with policyd.pl:
    check_policy_service unix:private/senderCheck

smtpd_recipient_restrictions =
    permit_mynetworks,
    permit_sasl_authenticated,
    ...,
    [various reject_* lines here],
    ...,
    # Amavis checks last:
    content_filter = smtp-amavis:[127.0.0.1]:10024,
    permit

然后在 master.cf 中将 Amavis“重新进入”配置为:

127.0.0.1:10025 inet    n       -       -       -       -       smtpd
        -o syslog_name=amavis-reentry
        -o content_filter=
        -o local_recipient_maps=
        -o relay_recipient_maps=
        -o smtpd_restriction_classes=
        -o smtpd_delay_reject=no
        -o smtpd_client_restrictions=permit_mynetworks,reject
        -o smtpd_helo_restrictions=
        -o smtpd_sender_restrictions=
        -o smtpd_recipient_restrictions=
        -o smtpd_data_restrictions=
        -o smtpd_end_of_data_restrictions=
        -o mynetworks=127.0.0.0/8
        -o smtpd_error_sleep_time=0
        -o smtpd_soft_error_limit=1001
        -o smtpd_hard_error_limit=1000
        -o smtpd_client_connection_count_limit=0
        -o smtpd_client_connection_rate_limit=0
        -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks

编辑:作为参考,这是我目前在 master.cf 中的 smtpd 配置:

smtp      inet  n       -       n       -       -       smtpd
  -o smtpd_sasl_auth_enable=no
  -o smtpd_discard_ehlo_keywords=silent-discard,dsn

submission inet n       -       n       -       -       smtpd
  -o syslog_name=postfix/submission
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_tls_key_file=/etc/letsencrypt/live/smtp.xxx/privkey.pem
  -o smtpd_tls_cert_file=/etc/letsencrypt/live/smtp.xxx/fullchain.pem
  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING

smtps     inet  n       -       n       -       -       smtpd
  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_tls_security_level=may
  -o smtpd_tls_key_file=/etc/letsencrypt/live/smtp.xxx/privkey.pem
  -o smtpd_tls_cert_file=/etc/letsencrypt/live/smtp.xxx/fullchain.pem
  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
postfix
  • 1 1 个回答
  • 81 Views

1 个回答

  • Voted
  1. Best Answer
    Esa Jokinen
    2023-12-12T01:32:04+08:002023-12-12T01:32:04+08:00

    通常会有多个smptd守护进程实例用于不同目的,就像为 Amavis 配置实例一样127.0.0.1:10025。可以master.cf覆盖main.cf所述实例的设置。

    这content_filter不是一个smtpd_recipient_restrictions限制,而是一个单独的配置参数。

    以下是使用Dovecot进行Postfix SASLtcp/465身份验证的 smtps ( ) 实例的示例:

    smtps     inet  n       -       -       -       -       smtpd
      -o syslog_name=postfix/smtps
      -o smtpd_tls_wrappermode=yes
      -o smtpd_sasl_auth_enable=yes
      -o smtpd_sasl_type=dovecot
      -o smtpd_sasl_path=private/auth
      -o smtpd_sasl_security_options=noanonymous
      -o smtpd_sasl_local_domain=$myhostname
      -o { smtpd_client_restrictions = 
             check_policy_service inet:127.0.0.1:10040,
             permit_sasl_authenticated,
             reject
         }
      -o { smtpd_recipient_restrictions = 
             reject_non_fqdn_recipient, 
             reject_unknown_recipient_domain, 
             permit_sasl_authenticated,
             reject
         }
      -o content_filter=smtp-amavis:[127.0.0.1]:10024
    

    此处,限制优先于以下内容main.cf:

    • 删除smtpd_client_restrictions了policyd.pl基于策略的策略,但保留了postfwd速率限制。
    • 仅有smtpd_recipient_restrictions一小部分reject_与出站邮件相关的限制。
    • 它们permit_mynetworks已从两者中删除,因为这是明确针对经过身份验证的用户的。

    我会添加类似的内容以防止用户使用彼此的地址:

      -o smtpd_sender_login_maps=hash:/etc/postfix/virtual
      -o smtpd_sender_restrictions=reject_sender_login_mismatch
    

    Postfix和 Dovecot SASL文档有一个提交协议的示例,但RFC 8314已废弃它,并且应使用隐式 TLS ( 3.3 )即端口上的提交。465

    • 1

相关问题

  • Postfix 在特定端口上接受邮件

  • 让 Postfix 以两种方式处理垃圾邮件

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

  • 后缀电子邮件地址

  • 什么是最好的开源电子邮件解决方案包

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