[vchkpw] Re: [SPAM] [suggestion] vdelivermail environment changes

2013-11-26 Thread Eric Shubert

On 08/21/2013 05:58 AM, Laurent Bercot wrote:

  Hello,

  I am installing vpopmail together with dovecot.
  Mail must be delivered to /home/vpopmail/domains/domain/user/Maildir,
not by vdelivermail itself, but by dovecot-lda (to keep index files updated,
among other things).
  So, I write a /home/vpopmail/domains/domain/user/.qmail file,
containing simply

  | preline -f dovecot-lda

  as the dovecot instructions say.

  But it does not work: mail gets delivered to
/home/vpopmail/domains/domain/Maildir - which is definitely not
what I want if I have more than one user. :)
  I have investigated and found the source of the problem: when
dovecot-lda is run, the virtual user's home directory, contained in
the HOME environment variable, is not
/home/vpopmail/domains/domain/user as it should be. It is still
/home/vpopmail/domains/domain, the value it has when vdelivermail
is executed.

  It makes sense to have HOME=/home/vpopmail/domains/domain when
executing vdelivermail, because that's the correct home for the
domain-user@domain virtual user from qmail-local's point of view.
However, when vdelivermail processes a dot-qmail file itself in
/home/vpopmail/domains/domain/user, it knows what the right
home for user@domain is, and should adjust HOME accordingly before
running other programs in the qmail-command fashion.

  I am currently modifying HOME myself before executing into
dovecot-lda, in the .qmail file, and it's working perfectly. However,
it would be cleaner if vdelivermail did this itself.

  It would also be a lot cleaner if vdelivermail hid the domain-user
thing under the rug: once qmail-send has been fooled and control has
been given to vdelivermail, the virtualdomains hack is not necessary
anymore, and is only confusing to software run in further .qmail files.
For instance, a qreceipt instruction in a
/home/vpopmail/domains/domain/user/.qmail file currently has to be:

| qreceipt $EXT@$HOST

But it really should be

| qreceipt $USER@$HOST

like with system users. Also, specific workarounds have to be enabled
to make ezmlm lists work under vpopmail; if vdelivermail was putting
the right environment variables back, ezmlm would work out of the box.

  Please consider this change - along with a new, vpopmail-specific
environment variable so vpopmail-aware applications still know that
the address is virtual and really handled by vpopmail.

  Developer bait: with this change, vdelivermail wouldn't have to perform
MDA duties itself anymore. If it found a user in the vpasswd
database, it could just hand the delivery to qmail-local. :)

  Thank you,



Anything further on this?

I'm going to be looking at integrating dovecot-lda in QmailToaster, and 
would consider making these changes. I need to examine the situation in 
more detail before committing to this though.


FWIW, I've already modified the vpopmail QMT package to:
.) build as a non-root user
.) create a vpopmail-devel package with includes and libs
.) put /include and /lib in their typical locations

FWIW2, I'm toying with the idea of making the vpopmail QMT package LSB 
compliant (which very few packages actually are).


Thanks.

--
-Eric 'shubes'


!DSPAM:5294c4e734262887015494!



Re: [vchkpw] Re: [SPAM] [suggestion] vdelivermail environment changes

2013-11-26 Thread Laurent Bercot

Anything further on this?


 Hello Eric,

 Since I didn't get any answer from vpopmail developers, I created my own
solution: a wrapper, vsanitize, which you use in command invocation in
.qmail file, i.e. instead of writing
| foobar args
you invoke
| vsanitize foobar args
and foobar will be called with the environment cleaned up from the
virtualdomains hack.
 Caveat: qmail-command lines are interpreted by /bin/sh, so be careful
with environment variables:
| qreceipt $EXT@HOST
should be rewritten as
| exec vsanitize sh -c 'exec qreceipt $USER@$HOST'
(of course, it's easier to use import from the execline package).

 Software that automatically creates .qmail files, like qconfirm, has to
be configured to prefix qmail-command invocations with vsanitize. Most
.qmail-aware software has options for this.

 Source: http://skarnet.org/software/vsanitize.c
 It depends on skalibs: http://skarnet.org/software/skalibs/
 Compile with: gcc -O2 -o vsanitize -Iyour skalibs include dir -L your skalibs 
library dir vsanitize.c -lstddjb

 Enjoy.



FWIW2, I'm toying with the idea of making the vpopmail QMT package LSB 
compliant (which very few packages actually are).


 LSB is a very poor standard. Don't waste your time.

--
 Laurent


!DSPAM:5294e91934268516851760!