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 / 问题 / 1048500
Accepted
TommyPeanuts
TommyPeanuts
Asked: 2021-01-05 05:04:25 +0800 CST2021-01-05 05:04:25 +0800 CST 2021-01-05 05:04:25 +0800 CST

Postfix:如何恶意软件和垃圾邮件扫描传出的 SMTP SASL 身份验证用户?

  • 772

尽管我已经找到了两个 答案,但我无法弄清楚如何实际实施它们,并且至少其中一个并没有真正回答这个问题。因此,如果有人有任何经验可以分享,我将非常感激。

我有一台运行 Postfix 的服务器(Ubuntu 18.04)。我已经使用 postfwd 对 SASL 发件人进行速率限制,并使用 Amavis 和其他东西来扫描来自本地机器/网络(例如来自 Web 服务器)的传出邮件。没关系,在 main.cf 中看起来像这样:

smtpd_sender_restrictions =
    check_client_access cidr:/etc/postfix/internal_clients_filter,
    permit_mynetworks, 
    reject_unknown_sender_domain

在 master.cf 中

senderCheck  unix  -       n       n       -       15       spawn
  user=nobody argv=/opt/policyd/src/policyd.pl  max_idle=30 max_use=50 daemon_timeout=50

127.0.0.1:10025 inet    n    -    n    -    -    smtpd
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o smtpd_restriction_classes=
    -o smtpd_delay_reject=no
    -o smtpd_client_restrictions=
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o mynetworks=127.0.0.0/8
    -o smtpd_data_restrictions=
    -o smtpd_end_of_data_restrictions=
    -o local_header_rewrite_clients=
    -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 smtpd_milters=
    -o local_recipient_maps=
    -o relay_recipient_maps=
    -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_address_mappings

如何以与本地发件人相同的方式将 SASL 发件人(根据定义不在我的网络上)通过垃圾邮件和恶意软件扫描?

spam postfix spamassassin sasl amavis
  • 1 1 个回答
  • 307 Views

1 个回答

  • Voted
  1. Best Answer
    TommyPeanuts
    2021-01-13T00:07:02+08:002021-01-13T00:07:02+08:00

    有点尴尬的是,SASL-auth 用户被过滤掉了。但是,我没有syslog_name在 master.cf 中为 smtpd 侦听器指定 a,所以我没有看到在所有噪音中都有效的证据(SASL-auth 发送者可能是日志中所有流量的 1%)。

    因此,作为忏悔,以下是我现在稍微修改的配置的完整描述,它通过我们的邮件服务器将外发邮件(例如本地网络上的 Web 应用程序)和经 SASL 身份验证的帐户从任意外部网络发送邮件。

    除非另有说明,否则将 Ubuntu 18.04 与库存软件包一起使用:

    首先,我需要将 clamav 用户添加到与 amavis 相同的组中:

    $ id clamav
    uid=115(clamav) gid=115(clamav) groups=115(clamav),126(amavis)
    

    对/etc/amavis/conf.d文件的更改:

    05-domain_id

    @local_domains_acl = ( ".$mydomain" );
    
    # I've got multiple IP addresses on my machine and only want one to be used for mail:
    @inet_acl = qw(127.0.0.1 [::1] 185.73.x.x [2001:ba8:0:x::x]); 
    

    15-content_filter_mode:启用垃圾邮件和防病毒检查

    20-debian_defaults:设置和创建隔离目录(由 amavis 用户+组拥有)并设置final_spam_destiny为D_DISCARD

    40-policy_banks:

    $interface_policy{'10024'} = 'INTERNAL'; 
    $policy_bank{'INTERNAL'} = {  # mail originating from clients in cidr:/etc/postfix/internal_clients_filter
      bypass_spam_checks_maps   => [0],  # spam-check outgoing mail 
      bypass_banned_checks_maps => [0],  # banned-check outgoing mail 
      bypass_header_checks_maps => [0],  # header-check outgoing mail  
      forward_method => 'smtp:[127.0.0.1]:10025', # relay to Postfix listener on port 10025
    };
    

    在后缀 main.cf 中:

    smtpd_sender_restrictions =
        check_client_access cidr:/etc/postfix/internal_clients_filter,
        permit_mynetworks, 
        reject_unknown_sender_domain
    

    /etc/postfix/internal_clients_filter:

    0.0.0.0/0 FILTER smtp:127.0.0.1:10024
    ::/0 FILTER smtp:[::1]:10024
    

    在 master.cf

    127.0.0.1:10025 inet    n    -    n    -    -    smtpd
        -o syslog_name=amavis-reentry
        -o smtpd_recipient_restrictions=permit_mynetworks,reject
        -o smtpd_restriction_classes=
        -o smtpd_delay_reject=no
        -o smtpd_client_restrictions=
        -o smtpd_helo_restrictions=
        -o smtpd_sender_restrictions=
        -o mynetworks=127.0.0.0/8
        -o smtpd_data_restrictions=
        -o smtpd_end_of_data_restrictions=
        -o local_header_rewrite_clients=
        -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 smtpd_milters=
        -o local_recipient_maps=
        -o relay_recipient_maps=
        -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_address_mappings
    

    重新加载 amavis 和 postfix 以获取新配置。在您的日志中查找“amavis-reentry”,您应该会看到过滤结果。

    • 0

相关问题

  • 代表客户发送电子邮件

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

  • Linux sendmail 垃圾邮件?

  • 选择什么安全套件?

  • Exchange 2007:将带有 SenderID 的邮件移动到垃圾邮件文件夹失败?

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