# qmail-scanner eats my mail!

## mr-simon

Hi,

I've got a nicely working qmail + qmail-auth patch + vpopmail + courier-imap + squirrelmail system ....

I also have sophos sweep and spamassassin installed.

I then did an emerge qmail-scanner... A bunch of stuff got put on... I removed f-prot (no use in wasting resources on 2 scanners, and I prefer sophos) and re-emerged qmail-scanner specifying --nodeps (to re-create the .pl file and not put f-prot back.)

Now... When I added:

```
:allow,QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl"
```

to my /etc/tcp.smtp file, it starts silently eating all incoming mail. No bounce messages, no mail going into mailboxes... Hum...

I checked qmail-smtpd log and it was saying:

```
@400000003e1d6ef615c5e7ec X-Qmail-Scanner-1.14:[dev.symdata.com104211633242321960] cannot write to /var/spool/qmailscan/working/tmp/dev.symdata.com104211633242321960 - No such file or directory
```

There was no /var/spool/qmailscan/working directory (looks like it should be a maildir) so I created it, plus new, cur, and tmp subfolders and chown qmailq:qmail (0770)'d the whole lot.

Now, all incoming mail seems to just vanish. No errors reported as far as I can tell in any of the logs.

qmail-smtpd reports a successful connection

qmail-scanner.log reports:

```
9/01/2003 13:07:10:23247: +++ starting debugging for process 23247 by uid=89 at

 09/01/2003 13:07:10                                                            09/01/2003 13:07:10:23247: setting UID to EUID so subprocesses can access files

generated by this script                                                        09/01/2003 13:07:10:23247: program name is qmail-scanner-queue.pl, version 1.14

09/01/2003 13:07:10:23247: incoming SMTP connection from via smtp from 216.33.237.166

09/01/2003 13:07:10:23247: w_c: mkdir /var/spool/qmailscan/dev.symdata.com104211763042323247

09/01/2003 13:07:10:23247: w_c: start dumping incoming msg into /var/spool/qmailscan/working/tmp/dev.symdata.com104211763042323247 [1042117630.67293]

09/01/2003 13:07:10:23247: w_c: rename new msg from /var/spool/qmailscan/working/tmp/dev.symdata.com104211763042323247 to /var/spool/qmailscan/working/new/dev.symdata.com104211763042323247 [1042117630.67427]

09/01/2003 13:07:10:23247: d_m: starting /usr/bin/reformime  -x/var/spool/qmailscan/dev.symdata.com104211763042323247/ </var/spool/qmailscan/working/new/dev.symdata.com104211763042323247 [1042117630.6746]

09/01/2003 13:07:10:23247: d_m: finished /usr/bin/reformime  -x/var/spool/qmailscan/dev.symdata.com104211763042323247/ [1042117630.69325]

09/01/2003 13:07:10:23247: d_m: Checking all attachments to see if they're MS-TNEF

09/01/2003 13:07:10:23247: d_m: is /var/spool/qmailscan/dev.symdata.com104211763042323247/1042117630.23249-0.dev.symdata.com is a TNEF file?: 256 [1042117630.69703]

09/01/2003 13:07:10:23247: d_m: Manually unpack any zip files as some virus scanners don't do zip under Unix!

09/01/2003 13:07:10:23247: d_m: unpacking message took 0.023069 seconds

09/01/2003 13:07:10:23247: unsetting QMAILQUEUE env var

09/01/2003 13:07:10:23247: g_e_h: no sender and no recips.

09/01/2003 13:07:10:23247: cleanup: /bin/rm -rf /var/spool/qmailscan/dev.symdata.com104211763042323247/ /var/spool/qmailscan/working/new/dev.symdata.com104211763042323247
```

Nothing ever seems to get as far as the qmail-send logfile. No mail shows up...

Now... It does appear that the 09/01/2003 13:07:10:23247: g_e_h: no sender and no recips. line has something to do with it... As that happens right before a rm -rf all_the_temp_files... 

Assuming the above means that "nothing actually happened because the sender and recip info have mysteriously gone AWOL" and then the temp file got deleted because the script assumed something successful happened... That would explain _when_ the mail ended up in the bitbucket...

Sooo... Hmm... Suggestions? Where is that g_e_h: no sender and no recips coming from... How do I stop it so my mail stays intact? - Could something be turning into garbage en route through the system? Or perhaps whatever is spewing that message can't read the file (permissions problem?) or... ? or... ? 

help!  :Question:   :Question: 

----------

## blowgothi

I have the same problem here... did you find a solution? I wrote to the qmail-scanner mailing list, but I'm still waiting for an answer.

----------

## mr-simon

Alas not yet... This is really causing some problems for me. I posted a message there too... 

I did find something suggesting it might be perl-related... Click here for details... I tried downgrading perl to perl 5.6.something, but it didn't help. I'm going to try zapping my agressive and optimized compiler flags and tell it I'm a bog standard i386-linux and see what happens there.

I really hope I can get this sorted ASAP as I really don't want to rebuild the whole mailserv again based around sendmail or something... But that's going to be my only option soon...

----------

## mr-simon

Further research:

I realised that when I downgraded my perl installation, something broke... When I tried to re-emerge qmail-scanner it didn't actually create the nessecary .pl file. It was moaning about a lack of Time::HiRes. Seems I didn't downgrade perl properly... Perhaps something to do with libperl, whcih I couldn't downgrade?? I'm not too sure.

So, I re-compiled Perl 5.8.0 with host=i386-linux, and very limited cflags... (Threads have always been off anyway) - No luck there. Still same problems as before.

So... I guess I can try harder to downgrade perl...  I'm still wondering if it could be to do with permissions though... It wasn't able to create the 'working' maildir again, I had to do it manually. Could that show that the permissions on the directory are wrong?

----------

## mr-simon

SOLVED  :Very Happy: 

Okay, the lastest version of qmail-scanner supports the latest version of Perl properly. I fixed perl on my box and made sure it was the latest version, then downloaded qmail-scanner 1.15 from here. 

Then, I ran ./configure and overwrote my existing (1.14) qmail-scanner-queue.pl with the newly-generated one, et voila. My box's insatiable appetite for email has been cured and we've got it back on the green leafy vegetables intead.

All works fine now. Hooray!

----------

## blowgothi

Thanks for posting the solution!   :Very Happy: 

----------

