[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: qmail setup question



On Friday, March  4 at 08:31 PM, quoth Tim Traver:
> Are there any debug flags I can turn on to see how qmail is thinking 
> when it is processing a message ???

Heh - a resounding NO. Qmail is very stripped down, and there's *almost* 
not a single line of code in there that doesn't absolutely have to be. 
That makes it very clean and is responsible for qmail's famous 
invulnerability... but it also makes qmail hard to debug when it's not 
doing what you think you told it to do. The way I figured it out was 
dove into the source - you can tear it apart and put printf's all over 
the place, and run qmail from the command-line (./qmail-smtpd) and speak  
SMTP to it to figure out what it's up to (don't use your torn apart 
version to actually do the mail stuff---once you know what it's up to, 
start over with a fresh copy of the source).

If it helps to understand it, you may want to check out the BIG QMAIL 
PICTURE (http://www.nrg4u.com).

Now that I've said that, let's see what we can get from your 
descriptions...

> rcpthosts:
> localhost
> cmail.simplenet.com

So far so good (I'd probably get rid of localhost, though... no sense 
letting spammers send mail to anybod@localhost).

> virtualdomains:
> cmail.simplenet.com:cmail.simplenet.com

I think it may be useful here to revisit the qmail-send man page:
    virtualdomains
        List of virtual users or domains, one per line. A virtual user 
        has the form user@domain:prepend, without any extra spaces. When 
        qmail-send sees the recipient address user@domain, it converts 
        it to prepend-user@domain and treats it as a local

        A virtual domain has the form domain:prepend. It applies to any 
        recipient address at domain. For example, if

            nowhere.mil:joe-foo

        is in virtualdomains, and a message arrives for 
        info@xxxxxxxxxxx, qmail-send will rewrite the recipient address 
        as joe-foo-info@xxxxxxxxxxx and deliver the message locally.

So this says: when I (qmail) receive a mail to 
somebody@xxxxxxxxxxxxxxxxxxx, I will rewrite the destination address as 
cmail.simplenet.com-somebody@xxxxxxxxxxxxxxxxxxx

> locals:
> Messages for localhost are delivered locally.
> Messages for cmail.simplenet.com are delivered locally.

Here's your problem. Or at least, here's one problem. There's another 
critical piece to the qmail-send man page about virtualdomains:

    qmail-send handles virtualdomains after locals: if a domain is 
    listed in locals, virtualdomains does not apply.

OOPS! So, since you listed cmail.simplenet.com in locals, it ALWAYS 
treats it as a local domain, and user@xxxxxxxxxxxxxxxxxxx MUST be a real 
UNIX user.

But let's trace out the rest of the path here, just to make sure it's 
all clear. Assuming you remove cmail.simplenet.com from locals...

So, because of the virtualdomains entry, the message will be redirected 
to cmail.simplenet.com-somebody@xxxxxxxxxxxxxxxxxxxx Which means 
cmail.simplenet.com must be a real UNIX user OR it means you have to use 
the qmail-users feature to make a "pretend" user---which is what you did 
with ./users/assign - technically, you could also have 
/var/qmail/alias/.qmail-cmail:simplenet:com-somebody, but that's a pain 
because it removes all the cool extension stuff for all those users, and 
is more irritating (I feel) to maintain than a separate directory just 
for the virtual domain.

> /users/assign:
> +testdomain.com-:testdomain.com:100:100:/var/qmail/domains/testdomain.com:-::

I'm assuming you really mean:

+cmail.simplenet.com-:cmail.simplenet.com:100:100:/var/qmail/domains/cmail.simplenet.com:-::

Right?

Okay, so, this says that mail for cmail.simplenet.com (like the message 
we're directing above) should be delivered to user cmail.simplenet.com 
(ooo, fun circular logic), with uid 100 and gid 100, as specified in 
/var/qmail/domains/cmail.simplenet.com/.qmail. In other words, the mail 
we were talking about before, sent to somebody@xxxxxxxxxxxxxxxxxxx, 
which was then rewritten to be destined for 
cmail.simplenet.com-somebody@xxxxxxxxxxxxxxxxxxx will be delivered 
according to EITHER 
/var/qmail/domains/cmail.simplenet.com/.qmail-somebody OR 
/var/qmail/domains/cmail.simplenet.com/.qmail-default (because "default" 
is the wildcard extension for those extensions that don't have a more 
specific .qmail-ext file) with whatever real UNIX user on your system 
has the UID of 100.

So, from what I can see, you set up tim@xxxxxxxxxxxxxxxxxxx just fine 
(I'm not sure about the relative path stuff... I'm sufficiently a coward 
that I always put full paths in those .qmail files - I've never bothered 
to find out if relative paths will work) with the exception that you put 
cmail.simplenet.com into locals, even though the man page told you not 
to. ;)

Hope that helps,
~Kyle
-- 
Where justice is denied, where poverty is enforced, where ignorance
prevails, and where any one class is made to feel that society is an
organized conspiracy to oppress, rob and degrade them, neither persons nor
property will be safe.
-- Frederick Douglas

Attachment: signature.asc
Description: Digital signature