postfix patch: reject or strip characters

News 29 August 2005: The functionality provided by this patch has been included in postfix-2.3-20050829. If you can upgrade to postfix 2.3 or later then this patch is not necessary.

The following patch can help if you use postfix and cyrus. Cyrus rejects nul characters causing postfix to bounce the message. Instead of boucing it is better to reject these messages in postfix. An alternative would be to strip the nul characters out either in postfix or in cyrus.

This patch adds two new paramters which can be specified in main.cf:

message_reject_characters (default: empty)

Characters which cause message to be rejected if they occur within message. Example: \r\n\0. If both message_strip_characters and message_reject_characters are specified and contain a character in common, the reject action takes precedence if the character is found.

message_strip_characters (default: empty)

Characters which are stripped if they occur within message. Example: \r\n\0. If both message_strip_characters and message_reject_characters are specified and contain a character in common, the reject action takes precedence if the character is found.

I use the following values:

message_reject_characters = \0
message_strip_characters = \n\r

Obtaining and installing

Download latest versions

These versions have been rewritten to have a minimum performance impact when the features are turned off and to improve performance when the features are turned on. These versions are still under test. Feel free to experiment with them and provide feedback.

(depending on your browser, it's probably best saving the file with right click)

Download previous versions

Only use the previous versions of these patches in a live environemnt if you intend turning the features on and you have verified that the performance impact does not negatively impact you if you have a high volume site. Testing was carried out on a low volume site.

(depending on your browser, it's probably best saving the file with right click)

Installation

Contact

john at gufonero.com

Last modified Monday, 13-Apr-2009 09:51:48 CEST