8

I have the following header_checks in place on Postfix

/^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

Once I activate them in postfix/main.cf (after running postmap /etc/postfix/header_checks) postfix stops working. When I attempt to send an email I get the following error log

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

What is causing this? I believe it works on my old CentOS 6 installation but I am having problems with my Ubuntu 18.04 installation.

Toodarday
  • 215
  • 1
  • 2
  • 8

1 Answers1

18

pcre support is distributed in a separate package in Ubuntu. You can have postfix installed without having postfix-pcre installed.

You can confirm that this is your problem by listing all available lookup table types, typically you will have regexp installed but pcre missing:

$ postconf -m | grep re
betree
regexp

You can install the pcre lookup table type using:

sudo apt install postfix-pcre

Restart postfix and review your logs for potential errors with your (now for the first time loaded) maps:

sudo systemctl restart postfix
sudo journalctl -u postfix@-.service

Note that using postmap to update pcre-type files has no useful effect. The utility will (when not specified otherwise) assume the default database type hash: and produce a .db output for that. Which is not used for pcre.

anx
  • 8,963
  • 5
  • 24
  • 48
  • Ah! This definitely explains a _lot_. I guess that `regexp` are 'old-style' regular expressions, while `pcre`, well, as the name implies, are [Perl Compatible Regular Expressions](https://pcre.org/)... – Gwyneth Llewelyn Jul 25 '21 at 18:24
  • This last paragraph was the key for me; I was getting "postmap: fatal: unsupported dictionary type: pcre does not support bulk-mode creation." when trying to run `postmap pcre:/etc/postfix/virtual`. – miken32 Jan 11 '23 at 18:02
  • @miken32 'postmap /etc/postfix/virtua' without 'pcre:' – Hichem Jan 23 '23 at 15:16