Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Virtual users and .forward files

27 views
Skip to first unread message

Pavel Georgiev

unread,
Jan 30, 2008, 10:58:43 AM1/30/08
to
Hi list,

I have postfix and virtual domains, how do I add a .forward file for a
specific virtual user?

I have

virtual_mailbox_base = /srv/mail

in main.cf. I tried creating a .forward file in /srv/mail/domain/user/ (where
mail is delivered) and also /srv/mail/.forward+user@domain but it did not
work.

postconf -d|grep forward_path
forward_path = $home/.forward${recipient_delimiter}${extension},
$home/.forward

Noel Jones

unread,
Jan 30, 2008, 11:21:59 AM1/30/08
to

.forward processing is implemented in the local(8) delivery
agent, so that won't work with virtual mailbox users.

Instead add an entry for the user in virtual_alias_maps.

--
Noel Jones

Pavel Georgiev

unread,
Jan 30, 2008, 3:48:32 PM1/30/08
to
On Wednesday 30 January 2008 22:09:34 Pavel Georgiev wrote:
> On Wednesday 30 January 2008 21:55:47 mouss wrote:
> > Pavel Georgiev wrote:
> > > On Wednesday 30 January 2008 18:55:48 Noel Jones wrote:
> > >> Pavel Georgiev wrote:
> > >>> On Wednesday 30 January 2008 18:21:59 Noel Jones wrote:
> > >>>> .forward processing is implemented in the local(8) delivery
> > >>>> agent, so that won't work with virtual mailbox users.
> > >>>>
> > >>>> Instead add an entry for the user in virtual_alias_maps.
> > >>>
> > >>> I use sql lookups for my virtual domains:
> > >>>
> > >>>
> > >>> virtual_alias_maps =
> > >>> mysql:/etc/postfix/mysql_virtual_alias_maps.cf,
> > >>>
> > >>>
> > >>> /etc/postfix/mysql_virtual_alias_maps.cf:
> > >>> ....
> > >>> query = SELECT goto FROM alias WHERE address='%s' and active = 1
> > >>>
> > >>>
> > >>> My goal is to be able to run maildrop for a specific user, I tried
> > >>> updating the `alias` table and setting goto to '| /path/to/maildrop '
> > >>> but postfix complains with:
> > >>>
> > >>> unknown user: "'|/usr/bin/maildrop.mailfilter"
> > >>
> > >> Ah. In that case, add an entry to transport_maps for that user.
> > >
> > > OK, I tried :
> > > user@domain '| /usr/bin/maildrop
> > > /srv/mail/user/domain/.mailfilter - '
> > >
> > >
> > > but i get:
> > >
> > > warning: connect to
> > > transport '| /usr/bin/maildrop /srv/mail/domain/user/.mailfilter - ':
> > > No such file or directory
> > >
> > > So, how to add a command as a transport?
> >
> > check MAILDROP README. the transport entry should look like this:
> >
> > user@domain maildrop:
> >
> >
> > where maildrop is a transport defined in master.cf.
>
> Thanks, I already figured that part, but MAILDROP README does not mention
> how to make maildrop to work with virtual users. With teh default
> configuration of master.cf it is called as maildrop -d user@domain and that
> does not work. How to specify the transport in master.cf so that it works
> for virtual users.
>
> From what I read in `man pipe` there is no macro for the recipient domain
> so I cannot run /usr/bin/maildrop
> /srv/mail/domain/${recipient}/.mailfilter in mastre.cf.

OK, does not look like the best solution, but adding a new transport in
master.cf with hardcoded path the mailbox did the job. Anyone has a better
idea how to make maildrop without hardcoding the path to the mailbox?

Pavel Georgiev

unread,
Jan 30, 2008, 4:44:48 PM1/30/08
to
On Wednesday 30 January 2008 23:02:34 mouss wrote:
> Pavel Georgiev wrote:
> > Thanks, I already figured that part, but MAILDROP README does not mention
> > how to make maildrop to work with virtual users. With teh default
> > configuration of master.cf it is called as maildrop -d user@domain and
> > that does not work.
>
> to work, it needs a green card ;-p
>
> maildrop does work with virtual users, but there are so many different
> virtual setups. If you just say "it doesn't work", we can't help. if you
> explain your problem, you may get help.
>
> Note that if your maildrop is built with authlib support, it will try to
> ask authdaemon... etc.

>
> > How to specify the transport in master.cf so that it works for virtual
> > users.
> >
> > From what I read in `man pipe` there is no macro for the recipient domain
> > so I cannot run /usr/bin/maildrop
> > /srv/mail/domain/${recipient}/.mailfilter in mastre.cf.
>
> $(domain} is available in postfix 2.5, but you can use ${nexthop}. The
> second example in the MAILDROP README uses
>
> -d ${user}@${nexthop}
>
> did you miss it?

OK, here are few details about the setup, let me know if you need more info:
Distro: Ubuntu 6.06 TLS
postfix 2.2.10, maildrop 1.5.3, libsasl2 2.1.19 from standart ubuntu packages
postfix is configured with virtual users, lookups are made in mysql.

In the standart configuration, maildrop transport is defined as `maildrop -d
${recipeint}`, which doen not work (out of the box) with virtual users.
$nexthop is also not a solution it sometime expands to dummy. To prove it I
replaced /usr/bin/maildrop with a simple bash script:

#!/bin/bash
echo "$@" >> /tmp/_debug

and it turns out $nexthop resolves ti dummy. I have a 'user@domain
maildrop:dummy' line in transport maps.

I tried with 'user@domain maildrop' and it seems to expand nexthop properly,
which is much better than the hadcoded link. Anyway, I`d be interested to see
how maildrop can be used with authlib against the same sql that postfix uses.

mouss

unread,
Jan 30, 2008, 5:29:49 PM1/30/08
to
Pavel Georgiev wrote:
> OK, here are few details about the setup, let me know if you need more info:
> Distro: Ubuntu 6.06 TLS
> postfix 2.2.10, maildrop 1.5.3, libsasl2 2.1.19 from standart ubuntu packages
> postfix is configured with virtual users, lookups are made in mysql.
>
> In the standart configuration, maildrop transport is defined as `maildrop -d
> ${recipeint}`, which doen not work (out of the box) with virtual users.
>

Please stop saying "it does not work". It does work here since years.
Please describe your problem: what exactly happens, what error you see,
... etc.

You may be a victim of a packaging bug. find the sources of the maildrop
package on ubuntu, then grep HAVE_COURIER in the patch files (*.patch).
if you find some, shoot the package maintainer ;-p (HAVE_COURIER is for
use with the courier-mta, not with postfix or other MTAs).

> $nexthop is also not a solution it sometime expands to dummy.

Nothing works if you fight against yourself ;-p


> To prove it I
> replaced /usr/bin/maildrop with a simple bash script:
>
> #!/bin/bash
> echo "$@" >> /tmp/_debug
>
> and it turns out $nexthop resolves ti dummy. I have a 'user@domain
> maildrop:dummy' line in transport maps.
>

why do you put "dummy" in the transport entry.

> I tried with 'user@domain maildrop' and it seems to expand nexthop properly,
> which is much better than the hadcoded link. Anyway, I`d be interested to see
> how maildrop can be used with authlib against the same sql that postfix uses.
>

I use the config with ${nexthop} (yes with authdaemon, mysql ...) on a
NetBSD system.

0 new messages