Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about qmail

Nothing Ever Really Goes Away On The Internet: ra-plugins

I used to man­age a large num­ber of QMail in­stal­la­tion­s. And be­cause Qmail was ... weird­ly li­censed, I wrote a set of plug­ins that ran on top of a patch called Qmail-SP­P. I pret­ty much stopped do­ing that years ago be­cause life took me in oth­er di­rec­tion­s, and for­got all about it.

That col­lec­tion is called ra-­plu­g­ins and I had not touched it since late 2008.

And to­day... I got a patch with two whole plug­ins to add to it so that it makes Qmail han­dle email ad­dress­es more like Gmail does (alias­es us­ing user+­foo and mak­ing us­er.­foo the same as user­foo).

So, I got them, added them, fixed a few sim­ple build­ing is­sues, up­dat­ed the lib­smtp it us­es in­ter­nal­ly for one of the plug­ins to a lat­er ver­sion, and there it stays, per­haps not to be touched un­til 2018.

Happy 10th blogiversary to me!

Since yes­ter­day this blog is ten years old so, time for some his­to­ry.

It all start­ed in ad­voga­to where you could still read it to­day! (Please read it here in­stead ;-)

Then it moved to PyDS an ear­ly python desk­top blog plat­form with a web in­ter­face, and was host­ed in PyC­S, a free ser­vice.

Then PyCS kin­da died, and I start­ed gen­er­at­ing a stat­ic blog and host­ing it in my IS­P's free host­ing. That sucked bad.

Then I start­ed my own com­pa­ny, and I had my own server­s, so I start­ed host­ing it there (even to­day this blog is com­plete­ly stat­ic HTM­L!)

Then PyDS start­ed act­ing weird, so I wrote my own blog­ging soft­ware, which is a re­al mess, per­haps 25% fin­ished, but it does things ex­act­ly the way I like them.

Cur­rent­ly, this blog is syn­di­cat­ed in Plan­e­ta PyAr, Plan­et Python, Plan­et Qt, Plan­e­ta LUGLI, and a cou­ple oth­er places.

This year, I de­cid­ed to make the blog com­plete­ly bilin­gual (English and Span­ish), but I hate trans­lat­ing it.

Ac­cord­ing to the stats I have avail­able, the blog is in av­er­age more pop­u­lar now than ev­er (but yes, my most pop­u­lar posts were years ago ;-)

stats

These are the most pop­u­lar pages in the last year:

Lesson­s:

  1. I need to write more about Qt and/or start flame­wars with clue­­less IT writ­ers

  2. I need to search for an­­cient ma­te­ri­al and de­p­re­­cate it

  3. Hav­ing your own host­ing and blog­ging soft­­ware is neat

  4. 10 years is a lot of time: 860 posts (or 913, de­pend­ing on how you coun­t)

New qmail plugin idea: overload

It should not hap­pen but it does: Your qmail serv­er is over­load­ed. Maybe you are un­der a DOS at­tack, or there is a rea­son why you are get­ting 10x your usu­al amount of mail.

But then you start see­ing how your "not pre­pro­cessed" queue starts grow­ing, and grow­ing...

This can al­so mean things like cla­mav or spa­mas­sas­s­in, which need to check the mail be­fore it gets queued are not keep­ing up with the mail flow, or maybe some IO per­for­ma­ce is­sue.

But what can you do righ now to fix it?

Well, you can dis­able spa­mas­sas­s­in, or, in ex­treme cas­es, shut­down SMTP so the sys­tem has a chance to catch its breath so to speak.

Of course, clos­ing SMTP means your own users can't send email ei­ther, which suck­s.

Now there is a lighter al­ter­na­tive: shut­down SMTP for those who are not your user­s.

Here's the triv­ial code, im­ple­ment­ed as a SPP plug­in, fit to be used in the [mail] sec­tion:

#!/bin/dash

if [ -f /var/qmail/control/overloaded ]
then
      if [ -z "$SMTPAUTHUSER" ]
      then
              echo R451 Temporary Failure: Server overload
              echo overload: $PPID Temporary Failure: Server overload >&2
      fi
fi

And if you are dar­ing and want to make your sys­tem self­-­cor­rect­ing, maybe you should cron some­thing like this:

* * * * * if [ `qmail-qstat  | tail -1 | cut -d: -f2` -gt 100 ];\
then touch /var/qmail/control/overloaded ;\
else rm -f /var/qmail/control/overloaded; fi

I will prob­a­bly code it again in C and make it part of ra/­plu­g­in­s.

Qmail public domain? Cool!!!!

Ac­cord­ing to Slash­dot, at least.

That means there can be a re­al com­mu­ni­ty project to in­te­grate all the patch­es float­ing around!

That means qmail will stop suck­ing with­out need for man­u­al labour!

I am just thrilled by this.

If you are a qmail user: read this

  • My most use­­ful plug­in is prob­a­bly ipthrot­tle, which you can use to make overea­ger IPs con­nect less of­ten.

  • The ver­­sion cur­ren­t­­ly in SVN will au­­to­block those IPs for a con­­fig­urable amount of time if you are us­ing ipsvd which is like tcpserver, on­­ly much bet­ter.

  • I re­al­­ly need some­one to help me test the SVN ver­­sion, which should be way, way bet­ter than the re­leas­es on the page.

  • The SVN re­po is at google­­code