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 / 问题 / 986983
Accepted
Lasse Michael Mølgaard
Lasse Michael Mølgaard
Asked: 2019-10-07 12:29:52 +0800 CST2019-10-07 12:29:52 +0800 CST 2019-10-07 12:29:52 +0800 CST

从 Z-push 接收时,Postfix 不会将邮件传递给 Amavis

  • 772

对于如何让 ActiveSync 与我的邮件服务器正常工作,我有点盯着自己看,所以也许这里的任何人都有一个想法?

交易是邮件服务器托管四个域,我希望所有发送的邮件都具有 DKIM 签名。

通过 SMTP 发送时我已经让它工作了,但是当客户端使用 ActiveSync 发送电子邮件时它签名失败。

无论如何,这里是关于它如何用于 SMTP 的图表:

Postfix 与 Amavis 一起处理邮件的流程图

Postfix 决定如何识别来自经过身份验证的用户发送的邮件(属于我的托管域之一)与来自 Internet 上某处的邮件的大部分魔法来自以下行/etc/postfix/main.cf:

smtpd_sender_restrictions = 
    check_sender_access regexp:/etc/postfix/tag_as_originating.re, 
    permit_mynetworks, 
    permit_sasl_authenticated, 
    check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf, 
    check_sender_access regexp:/etc/postfix/tag_as_foreign.re

content_filter = amavis:[127.0.0.1]:10024

的内容/etc/postfix/tag_as_foreign.re:

/^/ FILTER amavis:[127.0.0.1]:10024

Amavis 使用端口 10025 将结果发送回 Postfix,由/etc/postfix/master.cf以下配置处理:

127.0.0.1:10025 inet n - n - - smtpd
    -o content_filter=
    -o local_recipient_maps=
    -o relay_recipient_maps=
    -o smtpd_restriction_classes=
    -o smtpd_client_restrictions=
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks, reject
    -o mynetworks=127.0.0.0/8
    -o strict_rfc821_envelopes=yes
    -o receive_override_options=no_unknown_recipient_checks, no_header_body_checks
    -o smtp_send_xforward_command=yes
    -o disable_dns_lookups=yes

的内容/etc/postfix/tag_as_originating.re:

/^/ FILTER amavis:[127.0.0.1]:10026

结果使用端口 10027 发送回 Postfix,并由以下代码处理/etc/postfix/master.cf:

127.0.0.1:10027 inet n - n - - smtpd
    -o content_filter=
    -o local_recipient_maps=
    -o relay_recipient_maps=
    -o smtpd_restriction_classes=
    -o smtpd_client_restrictions=
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks, reject
    -o mynetworks=127.0.0.0/8
    -o strict_rfc821_envelopes=yes
    -o receive_override_options=no_unknown_recipient_checks, no_header_body_checks
    -o smtp_send_xforward_command=yes
    -o milter_default_action=accept
    -o milter_macro_daemon_name=ORIGINATING
    -o disable_dns_lookups=yes

最后,这里是master.cf关于如何将邮件首先引入 Postfix 的相关行:

smtp      inet  n       -       y       -       -       smtpd

pickup    unix  n       -       y       60      1       pickup

submission inet n       -       y       -       -       smtpd
  -o syslog_name=postfix/submission
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated, reject

smtps     inet  n       -       y       -       -       smtpd
  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated, reject

我正在使用Z-push通过 ActiveSync 处理连接,但我的问题如下:

我在 mail.log 中注意到,即使在 z-push 配置文件中声明它应该通过 SMTP 将传入的邮件传递给 postfix,它仍然坚持将传入的邮件直接放入 maildrop 目录,该目录又由 Postfix 拾取守护进程处理。

从那里,邮件或者直接转发到目的地地址,甚至没有经过 Amavis 的 DKIM 签名。

问题是:如何让 Postfix 将邮件从取件守护程序传递到 Amavis,以便在转发到目的地之前获得 DKIM 签名?

pickup是否就像在master.cf文本下方插入一行一样简单:

-o content_filter = amavis:[127.0.0.1]:10026

...还是与现有设置冲突?:-)

postfix
  • 1 1 个回答
  • 753 Views

1 个回答

  • Voted
  1. Best Answer
    Lasse Michael Mølgaard
    2019-10-12T02:14:32+08:002019-10-12T02:14:32+08:00

    经过一些更多的调整,我终于让它工作了。

    这是对正在发生的事情的解释。

    Z-push 是用 PHP 编写的,我在 Internet 上可以找到,PHP 邮件设置是通过php.ini.

    在php-ini-file 中,您将被告知发送邮件时唯一可用的选项是通过sendmail,因此从 Z-push 收到的所有收到的邮件将始终发送到 maildrop 文件夹,然后 Postfix 拾取守护进程会处理该文件夹。

    SMTP 设置仅在安装在 Windows 主机上时有效。

    如果您问我,这有点愚蠢,但无论如何,如果我想使用通过 ActiveSync 协议(也称为 Z-push)接收的 DKIM 签名对邮件进行签名,我需要采取另一条路线。

    我怀疑我需要添加content_filter到行后面的pickup行中/etc/postfix/master.cf,但我还需要稍微调整我的 Amavis 配置文件。

    该文件/etc/postfix/master.cf基本上和以前一样,除了当您转到拾取行时,它现在声明:

    amavis unix - - y - 2 smtp 
       -o smtp_data_done_timeout=1200
       -o smtp_send_xforward_command=yes
       -o smtp_bind_address=
    
    pickup    unix  n       -       y       60      1       pickup
       -o content_filter=amavis:[127.0.0.1]:10026
    

    我添加了 amavis 部分,因为我发现如果将其注释掉,则永远不会调用 Amavis。只是为了一切的完整性。:-)

    在/etc/amavis/conf.d/50-user以下配置中,Amavis 如何区分从任何地方到我的邮件帐户的入站邮件与从我的一个帐户发送到任何地方的邮件:

    $inet_socket_port = [10024,10026];
    
    $forward_method = 'smtp:[127.0.0.1]:10025';
    $notify_method = 'smtp:[127.0.0.1]:10027';
    
    $interface_policy{'10026'} = 'ORIGINATING';
    $policy_bank{'ORIGINATING'} = {
        originating => 1,
        smtpd_discard_ehlo_keywords => ['8BITMIME'],
        forward_method => 'smtp:[127.0.0.1]:10027',
    };
    
    # IP-Addresses for internal networks => load policy MYNETS
    # - requires -o smtp_send_xforward_command=yes in postfix master.cf
    @mynetworks = qw(0.0.0.0/8 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 
                     [::1] [FE80::]/10 [FEC0::]/10);
    
    # Allow SMTP access from IPs in @inet_acl to amvisd SMTP Port
    @inet_acl = qw( 127.0.0.1 [::1] 192.168.0.0/16 );
    
    # DKIM
    $enable_dkim_verification = 1; 
    $enable_dkim_signing = 1; # load DKIM signing code
    $signed_header_fields{'received'} = 0;  # turn off signing of Received
    @dkim_signature_options_bysender_maps = (
    { '.' => { ttl => 21*24*3600, c => 'relaxed/simple' } } );
    
    

    我提到的调整是在我有以下几行之前/etc/amavis/conf.d/50-user:

    $forward_method = 'smtp:[127.0.0.1]:*';
    $notify_method = 'smtp:[127.0.0.1]:*';
    
    $policy_bank{'ORIGINATING'} = {
        originating => 1,
        smtpd_discard_ehlo_keywords => ['8BITMIME'],
    };
    
    

    工作方式*是,无论 Amavis 在端口(例如“10025”)上收到什么,都会在更高的端口(例如“10026”)上回复。

    我需要的是更明确一点——以避免混淆。

    如果有其他人在他们的屏幕上咒骂试图让 DKIM 与 Postfix 和 Amavis 一起工作,我希望这能有所帮助。:-)

    • 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