Mailing List Archive

qmail-lspawn/users assign based on domain name
I seem to recall seeing a patch years back that modified the users/cdb
mechanism used by qmail-lspawn to allow for assigning addresses to users
based on the host portion of the email address rather than only the
username. Did such a thing ever exist?

Thanks.

--
Bruce Guenter <bruce@untroubled.org> https://untroubled.org/
Re: qmail-lspawn/users assign based on domain name [ In reply to ]
Hi Bruce,

I checked my qmail archives ... and was not able to find a single patch
modifying qmail-lspawn.c and/or qmail-newu.c - except for Andre
Oppermann's LDAP patch. Not even my s/qmail.

Am Dienstag, dem 08.03.2022 um 08:36 -0600 schrieb Bruce Guenter:
> I seem to recall seeing a patch years back that modified the
> users/cdb
> mechanism used by qmail-lspawn to allow for assigning addresses to
> users
> based on the host portion of the email address rather than only the
> username. Did such a thing ever exist?
>

Hm. After looking into the sources, I don't think it is real difficult
to enhance Dan's codebase here. I would use a new triggering token in
qmail-newu.c (lets say a '@') to identify this particular usage.

But: What is your background/use case to require this behavior?

Best regards.
--eh.


PS: Still using vmailmgr here ....


> Thanks.
>

--
Dr. Erwin Hoffmann | www.fehcom.de
PGP key-id: 20FD6E671A94DC1E
PGP key-fingerprint: 8C6B 155B 0FDA 64F1 BCCE A6B9 20FD 6E67 1A94 DC1E
Re: qmail-lspawn/users assign based on domain name [ In reply to ]
On Tue, Mar 08, 2022 at 04:36:46PM +0100, Erwin Hoffmann wrote:
>I checked my qmail archives ... and was not able to find a single patch
>modifying qmail-lspawn.c and/or qmail-newu.c - except for Andre
>Oppermann's LDAP patch. Not even my s/qmail.

I guess my memory is more faulty than my web search skills, which is not
at all surprising. Thanks for looking.

>Hm. After looking into the sources, I don't think it is real difficult
>to enhance Dan's codebase here. I would use a new triggering token in
>qmail-newu.c (lets say a '@') to identify this particular usage.

That's about what I was thinking, too. I'm thinking it would be best to
use a different prefix than "!" in the CDB as well just to fully
disambiguate the two, but that's probably just extra work.

>But: What is your background/use case to require this behavior?

Mostly just annoyance at this point. I've long been unhappy with the
system username prefix showing up in headers (ie "Delivered-To") with
the standard virtualdomain mechanism. I was contemplating a
reorganization of my local qmail server and wondered if such a mechanism
was available.

Obsessed by irrelevant details...

--
Bruce Guenter <bruce@untroubled.org> https://untroubled.org/
Re: qmail-lspawn/users assign based on domain name [ In reply to ]
On Tue, 8 Mar 2022 at 20:08, Bruce Guenter <bruce@untroubled.org> wrote:
>
> I seem to recall seeing a patch years back that modified the users/cdb
> mechanism used by qmail-lspawn to allow for assigning addresses to users
> based on the host portion of the email address rather than only the
> username. Did such a thing ever exist?

I had this long time back as a patch. Now it is tightly integrated and
I doubt it can be used in a generic way. IIRC before 2012. It modified
qmail-lspawn to allow assigning addresses to users based on the host
on which the user's mailbox was present. This was done to achieve
horizontal scalability by allowing the same domain to exist on
multiple servers for a single domain Each server had it's own set
disks. When an email is received, qmail-lspawn checks against a MySQL
lookup table to figure out which server the email needs to be
redirected to, using qmail-remote (even though the domain is in
control/virtualdomains). This was just a scheme to distribute disk IO
across multiple servers. Access to the mailbox was through a imap
proxy which used the same MySQL database that qmail used.

https://github.com/mbhangui/indimail-mta/blob/master/indimail-mta-x/qmail-lspawn.c

>
>
Re: qmail-lspawn/users assign based on domain name [ In reply to ]
Hi, once more ...

I guess, a simple patch to qmail-local.c would do the same job:

517 if (!env_put("USER",user)) temp_nomem();
518 if (!env_put("LOCAL",local)) temp_nomem();
519
520 if (str_len(dash) > 2) {
521 i = str_chr(local,'-');
522 if (!stralloc_copys(&envrecip,local+i+1)) temp_nomem();
523 } else
524 if (!stralloc_copys(&envrecip,local)) temp_nomem()

Here, the line numbers refer to my version of qmail-local.c.

Of course, this patch requires the VERP character to be '-'.

Regards.
--eh.


Am Dienstag, dem 08.03.2022 um 10:09 -0600 schrieb Bruce Guenter:
> On Tue, Mar 08, 2022 at 04:36:46PM +0100, Erwin Hoffmann wrote:
> > I checked my qmail archives ... and was not able to find a single
> > patch
> > modifying qmail-lspawn.c and/or qmail-newu.c - except for Andre
> > Oppermann's LDAP patch. Not even my s/qmail.
>
> I guess my memory is more faulty than my web search skills, which is
> not
> at all surprising. Thanks for looking.
>
> > Hm. After looking into the sources, I don't think it is real
> > difficult
> > to enhance Dan's codebase here. I would use a new triggering token
> > in
> > qmail-newu.c (lets say a '@') to identify this particular usage.
>
> That's about what I was thinking, too. I'm thinking it would be best
> to
> use a different prefix than "!" in the CDB as well just to fully
> disambiguate the two, but that's probably just extra work.
>
> > But: What is your background/use case to require this behavior?
>
> Mostly just annoyance at this point. I've long been unhappy with the
> system username prefix showing up in headers (ie "Delivered-To") with
> the standard virtualdomain mechanism. I was contemplating a
> reorganization of my local qmail server and wondered if such a
> mechanism
> was available.
>
> Obsessed by irrelevant details...
>

--
Dr. Erwin Hoffmann | www.fehcom.de
PGP key-id: 20FD6E671A94DC1E
PGP key-fingerprint: 8C6B 155B 0FDA 64F1 BCCE A6B9 20FD 6E67 1A94 DC1E
Re: qmail-lspawn/users assign based on domain name [ In reply to ]
It appears that Bruce Guenter <bruce@untroubled.org> said:
>Mostly just annoyance at this point. I've long been unhappy with the
>system username prefix showing up in headers (ie "Delivered-To") with
>the standard virtualdomain mechanism. I was contemplating a
>reorganization of my local qmail server and wondered if such a mechanism
>was available.

Since Delivered-To is just for loop breaking, how about hashing the address
and put that in the header instead. It'd be about a three line change
to qmail-local.

I don't remember the prefixed address being put into headers anywhere else.

R's,
John
Re: qmail-lspawn/users assign based on domain name [ In reply to ]
Hi John,

I removed the virtual userid within the 'Delivered-To:' line in s/qmail
4.1.16 (within qmail-local) and get complains from users having
vpopmail in place: vdeliver uses this information. If this is missing,
the 'mail is looping' accordingly to the vdeliver logs.

However, what I've seen and analysed regarding VMailMgr from Bruce,
this is not a problem (in particular not here, I'm using it). 

In conclusion: For the vpopmail users, this should be a configurable
option. For all others, this is not a concern.

As an advice for mailing list managers: It is a good idea to filter the
'Delivered-To:' line out prior of resending or archiving the mail.

Regards.
--eh.



Am Dienstag, dem 08.03.2022 um 12:36 -0500 schrieb John Levine:
> It appears that Bruce Guenter  <bruce@untroubled.org> said:
> > Mostly just annoyance at this point. I've long been unhappy with
> > the
> > system username prefix showing up in headers (ie "Delivered-To")
> > with
> > the standard virtualdomain mechanism. I was contemplating a
> > reorganization of my local qmail server and wondered if such a
> > mechanism
> > was available.
>
> Since Delivered-To is just for loop breaking, how about hashing the
> address
> and put that in the header instead.  It'd be about a three line
> change
> to qmail-local.
>
> I don't remember the prefixed address being put into headers anywhere
> else.
>
> R's,
> John

--
Dr. Erwin Hoffmann | www.fehcom.de
PGP key-id: 20FD6E671A94DC1E
PGP key-fingerprint: 8C6B 155B 0FDA 64F1 BCCE A6B9 20FD 6E67 1A94 DC1E