summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Kent <mkent@magoazul.com>2009-04-10 17:36:58 -0700
committerMatthew Kent <mkent@magoazul.com>2009-04-14 22:57:33 -0700
commit47a51b6a0f05cfe9ee949a5004e88f474639ba48 (patch)
tree293f1ccd6d56a10b97037944711ba2571e168689
parent2b8efe384d39f64049fa9c3ecb609d02c619892b (diff)
downloadchef-47a51b6a0f05cfe9ee949a5004e88f474639ba48.tar.gz
drop privileges prior to writing logs
-rwxr-xr-xchef-server/bin/chef-indexer2
-rwxr-xr-xchef/bin/chef-client2
-rw-r--r--chef/lib/chef/daemon.rb1
3 files changed, 4 insertions, 1 deletions
diff --git a/chef-server/bin/chef-indexer b/chef-server/bin/chef-indexer
index f36e09a8c3..da12326723 100755
--- a/chef-server/bin/chef-indexer
+++ b/chef-server/bin/chef-indexer
@@ -64,6 +64,8 @@ end
Chef::Config.from_file(config[:config_file])
Chef::Config.configure { |c| c.merge!(config) }
+Chef::Daemon.change_privilege
+
if Chef::Config[:daemonize]
unless Chef::Config[:log_location].is_a? IO
Chef::Log.init(Chef::Config[:log_location])
diff --git a/chef/bin/chef-client b/chef/bin/chef-client
index df06e068fd..1c1b38bd19 100755
--- a/chef/bin/chef-client
+++ b/chef/bin/chef-client
@@ -79,6 +79,8 @@ end
Chef::Config.from_file(config[:config_file])
Chef::Config.configure { |c| c.merge!(config) }
+Chef::Daemon.change_privilege
+
if Chef::Config[:daemonize]
unless Chef::Config[:log_location].is_a? IO
Chef::Log.init(Chef::Config[:log_location])
diff --git a/chef/lib/chef/daemon.rb b/chef/lib/chef/daemon.rb
index 7ab66ab710..1b4d770207 100644
--- a/chef/lib/chef/daemon.rb
+++ b/chef/lib/chef/daemon.rb
@@ -40,7 +40,6 @@ class Chef
exit if fork
Process.setsid
exit if fork
- change_privilege
Chef::Log.info("Forked, in #{Process.pid}. Priveleges: #{Process.euid} #{Process.egid}")
File.umask 0000
$stdin.reopen("/dev/null")