Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] init.d-scripts don't see stuff from /etc/profile.env
Date: Tue, 30 Aug 2005 23:12:13
Message-Id: 200508301909.51972.vapier@gentoo.org
In Reply to: Re: [gentoo-dev] init.d-scripts don't see stuff from /etc/profile.env by Roy Marples
1 On Tuesday 30 August 2005 05:32 pm, Roy Marples wrote:
2 > On Thu, 2005-08-25 at 12:01 +0200, Paul de Vrieze wrote:
3 > > On Wednesday 24 August 2005 12:04, Roy Marples wrote:
4 > > > Um, that's kinda like behaviour by design unless anyone can tell me
5 > > > otherwise.
6 > > >
7 > > > /etc/env.d/* just set shell variables, so if you change one then you
8 > > > need to
9 > > >
10 > > > env-update
11 > > > source /etc/profile
12 > > > /etc/init.d/thisdaemon restart
13 > > >
14 > > > To refresh the daemon that needs the vars
15 > >
16 > > Perhaps the init script loader should be changed such that the
17 > > environment variables from the shell calling the script are ignored, and
18 > > an
19 > > environment equal to that when being called by init is used.
20 >
21 > I've been looking into this and the only easy solution I can find is to
22 > move /sbin/runscript.sh to say /lib/rcscripts/sh, change it to
23 > source /etc/profile and then create a new /sbin/runscript.sh like so
24 >
25 > Right away we can see that we actually do need some to keep some env
26 > vars and the list would be constantly updated. There's also nothing to
27 > stop the user from setting them and then running a script which kind of
28 > defeats the purpose here anyway.
29 >
30 > Personally I'm against this.I'd like to know what Azarah and Vapier
31 > think of this though. Others too!
32
33 init.d scripts should have a pure env given to them ... which means, they
34 should be run with `env -i` and have only whitelisted variables given to them
35 (and everything that appears in /etc/conf.d/$service /etc/conf.d/rc
36 and /etc/rc.conf) ...
37
38 after all, you wouldnt want something like apache having all those vars in its
39 env because they'd show up in php script env which means available to the
40 public
41 -mike
42 --
43 gentoo-dev@g.o mailing list

Replies

Subject Author
[gentoo-dev] Re: init.d-scripts don't see stuff from /etc/profile.env "Sven Köhler" <skoehler@×××.de>