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 / 问题 / 1047370
Accepted
71GA
71GA
Asked: 2020-12-24 14:20:16 +0800 CST2020-12-24 14:20:16 +0800 CST 2020-12-24 14:20:16 +0800 CST

Postfix -- 强制 TLS 加密不适用于端口 25“中继发送”

  • 772

在我的 Postfix 服务器上,我使用端口465进行提交,使用端口25进行中继(“中继接收”和“中继发送”)。我使用993Dovecot 中配置的端口进行邮件“检索”。

当我设置 Postfix 时,我避免配置端口25和465内部/etc/postfix/main.cf,这仍然很简单:

smtpd_banner = $myhostname -------> "HELLO!"
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 2
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mail.domain.eu
alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases
myorigin = /etc/mailname
mydestination = $myhostname, tekpi-eu, localhost.localdomain, localhost
relayhost = 
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
mydomain = domain.eu
mynetworks_style = host
virtual_mailbox_base = /var/mail/
virtual_mailbox_domains = domain.eu
virtual_mailbox_maps = hash:/etc/postfix/virtual_mailboxes
virtual_gid_maps = static:997
virtual_uid_maps = static:997
virtual_alias_maps = hash:/etc/postfix/virtual_aliases

25单独配置 ports & 465in似乎更合乎逻辑/etc/postfix/master.cf。

smtp      inet  n       -       y       -       -       smtpd
  -o syslog_name=postfix/smtp
  -o smtp_use_tls=yes
  -o smtp_tls_loglevel=1
  -o smtp_tls_security_level=encrypt
  -o smtp_tls_wrappermode=yes
# -o smtp_tls_protocols=!SSLv2,!SSLv3,!TLSv1,!TLSv1.1
  -o smtp_tls_mandatory_protocols=!SSLv2,!SSLv3,!TLSv1,!TLSv1.1
  -o smtp_tls_cert_file=/etc/ssl/certs/server-rsa.cert
  -o smtp_tls_key_file=/etc/ssl/private/server-rsa.key
  -o smtp_tls_eccert_file=/etc/ssl/certs/server-ecdsa.cert
  -o smtp_tls_eckey_file=/etc/ssl/private/server-ecdsa.key
#
  -o smtpd_use_tls=yes
  -o smtpd_tls_security_level=may
  -o smtpd_tls_protocols=!SSLv2,!SSLv3,!TLSv1,!TLSv1.1
  -o smtpd_tls_cert_file=/etc/ssl/certs/server-rsa.cert
  -o smtpd_tls_key_file=/etc/ssl/private/server-rsa.key
  -o smtpd_tls_eccert_file=/etc/ssl/certs/server-ecdsa.cert
  -o smtpd_tls_eckey_file=/etc/ssl/private/server-ecdsa.key
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_sasl_type=dovecot
  -o smtpd_sasl_path=smtpd
  -o smtpd_sasl_security_options=noanonymous
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
smtps     inet  n       -       y       -       -       smtpd
  -o syslog_name=postfix/smtps
  -o smtpd_use_tls=yes
  -o smtpd_tls_wrappermode=yes
  -o smtpd_tls_mandatory_protocols=!SSLv2,!SSLv3,!TLSv1,!TLSv1.1
  -o smtpd_tls_cert_file=/etc/ssl/certs/server-rsa.cert
  -o smtpd_tls_key_file=/etc/ssl/private/server-rsa.key
  -o smtpd_tls_eccert_file=/etc/ssl/certs/server-ecdsa.cert
  -o smtpd_tls_eckey_file=/etc/ssl/private/server-ecdsa.key
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_sasl_type=dovecot
  -o smtpd_sasl_path=smtpd
  -o smtpd_sasl_security_options=noanonymous
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
...
...
...

AFAIK 在/etc/postfix/master.cf:

  • -o smtpd_以配置入站连接开头的命令
  • -o smtp_以配置出站连接开头的命令

此外,以下行之后以应用开头的参数-o仅修改端口25:

smtp      inet  n       -       y       -       -       smtpd

同样,在下面一行之后以应用开头的参数-o仅修改端口465:

smtps     inet  n       -       y       -       -       smtpd

如您所见,我已经在端口25 出站连接上配置了强制 TLS,但是当我向 Gmail 发送电子邮件时,邮件会标有警告:“此邮件未加密”:

在此处输入图像描述

如果我检查电子邮件标头,则第一个Received字段中没有加密迹象:

Delivered-To: [email protected]
Received: by 2002:a50:a414:0:0:0:0:0 with SMTP id u20csp5876423edb;
        Wed, 23 Dec 2020 10:04:30 -0800 (PST)
X-Google-Smtp-Source: ABdhPJz/H6LVTTELjEg4kyxfY5WvBpShW3zeBpEASR/dmz8FHcT8QBpRbaNbCdGaTON4PTFMXVds
X-Received: by 2002:a05:6402:366:: with SMTP id s6mr25548681edw.44.1608746670340;
        Wed, 23 Dec 2020 10:04:30 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1608746670; cv=none;
        d=google.com; s=arc-20160816;
        b=0GELxkiim2MQGGCIrMsuVfXIiuzCbPnx6q6q7Sxuhssnb6XxCc1dtmsdUCVaGorqL/
         NWMA9sBfBZkz2ZCb90AoAk4Tyi1YzYw3WVLblw2+xQkbq+JwuYwdAjEQj2i2EJlBI3Zk
         KyYC2zfZqMkWMNRL27bI6pYwNtRYM7FifUeKmxaGuGuXv+7KY9wkrv9LTGI3a/UN634r
         Mqhog1Em8L8uLys0tDlj9GB08ZO52pPw01vJNU1AXqwOeRVznF9FPwfzP6Pn1drc4cOM
         x2vA5NJ+TgguOhqhgTSMW1hQrhNpyku3bYRW9PKQChZdHMowtSotpldYy1sJCf/VYeuA
         6fGg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-language:content-transfer-encoding:mime-version:user-agent
         :date:message-id:subject:from:to;
        bh=ZnLGQleFTlvpbWbWBAKrwartxhkzwpbLw0l/ILVPQLo=;
        b=Lt/88Ansftfa790xIUJbRfnuHWadZtBq5QHPDlDjJeGLBlmrLiyfIlzG5xwZTkqZmY
         XPImCgNHC+JfBDOhTFbiyahI7OMMAJGJAZDrr8K60TCztYqKE4Gkr6SZ7h3nAZVjLE8Y
         QBr0NOHZSQkMac/3WKOU86NtPEJwIu53Is71ucdpvNvwj8U5XHDDK9zUw8rcO9XF9JL+
         VUXTOhHmpEqhFgZDq+ldLANLkML+Ix/qvAnyb6JSss+rfsJO0h3Q2nh/LSQzbTFeWBbq
         oGksWfsCX7L0cfSij1GLWwYJ+1RrT/UBdb9p6OIK7sV2IpzAFmLgdRHoV2XHuB3XYSDy
         8gyw==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain of [email protected] designates 2a01:4f8:211:2a4::2 as permitted sender) [email protected];
       dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=domain.eu
Return-Path: <[email protected]>
Received: from mail.domain.eu ([2a01:4f8:211:2a4::2])
        by mx.google.com with ESMTP id j10si12321635ejf.404.2020.12.23.10.04.30
        for <[email protected]>;
        Wed, 23 Dec 2020 10:04:30 -0800 (PST)
Received-SPF: pass (google.com: domain of [email protected] designates 2a01:4f8:211:2a4::2 as permitted sender) client-ip=2a01:4f8:211:2a4::2;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of [email protected] designates 2a01:4f8:211:2a4::2 as permitted sender) [email protected];
       dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=domain.eu
Received: from [192.168.64.100] (188-230-147-194.dynamic.t-2.net [188.230.147.194])
    by mail.domain.eu (Postfix) with ESMTPSA id B486F15A1315
    for <[email protected]>; Wed, 23 Dec 2020 19:04:29 +0100 (CET)
To: [email protected]
From: Z L <[email protected]>
Subject: TEST (mandatory TLS): domain --> gmail
Message-ID: <[email protected]>
Date: Wed, 23 Dec 2020 19:04:29 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.6.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

CONTENT TEXT

当我向自己发送电子邮件时,也没有加密的迹象。这是一个示例电子邮件源:

Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from [192.168.64.100] (unknown [188.230.147.194])
    by mail.domain.eu (Postfix) with ESMTPSA id 3BE6015A132B
    for <[email protected]>; Wed, 23 Dec 2020 23:03:15 +0100 (CET)
To: [email protected]
From: Z L <[email protected]>
Subject: TEST (mandatory TLS): domain --> domain
Message-ID: <[email protected]>
Date: Wed, 23 Dec 2020 23:03:14 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.6.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

CONTENT TEXT

强制 TLS 适用于 port 465。我错过了什么配置,所以它不能在端口上工作25?如何解决此问题以在25 出站连接上使用强制 TLS 或机会 TLS?

postfix
  • 1 1 个回答
  • 239 Views

1 个回答

  • Voted
  1. Best Answer
    Michael Hampton
    2020-12-24T14:56:12+08:002020-12-24T14:56:12+08:00

    配置出站连接的smtp_指令需要是 in main.cf,而不是 in master.cf。后者专门处理入站连接。

    • 2

相关问题

  • 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