procmail
[Top] [All Lists]

Re: -o flag and From lines

1999-06-09 15:58:27
Ian T Zimmerman <itz(_at_)transbay(_dot_)net> writes:
I have often wondered what the purpose of the -o flag to procmail is.
The man page says

      -o   Instead of allowing anyone to generate `From ' lines,
           simply override the fakes.

which isn't very illuminating (at least to me).  Grepping trough the
source,
...
So it seems the only effect is to not do some things with From lines
if either -f or -d is specified at the same time, and procmail is
running without privilege.  Why would that be useful?  As as security
precaution, it could be defeated by not specifying these other flags,
or not?

The logic regarding the generation of the "From " line is very tricky
but it basically comes to this:

First of all, the final message will only have a "From " line if either:
a) the -f option was given;
b) the -d option was given; or
c) it already had a "From " line.

Otherwise the message will be left "From "less.

Next, pick the first available addresses from the following and call it
the 'tentative sender':
        the argument to the -f option (unless it's just a '-')
        the address in an existing "From " line
        the invoker's username

Now, consider whether the invoker is trusted and whether the -o option
was given:

1) If the invoker is trusted, the -o option has no effect and procmail
   will use the tentative sender in the resulting 'From ' line.

2) If the invoker is not trusted and gave the -o option, then procmail
   will leave just one "From " line with the invoker's username in it.
   The -f option and the address in an existing "From " line will be
   ignored/lost.  If there was an address given via -f or an existing
   "From " line the procmail will also syslog a message at level
   LOG_ERR that says:
        Attempt to fake stamp by "username"

3) If the invoker is not trusted and didn't give the -o option, then
   procmail will compare the tentative sender with the invoker's
   username.  If they match then procmail will generate one "From "
   line with that address.  If they do not match, then procmail will
   generate a "From " line with the tentative sender and immediately
   following that a ">From " line with the invoker's username.


So, does it make any more sense now?


Philip Guenther

<Prev in Thread] Current Thread [Next in Thread>