Qmail Patch

We need a good c programmer for a patch that will modify qmail logging process.
The bidder should have experience in patching qmail and a very good knowledge of its inner functioning. We will ask for a previous example of work on qmail.

Objective: To have more control on status responses from mails sent through qmail-queue.

Description:
Our system currently pipes outgoing emails to qmail-remote which returns the server’s response if the connection was successful.
If not, it pipes it to qmail-queue, that handles retries through qmail-send until the queue lifetime expires.
The problem is that our messages are identified by an internal code that we loose after the email has been piped to qmail-queue, so we cannot match qmail log system and ours.

Resolution:
We need qmail to write a second log file with the information we need. No changes will be made to the out of the box logging process, except that a flag will allow us to avoid it triggered by a control file (see control files).
The custom logfile will have the format:
dateHour customCode server_Response

dateHour: date and time of the log entry
customCode: Extracted from the message headers. The line number is defined in a control file (see control files)
it will have the form:
custom_header_name: custom_header_value
custom_header_name can vary, custom_header_value is the string that we need to extract as the customCode.

server_Response: the full string returned by qmail (the same that is written in /var/log/qmail/current)
Example: success: 192.168.1.1_accepted_message./Remote_host_said:_250_2.0.0_Ok:_queued_as_8AF03C004088D/

The entry in the custom logfile will be appended only when the message is erased from the queue. That happens in 2 cases:
1/ The message has been successfully sent
2/ The message has been too long inside the queue and will be discarded

The patch should not be applied to qmail-remote as we use it directly from other parts of our system. Instead you need to modify qmail-send or qmail-rspawn
The patch should have a very low impact on qmail general performance.

Control Files:
The following files, placed in /var/qmail/control will control some of the patch variables:
customlog:
set to 0: No logging
set to 1: current logging (writes to /var/log/qmail/current)
set to 2: custom logging
set to 3: custom and current logging

customlogfile:
defines the complete path of the log file.
example: /home/qmail/log/qmail_log

customheaderline:
Line number of the message header where our custom code is located.

Leave a Reply

Your email address will not be published. Required fields are marked *