April 5, 2020 2:47 AM, "grmat" <gr...@sub.red> wrote:

> Hi there,


> I'd like to setup GNU Mailman with OpenSMTPD. In #1040[1], poolpOrg told
> me command processing is to be done with a .forward file instead of
> aliases:
>> I think aliases should not support command processing at all as handling 
>> these from a .forward file
>> is equivalent
> So I looked up the man page forward(5) and it also says
>> A .forward file contains a list of expansion values, as described in 
>> aliases(5).
> Therefore, I assumed I could just set up a .forward file for mailman
> (in addition to aliasing the addresses to user "mailman").
> Example content for running mailing list gene...@example.org:
> # general mailing list
> general: "|/path/to/mailman/mail/mailman post general"
> general-admin: "|/path/to/mailman/mail/mailman admin general"
> general-bounces: "|/path/to/mailman/mail/mailman bounces general"
> [...]
> But apparently, that's not how .forward files work. aliases are
> key-value, but .forward rules are only values, and a mail would always
> be forwarded to *each* of the lines. At least that's what I understand
> from the errors I get. I don't think it's possible to set different
> forwarding rules for different addresses which are all aliased to the
> same user, hence I still have to go for aliases in this case?
> Could anyone please confirm that or tell me where I'm wrong. Thanks in
> advance!

It is possible to use some variables in .forward files, so you can write
a small script (this is just an untested example):

#! /bin/sh

if test "$1" = "general"; then
    /path/to/mailman/mail/mailman post general
elif test "$1" = "general-admin"; then
    /path/to/mailman/mail/mailman admin general
elif test "$1" = "general-bounces"; then
    /path/to/mailman/mail/mailman bounces general

Then in ~mailman/.forward, use:

|/path/to/that/wrapper "%{dest.user}"

This is superior to adding the commands in /etc/mail/aliases as you are
guaranteed that the mailman utility is privileges separated from daemon
and ran as the user who owns the .forward file.

For other software, like mlmmj it is even simpler as the command itself
uses the recipient email address to determine what command it should be
running and no script is needed.

Reply via email to