Mailing List Archive

qmail API ? (Re: virtualuser@domain.com -> ?)
On 1997-02-06T03:29:11,
nelson@crynwr.com (Russell Nelson) said:

> if grep '^hax0r\.org$' /var/qmail/control/local; then
> echo '&bill@intervista.net' >~bill/.qmail
> fi
>
> if grep '^hax0r\.org:alias-hax0r$' /var/qmail/control/virtualdomains; then
> echo '&bill@intervista.net' >~alias/.qmail-hax0r-bill
> fi
>
> # I don't recommend using anything but a user name on the RHS in virtualdomains
> if grep '^hax0r\.org:hax0r$' /var/qmail/control/virtualdomains; then
> echo '&bill@intervista.net' >~alias/.qmail-hax0r-bill
> fi

All those hacks you have got to do for stuff which sendmail can do easily
make me question whether qmail is a drop in replacement for sendmail in
tricky mail setups. And the tons lookups done on all those alias files in
those setups make me question the speed too.

Remember the thread where one user wanted to extract additional information
from a mail? Remember the solution? If memory serves, it had something to do
with spawning a child, piping the message into it etc? The qmail /etc/alias
emulation, which involves spawning a program for each mail too?

I don't want to question qmail (it still has too many advantages to run it
instead of sendmail) but perhaps qmail needs are more general interface for
address/mail rewriting? A program which would be spawned by qmail-send at
qmail startup time and would be running for the entire qmail session? Much
like the squid redirector or the Apache mod_rewrite facility...

This would make extending qmail in a safe, high-performance way easier.

What do you think?

--
Lars Marowsky-Bree Voice: +49-571-63663 PGP-key avail. via server
HomePage: http://www.teuto.de/~lmb/ Mail: lmb@pointer.teuto.de
PGP-Id: 0x09E360C5 / FF 2A 82 E8 6B 85 79 23 9C DA B5 81 D4 FC 29 E6
< to prevent forgery, all email by me is signed with PGP >
qmail API ? (Re: virtualuser@domain.com -> ?) [ In reply to ]
Lars Marowsky-Bree writes:

> I don't want to question qmail (it still has too many advantages to run it
> instead of sendmail) but perhaps qmail needs are more general interface for
> address/mail rewriting?

qmail HAS a perfectly general interface. It's called access to the
shell. It sounds to me like you want a *less* general interface. If
you want to write one, I'd be happy to put a pointer to it on
www.qmail.org.

--
-russ <nelson@crynwr.com> http://www.crynwr.com/~nelson
Crynwr Software sells network driver support | PGP ok
521 Pleasant Valley Rd. | +1 315 268 1925 voice | Peace, Justice, Freedom:
Potsdam, NY 13676-3213 | +1 315 268 9201 FAX | pick two (only mostly true)
Re: qmail API ? (Re: virtualuser@domain.com -> ?) [ In reply to ]
> All those hacks you have got to do for stuff which sendmail can do easily

I think you've misunderstood. The original question didn't provide
complete information about the qmail setup; in particular, we weren't
told whether the domain in question was handled as a local or a
virtualdomain. Russ provided solutions for both possibilities.

Under sendmail, it's certainly easy if the domain is handled as local.
But sendmail doesn't have standard support for virtualdomains; to begin
debugging this problem you'd need to start with a complete copy of
sendmail.cf, and the bat book under your arm...

> And the tons lookups done on all those alias files in
> those setups make me question the speed too.

Have you measured it? Or are you just guessing? You can stat() about
10 files in the time it takes to open a Berkeley DB file and look up a
single value.

> Remember the thread where one user wanted to extract additional information
> from a mail?

OK, let's say I want to keep a copy of the header of every message
passing through a system. How do I do it with sendmail?

Tim.
Re: qmail API ? (Re: virtualuser@domain.com -> ?) [ In reply to ]
Lars Marowsky-Bree:
> All those hacks you have got to do for stuff which sendmail can do easily
> make me question whether qmail is a drop in replacement for sendmail in
> tricky mail setups. And the tons lookups done on all those alias files in
> those setups make me question the speed too.

Why do you use "drop in replacement" in the same sentence as "sendmail
in tricky mail setups"?

> I don't want to question qmail (it still has too many advantages to
> run it instead of sendmail) but perhaps qmail needs are more general
> interface for address/mail rewriting? A program which would be
> spawned by qmail-send at qmail startup time and would be running for
> the entire qmail session? Much like the squid redirector or the
> Apache mod_rewrite facility...

Well, the rules that sendmail implements result in security holes,
lost mail and performance problems. I'm not sure that there's a much
real demand for these features. [.I recognize that there is some
inertia in moving away from these features, but that's a different
issue.]

Don't get me wrong, there are some real configuration management
issues here. You can't solve these sorts of problems by ignoring
them.

--
Raul
Re: qmail API ? (Re: virtualuser@domain.com -> ?) [ In reply to ]
On 1997-02-06T13:51:52,
tim@uunet.pipex.com (Tim Goodwin) said:

> Have you measured it? Or are you just guessing? You can stat() about
> 10 files in the time it takes to open a Berkeley DB file and look up a
> single value.

Indeed, I am just guessing. But compare:

The time needed to stat a file grows linear with the number of files per
directory. (Under almost all filesystems)

The time needed to do a DB lookup on an already opened dbm file from a
concurrent process grows with ln(N)/ln(2).

So, with lets say 1000 aliases, which one do you guess will be faster?

> > Remember the thread where one user wanted to extract additional information
> > from a mail?
> OK, let's say I want to keep a copy of the header of every message
> passing through a system. How do I do it with sendmail?

OH GODDAMN. Everytime one dares to mention that there is a situation which
might be handled easier by sendmail or anything else, or even proposes what
he thinks is a useful suggestion, this list usually has nothing better to do
than to gang up and bash him until he leaves. Can we please stop this?
Thanks.

I didn't say that sendmail is superior in every situation, and in fact I
don't care how you do it with the sendmail. The question is: How do you do
it with qmail? In an efficient way?

I am _NOT_ questioning qmail. I was just proposing to add something like the
squids redirector system to qmail. You could extract all kinds of nifty
information with it, or use it as a high-performance procmail replacement (I
can tell you that forking procmail for each mail my system gets IS a
performance hit).

Perhaps the examples I gave in my first mail were less than optimal. Ok.
Forget about them. Just look at the general idea. qmail itself would stay
small and clean, while people needing this stuff had an easy, high
performance way of plugging it in.

--
Lars Marowsky-Bree Voice: +49-571-63663 PGP-key avail. via server
HomePage: http://www.teuto.de/~lmb/ Mail: lmb@pointer.teuto.de
PGP-Id: 0x09E360C5 / FF 2A 82 E8 6B 85 79 23 9C DA B5 81 D4 FC 29 E6
< to prevent forgery, all email by me is signed with PGP >
Re: qmail API ? (Re: virtualuser@domain.com -> ?) [ In reply to ]
>>>>> "Lars" == Lars Marowsky-Bree <lmb@pointer.teuto.de> writes:
Lars> So, with lets say 1000 aliases, which one do you guess will be
Lars> faster?

qmsmac.

--
paul
pjg(at)acsu.Buffalo.EDU |public keys at:
| http://urth.acsu.Buffalo.EDU/~pjg/key.html
if the above contains opinions they are mine unless marked otherwise.
Re: qmail API ? (Re: virtualuser@domain.com -> ?) [ In reply to ]
> The time needed to stat a file grows linear with the number of files per
> directory. (Under almost all filesystems)

So don't put them all in one directory.

On one of our systems here, we have 924 .qmail files. They're
distributed across 36 directories; where you'd normally have .qmail-foo,
we have .qmail-f/foo. (This scheme doesn't give a particularly even
spread---our .qmail-s directory has almost 100 files in it---but it's
simple, and adequate for this scale of problem.)

> So, with lets say 1000 aliases, which one do you guess will be faster?

I didn't guess; I tried it. I put the target file at the *end* of a
directory containing 1000 other files. I created a hash DB containing
1000 entries. The stat completes in about 70% of the time needed for
the DB lookup.

In any case, this is a silly point to argue about. The time taken
for alias lookup, using either the sendmail or the qmail methods, is
completely swamped by things like synchronous disk writes, and DNS
lookups.

> OH GODDAMN. Everytime one dares to mention that there is a situation which
> might be handled easier by sendmail or anything else, or even proposes what
> he thinks is a useful suggestion, this list usually has nothing better to do
> than to gang up and bash him until he leaves. Can we please stop this?
> Thanks.

Sorry; I thought I was on Usenet :-).

(Actually, this discussion is very reminiscent of one that took place
recently on comp.security.unix. In both cases, someone has learnt that
qmail does <x> in such and such a fashion, and they say "but that's so
inefficient! qmail must be slower than molasses". In both cases, they
didn't actually stop to measure it.)

> I didn't say that sendmail is superior in every situation, and in fact I
> don't care how you do it with the sendmail. The question is: How do you do
> it with qmail? In an efficient way?

I'd do it like it says in the FAQ. Yes, this involves a tiny program
fork()ing, and exec()ing another tiny program. In my experience, Unix
systems can do this very efficiently. (As Rob Pike once said, "perhaps
if people had understood fork() better we wouldn't have threads". :-)

And the qmail mechanism is utterly general. I can do *anything* to a
message that I can write a program to do, and I can write that program
in any language I choose. If that language is bulky and inefficient,
I'll lose, but this isn't a deficiency of qmail.

Tim.