“不支持的字典类型:pcre”后缀 header_checks

Too*_*day 4 email email-server postfix

我在 Postfix 上有以下 header_checks

/^Received:/ IGNORE
/^X-Originating-IP:/    IGNORE
/^X-Mailer:/            IGNORE
/Message-Id:\s+<(.*?)@www.mainserver.com>/   REPLACE Message-Id: <$1@www.domain.com>
/X-Mailer-LID:/        IGNORE
/^MIME-Version:/i PREPEND Precedence: bulk
/X-Mailer-RecptId:/        IGNORE
/X-Mailer-SID:/        IGNORE
/X-Mailer-Sent-By:/        IGNORE
/List-Unsubscribe:/        IGNORE
Run Code Online (Sandbox Code Playgroud)

一旦我在postfix/main.cf(运行后postmap /etc/postfix/header_checks)激活它们,postfix 就会停止工作。当我尝试发送电子邮件时,我收到以下错误日志

Jun 20 03:19:26 mail postfix/pickup[6813]: F37593F946: uid=0 from=<root@domain.com>
Jun 20 03:19:26 mail postfix/cleanup[6819]: warning: pcre:/etc/postfix/header_checks is unavailable. unsupported dictionary type: pcre
Jun 20 03:19:26 mail postfix/cleanup[6819]: warning: pcre:/etc/postfix/header_checks lookup error for "Received: by mail.domain.com (Postfix, from userid 0)??id F37593F946; Thu, 20 Jun 2019 03:19:26 +0200"
Jun 20 03:19:26 mail postfix/cleanup[6819]: warning: F37593F946: header_checks map lookup problem -- message not accepted, try again later
Jun 20 03:19:26 mail postfix/pickup[6813]: warning: maildrop/F27653F945: error writing F37593F946: queue file write error
Jun 20 03:19:27 mail postfix/pickup[6813]: F42373F946: uid=0 from=<root@domain.com>
Jun 20 03:19:27 mail postfix/cleanup[6819]: warning: pcre:/etc/postfix/header_checks is unavailable. unsupported dictionary type: pcre
Jun 20 03:19:27 mail postfix/cleanup[6819]: warning: pcre:/etc/postfix/header_checks lookup error for "Received: by mail.domain.com (Postfix, from userid 0)??id F42373F946; Thu, 20 Jun 2019 03:12:51 +0200"
Jun 20 03:19:27 mail postfix/cleanup[6819]: warning: F42373F946: header_checks map lookup problem -- message not accepted, try again later
Jun 20 03:19:27 mail postfix/pickup[6813]: warning: maildrop/2C3F23F172: error writing F42373F946: queue file write error
Jun 20 03:19:27 mail postfix/pickup[6813]: 00EE13F946: uid=0 from=<root@domain.com>
Jun 20 03:19:27 mail postfix/cleanup[6819]: warning: pcre:/etc/postfix/header_checks is unavailable. unsupported dictionary type: pcre
Jun 20 03:19:27 mail postfix/cleanup[6819]: warning: pcre:/etc/postfix/header_checks lookup error for "Received: by mail.domain.com (Postfix, from userid 0)??id 00EE13F946; Thu, 20 Jun 2019 03:13:36 +0200"
Jun 20 03:19:27 mail postfix/cleanup[6819]: warning: 00EE13F946: header_checks map lookup problem -- message not accepted, try again later
Jun 20 03:19:27 mail postfix/pickup[6813]: warning: maildrop/924363F173: error writing 00EE13F946: queue file write error
Run Code Online (Sandbox Code Playgroud)

这是什么原因造成的?我相信它适用于我的旧 CentOS 6 安装,但我的 Ubuntu 18.04 安装有问题。

anx*_*anx 11

pcre支持分布在 Ubuntu 的一个单独的包中。你可以有后缀而无需安装后缀-PCRE安装。

您可以通过列出所有可用的查找表类型来确认这是您的问题,通常您会安装regexp但缺少pcre

$ postconf -m | grep re
betree
regexp
Run Code Online (Sandbox Code Playgroud)

您可以使用以下方法安装pcre查找表类型:

sudo apt install postfix-pcre
Run Code Online (Sandbox Code Playgroud)

重新启动postfix并检查您的日志以了解您的(现在是第一次加载)地图的潜在错误:

sudo systemctl restart postfix
sudo journalctl -u postfix@-.service
Run Code Online (Sandbox Code Playgroud)

请注意,postmap用于更新pcre类型的文件没有任何有用的效果 - postmap 实用程序将假定默认数据库类型(通常是hash)并.db 为其生成输出 - 不用于pcre