FIX! toaster-watcher: FAILURE: Couldn't find QS section

Started by LogicX, March 24, 2004, 09:05:58 AM

Previous topic - Next topic

LogicX

so, I was one among many who were getting this repeated error:
FAILURE: Couldn't find QS section in /usr/vpopmail/etc/tcp.smtp.cdb
You need to add the following lines as documented in the toaster-watcher.conf and FAQ:

### BEGIN QMAIL SCANNER VIRUS ENTRIES ###
### END QMAIL SCANNER VIRUS ENTRIES ###

each time that cron ran toaster-watcher.pl

I tried lots of stuff, yadda yadda...

Here's the solution.
toaster-watcher.conf -- I didn't realize vpopmail_home_dir was a variable
(Matt -- please put a comment on the end of the following lines telling us NOT to change vpopmail_home_dir)
smtpd_checkpasswd_bin           = vpopmail_home_dir/bin/vchkpw
smtpd_relay_database            = vpopmail_home_dir/etc/tcp.smtp.cdb
pop3_checkpasswd_bin           = vpopmail_home_dir/bin/vchkpw
submit_checkpasswd_bin         = vpopmail_home_dir/bin/vchkpw
submit_relay_database          = vpopmail_home_dir/etc/tcp.smtp.cdb

-- set all those lines back to vpopmail_home_dir at the beginning, as the Qmail.pm section that toaster-watcher.pl uses -- does a literal check for ^vpopmail_home_dir at the beginning of some of those lines, and if not there, it fails -- I'm sure this affects other code too, but I was just happy enough to get that working, and didn't look into it further.


I hope this helps the few others of you who have been having problems with the toaster-watcher

-Mike
Internet Marketing Center of Canada System Administrator
--- May this post be indexed by spiders, and archived for all to see as my internet epitaph.
http://fpux.com" target="_blank">http://fpux.com

matt

Before we go jumping to conclusions, lets not rule out an id-10-t error.

Those values can use a variable (vpopmail_home_dir) and if they begin with that prefix, then the script will automatically insert the value of that setting from your toaster-watcher.conf file. Pretty obvious right?

The other option, assuming that you don't use the shortcut is placing the entire path to the relevant files in there. This is, apparently what you attempted. However, read the error message you got again. And again, and again. Until you notice that the path is incomplete, and thus the source of your error.

Matt

LogicX

right, the substitution is all good, but I didn't realize that it HAD to have that in there...
I don't see how it would still pass your script, since the code is looking for a literal 'vpopmail_home_dir'

if by the path you mean:
ls -ld /usr/vpopmail/etc/
drwxr-xr-x  2 root  vchkpw  512 Mar 24 11:19 /usr/vpopmail/etc/

I think thats valid (I just happen to have a different directory structure than what you assumed.

If there's an easier or better way, please do help me -- but as it stands, I've got nothin'.
--- May this post be indexed by spiders, and archived for all to see as my internet epitaph.
http://fpux.com" target="_blank">http://fpux.com

matt

You are mistaken, as it doesn't assume any directory structure. It only assumes that you will configure your toaster-watcher.conf file correctly.

The code is not looking for the vpopmail_home_dir.  What it's expecting is the fully qualified path to those programs/files. For example:

smtpd_relay_database = vpopmail_home_dir/etc/tcp.smtp.cdb

That's the default setting. Here are a few typical settings that should all work:

  /usr/local/vpopmail/etc/tcp.smtp.cdb
  /usr/home/vpopmail/etc/tcp.smtp.cdb
  /etc/tcp.smtp.cdb
 
In addition, as a shortcut, this will also work:

  vpopmail_home_dir/etc/tcp.smtp.cdb

It substitues the value of vpopmail_home_dir for whatever (not surprisingly) you set vpopmail_home_dir to.

The lines of code you are mentioning are as follows:

if ( $cdb =~ /^vpopmail_home_dir\/(.*)$/ ) { $cdb = "$vdir/$1" };

That line of code says literally:

  If the value starts with vpopmail_home_dir, then replace the vpopmail_home_dir with $vdir (which is a variable representing that value, as defined in your .conf file).

If the line doesn't start with vpopmail_home_dir, then it does nothing.  In such a case, if you put a wrong path in toaster-watcher.conf, you'll get an error.

Now, the reason you had a problem was an id10t error. However, the error was mine. The code is supposed to work as you'd expect, and almost does. However, the parsing code needs to strip the .cdb off the end of that value so that it's reading the tcp.smtp file. It does that automatically in the shortcut regexp. I just didn't add the code to do it for complete path names.

So, we alter the code to strip the .cdb off the end like this (the else statement):

   if ( $relay =~ /^vpopmail_home_dir\/(.*)\.cdb$/ ) {
       $relay = "$vpdir/$1"
   } else {
       if ( $relay =~ /^(.*)\.cdb$/ ) { $relay = $1; };
   };

And now it works like  you'd expect.

Matt

LogicX

yeah!

thanks for the clarification and code fix Matt.  Its all starting to make sense now.

I've been using your toaster setup for a really long time, and only now do I feel as though I'm finally starting to comprehend and be able to deal with some of its complexities, and issues that arise from all the different components.


Next I need to figure out why it is that qmail-scanner updates tcp.smtp, but nothing compiled it into the cdb on a regular basis:
-rw-r--r--  1 vpopmail  vchkpw  33414 Mar 25 13:45 tcp.smtp
-rw-r--r--  1 vpopmail  vchkpw  32874 Mar 24 23:56 tcp.smtp.bak
-rw-r--r--  1 vpopmail  vchkpw  39753 Mar 24 23:56 tcp.smtp.cdb
-rw-r--r--  1 vpopmail  vchkpw   1107 Mar 24 00:49 vlimits.default
-rw-r-----  1 vpopmail  vchkpw     78 Mar 24 00:48 vpopmail.mysql
root:empire|1:47:44pm|~vpopmail/etc: date
Thu Mar 25 13:47:46 EST 2004

and why even if I do it manually, it seems as though mail isn't blocked. (still need to get a more accurate answer on that one)

despite:
root:empire|1:50:10pm|~vpopmail/etc: grep -i tcp /etc/toaster-watcher.conf
vpopmail_rebuild_tcpserver_file = 1
filtering_qmailscanner_method  = smtp   # smtp | tcpserver
smtpd_lookup_tcpremotehost      = 0
smtpd_lookup_tcpremoteinfo      = 0
smtpd_relay_database            = vpopmail_home_dir/etc/tcp.smtp.cdb
                                      # your ~vpopmail/etc/tcp.smtp file. See the FAQ for details
pop3_lookup_tcpremotehost      = 0
pop3_lookup_tcpremoteinfo      = 0
submit_lookup_tcpremotehost    = 0
submit_lookup_tcpremoteinfo    = 0
submit_relay_database          = vpopmail_home_dir/etc/tcp.smtp.cdb
qs_block_virus_senders         = 1  # add virus senders IP to tcp.smtp
                              # tcp.smtp file exactly as shown in order for blocking
                              # tcp.smtp file.

I'm clearly no expert, and I haven't invested enough man-hours yet to read all the code and try to figure out whats happening. --
I wish it was all done in mysql instead of through tcp.smtp with qmail-scanner

Thanks again Matt Smile
keep up the good work.
--- May this post be indexed by spiders, and archived for all to see as my internet epitaph.
http://fpux.com" target="_blank">http://fpux.com