Ahhhh, you can tell I'm proud!  ;)

Per domain scanning is now available via TCPSERVER w/ mysql patch.

It's pretty simple to set up.  Of course, this is assuming that you're
running VPOPMAIL and using mysql!  I've added an additional sql query in
tcpserver that looks for the ip address that the client is CONNECTING to.
I.E. the smtp server's IP that they connected to.  If it finds it in the
table with the field "env_var" set to "QMAILQUEUE", it load the data from
the field "env_data" into the environment var "QMAILQUEUE" and then
continues on with the original code in tcpserver...  like I said, simple -
now that it's done!  I'm just a C hack, so someone could probably improve on
this whole thing...  I.E. I'd rather have had it load whatever env. var was
in the field "env_var" rather that it being hardcoded to QMAILQUEUE...  not
a big deal though, it serves it's purpose.

To get started, you need to add a couple of fields to your VPOPMAIL's
"RELAY" table.  Mine now looks like this:

      Field name Type Allow nulls? Key Default value Extras
      ip_addr varchar(18) No Primary
      timestamp varchar(12) Yes None NULL
      env_var varchar(30) Yes None NULL
      env_data varchar(100) Yes None NULL


(Just in case this is going to get mangled by non-Micro$haft users, I'll do
a text only too...)

env_var    varchar(30)    nulls, yes    key,none    default value, null
env_data  varchar(100)  nulls,yes     key,none    default value, null


Once you've got the new fields in place in RELAY, add your server's IP's for
the domains that you want to do qmail-scanning on.  Mine look like this
now...

        ip_addr timestamp env_var env_data
     192.168.1.84 NULL QMAILQUEUE /var/qmail/bin/qmail-scanner-queue.pl


(non-MS users....   :)

ip_addr                timestamp            env_var
env-data
192.168.1.84        NULL                QMAILQUEUE
/var/qmail/bin/qmail-scanner-queue.pl

By not having a timestamp, I'm hoping that VPOPMAIL's roaming-users expire
code won't delete my servers!  I checked this over a 24 hour period, and
this data was still there so it looks ok.


Use webmin or whatever your favorite SQL client is...  if you know SQL
syntax, cool.  Do it manually.

BTW, this is perfectly safe to do on your working table...  mine's set right
now on a production server and it hasn't had any problems.


Next, apply my patches to an ALREADY PATCHED qmail and ucspi-tcp-88.  What I
mean by already patched is that both should already be running the mysql
patches by Matt Simerson.  My diff's were built after a patched and compiled
qmail and ucspi.  Here's the link to Matt's site for his toaster.  In the
instructions are the links for his patches.

http://matt.simerson.net/computing/qmail/qmail.toaster.shtml


Apply my patches (attached to this email) , re-compile, install, etc.  Then
modify your /service/qmail-smtpd/run script and remove that nasty QMAILQUEUE
env. setting!!!  :)  Delete all those extra instances of the run script for
each server IP you wanted scanned/not scanned!  You only need the one
tcpserver running now...

btw, the patch to qmail that I wrote is necessary because without it, when
tcpserver would NULLify the QMAILQUEUE env. var (I.E. when it got a connect
for a server it wasn't supposed to do scanning for..) qmail would try to run
a program called NULL and then crash.  Matt's original code (patch) didn't
check for QMAILQUEUE having a zero length... he just looked for the env. var
being present.  Mine now looks for zero length and skips it if so...   You
have to patch qmail or the whole thing will break!  You've been warned! ;)

I hope this was clear enough.  It's probably not for the faint of heart -
but, hey, if you're running mysql already, you've probably already been
through worse!  :)

Good luck! and enjoy!

Chris Bunnell
Senior Engineer - Network Implementation
Avantac Technologies, Inc. - Formerly Sonic Internet Services
9719 Lincoln Village Drive #503
Sacramento, CA. 95827
(916) 854-5940
www.avantac.com
Powered by Sun.  My other OS is your Linux box.

Attachment: ucspi-patch-chris
Description: Binary data

Attachment: qmail-patch-chris
Description: Binary data

Reply via email to