How not to prepend messages to header

Asked by Naoki

Hi team,

I'm using pypolicyd-spf 1.3.2 and Postfix 2.6.6.

I don't want to prepend messages like following.
Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=xxx.xxx.xxx.xxx; helo=AAA.co.jp; <email address hidden>; <email address hidden>
Though, I want to log the result of SPF in maillog.

Could you help me solving this matter?

Question information

Language:
English Edit question
Status:
Answered
For:
pypolicyd-spf Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Scott Kitterman (kitterman) said :
#1

That isn't something that is specifically supported. As you can see in related bugs I created a wishlist bug to add this in a future release.

In the mean time, is you put "Header_Type =" in your configuration file for the policy server it tries to prepend nothing. The different configuration options are provided in the policyd-spf.conf (5) man page [1]. I don't know what postfix will do with and empty prepend. As I read http://www.postfix.org/access.5.html something is probably required, so I would definitely test this and verify it works.

[1] http://manpages.debian.org/cgi-bin/man.cgi?query=policyd-spf.conf&sektion=5&apropos=0&manpath=Debian+8+jessie&locale=

Revision history for this message
Scott Kitterman (kitterman) said :
#2

Based on your comment in the bug, what I suggested above won't work. Since you appear to be comfortable with editing the code, here's the way I would hack this in. Find this section (it starts at line 679 for me, but it'll likely be different for you since I'm using a different version):

        # handle results {{{3
        if debugLevel >= 3: syslog.syslog('Action: {0}: Text: {1}'.format(checkerValue, checkerReason))
        if checkerValue == 'reject':
            sys.stdout.write('action=550 %s\n\n' % checkerReason)

        elif checkerValue == 'prepend':
            if configData.get('Prospective'):
                sys.stdout.write('action=dunno\n\n')
            else:
                try:
                    sys.stdout.write('action=prepend %s\n\n' % checkerReason)
                except UnicodeEncodeError:
                    sys.stdout.write('action=prepend %s\n\n' % str(checkerReason.encode("UTF-8"))[1:].strip("'"))

Change :
                    sys.stdout.write('action=prepend %s\n\n' % checkerReason)

To:
                    sys.stdout.write('action=dunno\n\n')

Can you help with this problem?

Provide an answer of your own, or ask Naoki for more information if necessary.

To post a message you must log in.