Discover and Learn the Endless Tech Innovations

Mailfront Plugin Add Track Auth Sender

  • Table of Content
  • Introduction
  • Environment Configuration
  • Sender Action
  • Recipient Action
  • Data Action
  • Message Action
  • Requirements
  • Installation
  • Mailfront Plugins Configuration
  • License
  • Changes
  • Download

Introduction

Last Updated: 01 Sep 2016 GMT +8.

This plugin provides an ability to add authenticated sender to message header with each line header message prefixed if $TRACK_AUTH_SENDER environment variable is set and not empty. Otherwise it will be set to X-AntiAbuse: . If $TRACK_AUTH_SENDER_HEADER is set and not empty, this value will be added to the mail header first once otherwise it will use X-AntiAbuse: This header was added to track abuse, please include it with any abuse report without any newline.

IMPORTANT: This plugin version is written for and tested with mailfront 2.12.

Environment Configuration

$TRACK_AUTH_SENDER_HEADER
If set, message header will be added first once with this variable if not empty.
$TRACK_AUTH_SENDER
If set, each line of message header will be prefixed with this variable if not empty.

Sender Action

None.

Recipient Action

None.

Data Action

When client starts to transmit data, this plugin will start its checking for $TRACK_AUTH_SENDER environment variable if sender is authenticated and will add those sender hostname (if found), sender IP address, sender domain and sender username to the message header.

X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname  - hostname
X-AntiAbuse: Sender Hostname   - sender_remotehost
X-AntiAbuse: Sender IP Address - sender_ip_address
X-AntiAbuse: Sender Username   - senderusername
X-AntiAbuse: Sender Domain     - senderdomain.com
X-AntiAbuse: Sender Address    - senderemailaddress
X-AntiAbuse: Log Hash          - 32 characters randomly generated string
X-AntiAbuse: Log Pid           - pid
X-AntiAbuse: authenticated_id  - senderusername@senderdomain.com

Log Hash and Log Pid will be printed hence get logged in the respective logs depending on your run scripts. This will be useful to verify in logs against the headers reported.

Example: If you export the following variables in your smtpd, submssion and/or smtpsd run scripts:

export TRACK_AUTH_SENDER="X-TrackAuthSender: "
export TRACK_AUTH_SENDER_HEADER="${TRACK_AUTH_SENDER}This header was added to track abuse, please include it with any abuse report"

Then the example headers will be as below where Log Hash is 32 characters length randomly generated:

X-TrackAuthSender: This header was added to track abuse, please include it with any abuse report
X-TrackAuthSender: Primary Hostname  - hostname
X-TrackAuthSender: Sender Hostname   - sender_remotehost
X-TrackAuthSender: Sender IP Address - sender_ip_address
X-TrackAuthSender: Sender Username   - senderusername
X-TrackAuthSender: Sender Domain     - senderdomain.com
X-TrackAuthSender: Sender Address    - senderemailaddress
X-TrackAuthSender: Log Hash          - ogGvM7gJ0DQnDWNNUDYhj5q7Fw2k1qVf
X-TrackAuthSender: Log Pid           - pid
X-TrackAuthSender: authenticated_id  - senderusername@senderdomain.com

And the example will be printed to the log file:

mailfront-plugin-add-track-auth-sender[pid]: Log Hash = ogGvM7gJ0DQnDWNNUDYhj5q7Fw2k1qVf
mailfront-plugin-add-track-auth-sender[pid]: authenticated_id = senderusername@senderdomain.com

Note: If sender is not authenticated, then this plugin will be skipped.

Message Action

None.

Requirements

  • mailfront version 1.12 or later
  • bglibs version 1.104 or later (might work with earlier version)

Installation

  • Build and install mailfront
  • Switch back to this package
  • Adjust the contents of the conf-* files
  • Build the sources by running "make"
  • Install the plugin by running "make install"

Mailfront Plugins Configuration

Place add-track-auth-sender in mailfront's plugin list. Depending on your setup:

  • edit the smtpfront-qmail shell script and place the string add-track-auth-sender after add-received
  • edit the PLUGINS environment variable and place the string add-track-auth-sender after add-received
  • place the argument add-track-auth-sender after the add-received of the mailfront command

Set up environment as described in Environment Configuration above or plugin-add-track-auth-sender.html which is included in the package.

License

This package is copyright © 2013 Giam Teck Choon or CHOON.NET, and may be copied according to the GNU GENERAL PUBLIC LICENSE (GPL) Version 2 or a later version. A copy of this license is included with this package. This package comes with no warranty of any kind.

Changes

  • 06 May 2013 GMT +8 : version 0.01
  • Initial release
  • 24 May 2013 GMT +8 : version 0.02
  • Update plugin-add-track-auth-sender.html
  • Add #define eprintf and eprintf_logname function
  • Change declaration thispid from static pid_t to static unsigned long
  • spec: Add gcc options '-Wall -g -O2' echo into conf-ld
  • Makefile: Add reset and rpmenv options
  • conf-ld: Add '-Wall -g -O2' options to gcc
  • 01 Sep 2016 GMT +8 : version 0.03
  • Fix compile with bglibs version 2.03