大网数据广告活动
服务器运维问答

Postfix: require valid sender address

· 52CE 我爱测

Few days ago I received a message with ""@smtp.enta.net as the sender in both the From: and Return-Path headers. Postfix accepted that email and transport it to dovecot. Is it possible to configure Postfix to require a valid send…

问题原文

原帖链接 · QkiZ · CC BY-SA 3.0

Few days ago I received a message with ""@smtp.enta.net as the sender in both the From: and Return-Path headers. Postfix accepted that email and transport it to dovecot.

Is it possible to configure Postfix to require a valid sender address (or at least a valid looking sender) or can I block emails without username before the @ symbol?

Headers of that message:

Return-Path: <""@smtp.enta.net>
Delivered-To: <[email omitted]>
Received: from mail.example.com by mail.example.com (Dovecot) with LMTP id
 Q7XVJrXy3lYYdQAAfPZOvw for <[email omitted]>; Tue, 08 Mar 2016 16:41:41 +0100
Received: by mail.example.com (Postfix, from userid 109) id 9BA2320826; Tue,  8
 Mar 2016 16:41:41 +0100 (CET)
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.example.com
X-Spam-Level: *
X-Spam-Status: No, score=1.7 required=5.0 tests=BAYES_00,FROM_NO_USER,
 HDRS_MISSP,HELO_MISC_IP,RDNS_NONE autolearn=no autolearn_force=no
 version=3.4.0
Received-SPF: None (no SPF record) identity=mailfrom;
 client-ip=171.233.198.106; helo=[171.233.198.106];
 envelope-from=@smtp.enta.net; receiver=[email omitted] 
Received: from [171.233.198.106] (unknown [171.233.198.106]) by
 mail.example.com (Postfix) with ESMTP id 0CB112081D for
 <[email omitted]>; Tue,  8 Mar 2016 16:41:39 +0100 (CET)
From: ""@smtp.enta.net
To: [email omitted]
Subject: New voice mail message from 02083469819
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="3MwIy2ne0vdjdPXF"
Message-Id: <[email omitted]>
Date: Tue, 08 Mar 2016 22:41:29 +0700
X-Evolution-Source: [email omitted]

已采纳解答

原帖链接 · masegaloeh · CC BY-SA 3.0

You can use PCRE table and put it in smtpd restriction

# /etc/postfix/empty.pcre
/^""@/    REJECT

and in the main.cf

smtpd_recipient_restrictions =
    check_recipient_access pcre:/etc/postfix/empty.pcre,
    check_sender_access pcre:/etc/postfix/empty.pcre
    ... other restrictions ...

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-03-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。