DevHeads.net

Postfix queue

Lately I wrote in python postfix policy service that can do something for
me what I want.
Now I am thinking about next service butI don't know maybe it is not
possible.

That is my question:

There is posssible write some service similar to eg.

check_policy_service unix:private/policy-spf

It is possible to write some policy service that will be working with
postfix queue ?

I would like have policy service that will be able to write do data base
some information eg. when exactly message was sent, message ID, DSN if
soemthing goes wrong. That means it should be working with Postfix queue.

But policy services can be configured with smtpd_sender_restrictions and
smtpd_recipient_restrictions.
It 's possible configure some policy service with postfix queue ?

Regards,
MattX

Comments

Re: Postfix queue

By Wietse Venema at 02/12/2018 - 12:59

You can use "postqueue -j" to get a machine-readable queue listing
with arrival time, and why mail is still in the queue.

However for historical information of past deliveries you will have
to rely on Postfix logs.

Wiietse

Re: Postfix queue

By j.emerlik at 02/12/2018 - 14:29

I am generalny using postfix-logwatch for tracking log files.

However, I was thinking about something that is working in real time,
scripts can be run by cron in some period time.
Then the best could be write some syslog phraser or redirect syslog to some
application eg. written in Java to interpret log file in realtime.

2018-02-12 17:59 GMT+01:00 Wietse Venema < ... at porcupine dot org>:

Re: Postfix queue

By j.emerlik at 02/12/2018 - 15:25

I am generally using postfix-logwatch for tracking log files.

However, I was thinking about something that is working in real time,
scripts can be run by cron in some period time.
Then the best solution could be write some syslog phraser or redirect
syslog to some
application eg. written in Java to interpret log file in realtime.

Maybe someone has a better idea?

Re: Postfix queue

By Viktor Dukhovni at 02/12/2018 - 11:40

No. That's a bad idea anyway. To track message flow, parse the logs.

Re: Postfix queue

By Wietse Venema at 02/12/2018 - 12:56

Viktor Dukhovni:
The closest that comes to this is a daemon that responds to
transport_maps queries. If you must do that, I suggest using a
socketmap table.

<a href="http://www.postfix.org/transport.5.html" title="http://www.postfix.org/transport.5.html">http://www.postfix.org/transport.5.html</a>
<a href="http://www.postfix.org/socket_table.5.html" title="http://www.postfix.org/socket_table.5.html">http://www.postfix.org/socket_table.5.html</a>

But, it will drain performance.

Wietse

RE: Postfix queue

By Fazzina, Angelo at 02/12/2018 - 11:28

Hi, I would think you could write a script to do what you need ?

Here is one I use that is in Python.

[root@mta3 alf02013]# Summary

Usage: Summary -s -h {-|POSTFIX_LOG} [ POSTFIX_LOG .. ]

Summarize postfix mail log. Gzipped files are OK.

Print one line for each delivered email, with these columns

TIME_RECEIVED TIME_SENT ELAPSED QUEUEID SOURCE_IP AUTHENTICATE_USER FINAL_STATUS FROM_ADDR TO_ADDRS

OPTIONS
-h Print column headers
-s Include email subject (if in Postfix log)

-ANGELO FAZZINA

ITS Service Manager:
Spam and Virus Prevention
Mass Mailing
G Suite/Gmail

<a href="mailto: ... at uconn dot edu"> ... at uconn dot edu</a>
University of Connecticut, ITS, SSG, Server Systems
860-486-9075

Lately I wrote in python postfix policy service that can do something for me what I want.
Now I am thinking about next service butI don't know maybe it is not possible.
That is my question:
There is posssible write some service similar to eg.

check_policy_service unix:private/policy-spf
It is possible to write some policy service that will be working with postfix queue ?

I would like have policy service that will be able to write do data base some information eg. when exactly message was sent, message ID, DSN if soemthing goes wrong. That means it should be working with Postfix queue.
But policy services can be configured with smtpd_sender_restrictions and smtpd_recipient_restrictions.
It 's possible configure some policy service with postfix queue ?
Regards,
MattX

Re: Postfix queue

By Ralph Seichter at 02/12/2018 - 11:22

That's not really a specific description of your needs or design goals,
so you can expect answers to be similarly vague. ;-) Have you looked
into postqueue(1) and/or showq(8) yet?

-Ralph

Re: Postfix queue

By j.emerlik at 02/12/2018 - 11:44

I would like have database and there information : Message ID, Sent Date
(or last date of send trying), DSN, number of send attempts, Mail_From,
RCPT_TO.

It would be helpful to create statistics or check exacly what happened
with the messages sent, eg, six months ago.

2018-02-12 16:22 GMT+01:00 Ralph Seichter <m16+ ... at monksofcool dot net>:

Re: Postfix queue

By Ralph Seichter at 02/12/2018 - 12:34

That type of information should be extracted from the Postfix logs,
as existing tools like 'pflogsumm' do.

-Ralph