Giter Site home page Giter Site logo

filipnet / postfix-bounce-report Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 4.0 91 KB

Creates an HTML report of blocked e-mail messages from Postfix

License: BSD 3-Clause "New" or "Revised" License

Shell 100.00%
postfix html-report perl recipients submission bash ddns-blacklist blacklist postscreen reject

postfix-bounce-report's Introduction

postfix-bounce-report

The script generates an HTML report based on rejected messages. Another script continuously writes "recipient addresses" into a list. If an incoming message is rejected and is present in the list of "recipients", the subject of email is changing.

FEATURES

  • build_submission_recipients.sh : Analyzes the postfix maillog for outgoing e-mails and continuously creates a list of recipients
  • postfix-bounce-report.sh : Analyzes the postfix logfile for bounced emails by DDNS blacklist, optionaly validate/cross check FROM-value against submission list. Script also generates HTML report and send via sendmail
  • The subject is regular "[INFO] Postfix Bounce Report", a threshold value can be parameterized where the subject is changed to [WARNING]. For a match with the submission recipients list a [CRITIAL] is created
  • Since a spoofed e-mail address would lead to a CRITICAL, the definition of toplevel domains has been implemented in version 1.1.2. Spoofed addresses are thus recognized and marked accordingly in the HTML report.

EXAMPLE

Postfix Bounce Report HTML Example

HOW TO INSTALL

PREREQUISITES PERL INTERPRETER AND XML EXTENSION

Install XML library to read the XML files

  • Once System is fully updated, you can install libxml2-utils package through command:
  • RedHat-based: dnf install perl libxml2-utils
  • Debian-based: apt install perl libxml2-utils

Check Perl Version

  • Since the package is installed now, you can check the Perl version through perl -v command.

CLONE REPOSITORY

Change to the root-directory of your linux-system: cd ~

Clone the repository to this directory: git clone https://github.com/filipnet/postfix-bounce-report.git Afterwards you will find a new folder called "postfix-bounce-report" inside your root-directory To make the scripts universally applicable, some settings like email addresses are stored in a separate config.xml and must be adjusted here, the existing config.xml.sample renamed and adjusted before. Please note that the scripts must be made executable before the first use. chmod +x ~/*.sh

HOW TO USE

CONFIGURATION

Rename the file config.xml.sample to config.xml and adapt it to your system environment.

cd ~/postfix-bounce-report
cp config.xml.sample config.xml
vim/nano config.xml

CREATE SCHEDULED TASKS

Create a new file in /etc/cron.d/ directory:

touch /etc/cron.d/postfix-bounce-report

The content should be:

# https://github.com/filipnet/postfix-bounce-report
# Hourly script that collects the recipients for the report
@hourly root /root/postfix-bounce-report/postfix-build-submission-recipients.sh > /dev/null
# Daily script that sens out the report as an e-mail
@daily root /root/postfix-bounce-report/postfix-bounce-report.sh > /dev/null

Description

  • The script postfix-build-submission-recipients.sh scans the mail log every hour for sent e-mails, extracts the recipient's address and adds it to the list /etc/postfix/submission_recipients if not already present.
  • The script postfix-bounce-report.sh is executed once a day, returns as content an HTML table with cross-check to the submission list, sends it via e-mail.

ADDITIONAL INFORMATION

Please note that the script postfix-bounce-report.sh always generates the day before. Note if there are no conflict with your log-rotation jobs.

LICENSE

postfix-bounce-report and all individual scripts are under the BSD 3-Clause license unless explicitly noted otherwise. Please refer to the LICENSE

postfix-bounce-report's People

Contributors

filipnet avatar jaszberenyisz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

postfix-bounce-report's Issues

submission_recipient empty

Hello,

1st of all, thank you for developing this. Exactly what I was looking for.
Unfortunately, postfix-build-submission-recipients.sh runs without any error, the file submission_recipient is created in /etc/postfix but it is empty.
The script finishes in ~ 1 second.
image

The correct maillog file is set in config.xml and it contains data (at noon was about 5 MB)
Using Postfix on Ubuntu Server with perl 5.18
Any hints as to how I can debug this?

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.