#!/bin/bash # +----+----+----+----+ # | | | | | # Author: Mark David Scott Cunningham | M | D | S | C | # +----+----+----+----+ # Created: 2018-03-17 # Updated: 2018-03-17 # # Purpose: Add POSTFIX mail server support to spamfu # # https://www.faqforge.com/linux/server/manage-the-postfix-mailqueue-with-postsuper-postqueue-und-mailq/ # http://www.ispcolohost.com/2013/07/08/cleaning-crap-from-your-postfix-queue/ # http://en.redinskala.com/postfix-maillog-interpretation/ # http://www.postfix.org/postsuper.1.html ################################################################################ ## How-to-Postfix #------------------------------------------------------------------------------# # PHP Scripts in queue # Replace the sort|uniq with the awk array building for i in $(postqueue -p | awk '/^[0-9A-Z]/ {print $1}'); do postcat -q $i | awk -F: '/X-PHP.*Script/ {print $2}'; done | sort -b | uniq -c | sort -rnk1 #------------------------------------------------------------------------------# # Printing the Queue, and Queue Size # Like exim -bp postqueue -p # Like exim -bpc postqueue -p | grep -c '^[0-9A-Z]' # Reading the header files find /var/spool/postfix/active -type f -print | wc -l #------------------------------------------------------------------------------# # Clearing the Queue # Deletes the entire queue, reading mail ids from stdin postqueue -p | awk '/^[[:alnum:]]{10,}/ {print $1}' | postsuper -d - >/dev/null ################################################################################ ## LOGS #------------------------------------------------------------------------------# # Directories #------------------------------------------------------------------------------# # Accounts/Domains :: Authed Users :: IPs/Authed Users #------------------------------------------------------------------------------# # Spoofed Senders #------------------------------------------------------------------------------# # Bulk Senders #------------------------------------------------------------------------------# # Subjects #------------------------------------------------------------------------------# # Boucebacks ################################################################################ ## QUEUE #------------------------------------------------------------------------------# # Authed Users / Authed Local Users #------------------------------------------------------------------------------# # Spoofed Senders #------------------------------------------------------------------------------# # Subjects #------------------------------------------------------------------------------# # Scripts #------------------------------------------------------------------------------# # Senders #------------------------------------------------------------------------------# # Bouncebacks #------------------------------------------------------------------------------# # Deferred/Frozen ################################################################################ ## PHP-Maillog (This should be the same file, and needs no change)