Skip to content

Commit 47a51b6

Browse files
committed
drop privileges prior to writing logs
1 parent 2b8efe3 commit 47a51b6

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

chef-server/bin/chef-indexer

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ end
6464
Chef::Config.from_file(config[:config_file])
6565
Chef::Config.configure { |c| c.merge!(config) }
6666

67+
Chef::Daemon.change_privilege
68+
6769
if Chef::Config[:daemonize]
6870
unless Chef::Config[:log_location].is_a? IO
6971
Chef::Log.init(Chef::Config[:log_location])

chef/bin/chef-client

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ end
7979
Chef::Config.from_file(config[:config_file])
8080
Chef::Config.configure { |c| c.merge!(config) }
8181

82+
Chef::Daemon.change_privilege
83+
8284
if Chef::Config[:daemonize]
8385
unless Chef::Config[:log_location].is_a? IO
8486
Chef::Log.init(Chef::Config[:log_location])

chef/lib/chef/daemon.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def daemonize(name)
4040
exit if fork
4141
Process.setsid
4242
exit if fork
43-
change_privilege
4443
Chef::Log.info("Forked, in #{Process.pid}. Priveleges: #{Process.euid} #{Process.egid}")
4544
File.umask 0000
4645
$stdin.reopen("/dev/null")

0 commit comments

Comments
 (0)