Browse Source

HUE-125. `supervisor -d' creates world writable logs

bc Wong 15 years ago
parent
commit
4039975478
2 changed files with 11 additions and 11 deletions
  1. 0 1
      Makefile
  2. 11 10
      desktop/core/src/desktop/supervisor.py

+ 0 - 1
Makefile

@@ -174,7 +174,6 @@ apps: desktop
 ###################################
 ###################################
 INSTALL_CORE_FILES = \
 INSTALL_CORE_FILES = \
 	Makefile* $(wildcard *.mk) \
 	Makefile* $(wildcard *.mk) \
-	virtual* \
 	example* \
 	example* \
 	ext \
 	ext \
 	tools/app_reg \
 	tools/app_reg \

+ 11 - 10
desktop/core/src/desktop/supervisor.py

@@ -50,23 +50,23 @@ LOG = logging.getLogger()
 
 
 # If a process restarts mre than MAX_RESTARTS_IN_WINDOW times
 # If a process restarts mre than MAX_RESTARTS_IN_WINDOW times
 # within TIME_WINDOW number of seconds, the supervisor shuts down
 # within TIME_WINDOW number of seconds, the supervisor shuts down
-TIME_WINDOW=120
-MAX_RESTARTS_IN_WINDOW=3
+TIME_WINDOW = 120
+MAX_RESTARTS_IN_WINDOW = 3
 
 
 # User to setuid down to for any supervisees that don't have the
 # User to setuid down to for any supervisees that don't have the
 # drop_root option set to False
 # drop_root option set to False
-SETUID_USER="hue"
+SETUID_USER = "hue"
 
 
 # The entry point group in which to find processes to supervise.
 # The entry point group in which to find processes to supervise.
-ENTRY_POINT_GROUP="desktop.supervisor.specs"
+ENTRY_POINT_GROUP = "desktop.supervisor.specs"
 
 
 # How long to wait while trying to acquire the supervisor pid lock
 # How long to wait while trying to acquire the supervisor pid lock
 # file. We shouldn't spin long here - we'd rather fail to start up.
 # file. We shouldn't spin long here - we'd rather fail to start up.
-LOCKFILE_TIMEOUT=2
+LOCKFILE_TIMEOUT = 2
 
 
-# The desktop program
-DESKTOP_BIN = os.path.join(desktop.lib.paths.get_run_root(),
-                           'build', 'env', 'bin', 'desktop')
+# The hue program
+HUE_BIN = os.path.join(desktop.lib.paths.get_run_root(),
+                       'build', 'env', 'bin', 'hue')
 
 
 ######
 ######
 
 
@@ -99,7 +99,7 @@ class DjangoCommandSupervisee(SuperviseeSpec):
 
 
   @property
   @property
   def cmdv(self):
   def cmdv(self):
-    return [ DESKTOP_BIN, self.django_command ]
+    return [ HUE_BIN, self.django_command ]
 
 
 
 
 class TimeOutPIDLockFile(PIDLockFile):
 class TimeOutPIDLockFile(PIDLockFile):
@@ -224,7 +224,7 @@ def get_supervisees():
 
 
 def drop_privileges():
 def drop_privileges():
   """Drop root privileges down to the specified SETUID_USER.
   """Drop root privileges down to the specified SETUID_USER.
-  
+
   N.B. DO NOT USE THE logging MODULE FROM WITHIN THIS FUNCTION.
   N.B. DO NOT USE THE logging MODULE FROM WITHIN THIS FUNCTION.
   This function is run in forked processes right before it calls
   This function is run in forked processes right before it calls
   exec, but the fork may have occured while a different thread
   exec, but the fork may have occured while a different thread
@@ -300,6 +300,7 @@ def main():
         }
         }
 
 
     context.open()
     context.open()
+  os.umask(022)
 
 
   # Log initialization must come after daemonization, which closes all open files.
   # Log initialization must come after daemonization, which closes all open files.
   # Log statements before this point goes to stderr.
   # Log statements before this point goes to stderr.