rewrite "from" for sudo mails

barbara.ruess at barbara.ruess at
Mon Mar 24 04:11:04 EST 2003

We"hacked" the code like Todd told me. Unfortunately this doesn't work -
mails still have the user's from address.
I'm sure we compiled the correct file since we can see the mail address we
have put in logging.c  with the command "strings sudo".
Are there any additional modifications that need to be done?
Any suggestions?


In message <OFA9C87BE1.45E258A5-ONC1256CEC.004AF0D1 at muc.allianz>
             so spake  (barbara.ruess):

> Sudo is sending mails with from="user who tried do anything".
> The new mailing concept that is to be intoduced in my company requires me
> to use a certain "from" address (the same one for every user), let's say
> "sudouser at mydomain. Is there a possibility (inside sudo) to rewrite
> sender address?

There's no config knob to turn to do thing.  However, it is simple
to hack the code a bit.  In logging.c, you will see the following:

    /* Pipes are all setup, send message via sendmail. */
    (void) fprintf(mail, "To: %s\nFrom: %s\nSubject: ",
        def_str(I_MAILTO), user_name);

You could just replace user_name with "sudouser at mydomain" (including
the double quotes).

 - todd

More information about the sudo-users mailing list