The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,615 other followers

Archive for the ‘sendmail’ Category

Cleaning up bounces from /var/spool/mqueue using qtool

Posted by jpluimers on 2018/11/26

Part of my /var/spool/mqueue consist of administrative bounces to mail domains that fail for a long time.

 

First a few queries to filter the messages I want to move (the -h suppresses filename so you can aggregate with sort and uniq):

grep -h "MDeferred: Connection" /tmp/mqueue-junk/qf* | sort | uniq -c

It gives results like this:

...
     56 MDeferred: Connection refused by static.vnpt.vn.
...
      1 MDeferred: Connection reset by cleanfreshliving.com.
...
     10 MDeferred: Connection timed out with netflix.ssl.com.
...

After blacklisting those domains, I’ve used qtool.pl to cleanup the mail queue.

qtool.pl

As qtool.pl does not have “dry run” or log options, it’s best to test expressions on a copy of your mail queue first. I’ve made copies in /tmp/mqueue for this.

The query expression language on qtool.pl is complicated to get right: the documentation talks about using %msg which in fact is $msg and there is no official documentation on the mapping of qf files in the mqueue directory to expressions used in qtool.pl.

Luckily that mapping is in qtool.pl itself as explained by www.the-art-of-web.com/system/sendmail-qtool/#section_2. A recent source is at github.com/freebsd/freebsd/blob/master/contrib/sendmail/contrib/qtool.pl where I copied the fragment further below from.

Now just see these commands:

./contrib/qtool.pl -C /etc/sendmail.cf -e '$msg{message}[0] =~ /Deferred: Connection refused by/' /tmp/mqueue-junk/ /tmp/mqueue/

and

./contrib/qtool.pl -C /etc/sendmail.cf -e '$msg{num_delivery_attempts} > 100' /tmp/mqueue-junk/ /tmp/mqueue/

Since there are two M lines per qf file, you have to index the {message} part. There is no need for that with the {num_delivery_attempts}.

Because of the =~ operator, the match expressions are of [WayBack] perlre – perldoc.perl.org: Perl regular expressions.

If you run this on the live /var/spool/mqueue directory, then you can get errors like this which means you should retry after a few minutes (or run with sendmail disabled):

Could not obtain fcntl lock on '/var/spool/mqueue//qfv4H9jv7M007291': Resource temporarily unavailable.
1
Could not obtain fcntl lock on '/var/spool/mqueue//qfv5DB2NkJ024360': Resource temporarily unavailable.
1

Read the rest of this entry »

Posted in *nix, *nix-tools, Power User, sendmail | Leave a Comment »

On my todo list: experiment with having multiple sendmail queue directories under /var/spool/mqueue

Posted by jpluimers on 2018/09/27

Right now my sendmail configuration handling my domains have one queue directory /var/spool/mqueue which means that each round of the queue processing handles all the outgoing mail in succession.

This is getting less OK because of the increased mail volume over time both on mail that gets in and needs to be forwarded and mail that needs to be bounced for various reasons like SPAM.

So below are some links helping me to sort out various things including having multiple queues (as then each round can handle each queue in parallel).

The default sendmail configuration is one mail queue and I hope to find out for what reason that is.

Background info:

Read the rest of this entry »

Posted in *nix, *nix-tools, Development, Power User, Scripting, sendmail, Software Development | Leave a Comment »

Fixing Invalid HELO’s – major.io

Posted by jpluimers on 2017/12/08

for postfix and sendmail: [WayBackFixing Invalid HELO’s – major.io

Posted in *nix, *nix-tools, postfix, Power User, sendmail | Leave a Comment »

TLS tests for your mail server

Posted by jpluimers on 2017/11/09

Need to do some more research on this to ensure I didn’t goof up:

–jeroen

Posted in *nix, *nix-tools, Communications Development, Development, Internet protocol suite, postfix, Power User, Security, sendmail, SMTP | Leave a Comment »

MX Backup – Postfix Email Server | samhobbs.co.uk

Posted by jpluimers on 2017/11/09

Interesting as it has steps for both OpenSuSE and Debian each well suited for running on a Raspberry Pi.

[WayBackMX Backup – Postfix Email Server | samhobbs.co.uk

It seems postfix is a lot easier to configure than sendmail so I already like it.

First I need to read a bit more in Postfix greylisting.

I’ll need to catch up on Sam’s other parts with the postfix tag as well:

–jeroen

Posted in *nix, *nix-tools, Debian, Development, Hardware Development, Linux, openSuSE, Power User, Raspberry Pi, Raspbian, sendmail, SuSE Linux, Tumbleweed | Leave a Comment »

 
%d bloggers like this: