Question about lifetime of environment variables in job files

Garrett Cooper yanegomi at gmail.com
Tue Nov 4 23:00:38 GMT 2008


On Tue, Nov 4, 2008 at 11:09 AM, Scott James Remnant <scott at netsplit.com> wrote:
> On Tue, 2008-11-04 at 14:31 +0100, Matthias Urlichs wrote:
>
>> Scott James Remnant:
>> > The idea would be that when the pre-start script exits, we pick up the
>> > environment table and add that back to the job -- this may require some
>> > changes to the way init gets child signals or something though.
>> >
>> Umm, so you want to either auto-add a "printenv" at the end of that
>> script, or use ptrace to stop it before running _exit() / exit_group()?
>>
> Right, it's a bit tricky - the only real way to extract the "exported
> environment" of a process is to make it fork a child, or exec another
> binary.
>
> I had a crazy idea of grabbing the child on exit, and then turning that
> into an exec() call which fed back the information into Upstart.
>
> An initctl "change the environment" command is far more likely as the
> ultimate realisation here:
>
>        initctl saveenv
>
> Maybe
>
> Scott

1. Why not add another stanza within the jobfiles?
2. At the end of each script / exec invocation, add implicit shell
echo calls to get information.

I find this to be a bit problematic though, esp from a security
standpoint, because it'd be providing applications with potentially
less than root privs the ability to modify job behavior as per the
environment set at the job stanza execution level.

-Garrett



More information about the upstart-devel mailing list