def change_permissions(): if CONFIG['group']: helper.chown(CONFIG['log_file'], os.getuid(), CONFIG['group']) helper.chown(CONFIG['pid_file'], os.getuid(), CONFIG['group']) helper.set_gid(CONFIG['group']) if CONFIG['user']: helper.chown(CONFIG['log_file'], CONFIG['user'], os.getgid()) helper.chown(CONFIG['pid_file'], CONFIG['user'], os.getgid()) helper.set_uid(CONFIG['user'])
def change_permissions(self): if self.config['group']: helper.chown(self.config['log_file'], os.getuid(), self.config['group']) helper.chown(self.config['pid_file'], os.getuid(), self.config['group']) helper.set_gid(self.config['group']) if self.config['user']: helper.chown(self.config['log_file'], self.config['user'], os.getgid()) helper.chown(self.config['pid_file'], self.config['user'], os.getgid()) helper.set_uid(self.config['user'])
def change_permissions(self): if self.config['group']: if self.config['log_file']: helper.chown(self.config['log_file'], os.getuid(), self.config['group']) helper.chown(self.config['pid_file'], os.getuid(), self.config['group']) helper.set_gid(self.config['group']) if self.config['user']: if self.config['log_file']: helper.chown(self.config['log_file'], self.config['user'], os.getgid()) helper.chown(self.config['pid_file'], self.config['user'], os.getgid()) helper.set_uid(self.config['user'])
def run(self): try: self.configure() t = self._serve_forever() time.sleep(5) # change permissions if self.config['group']: helper.set_gid(self.config['group']) if self.config['user']: helper.set_uid(self.config['user']) LOG.info('Plotter started') t.join() except: LOG.exception(helper.exc_info())
def run(self): try: self.configure() t = self._serve_forever() while not t.is_alive(): time.sleep(0.5) # wait before change permissions to allow cherrypy read certificates time.sleep(2) # change permissions if self.config['group']: helper.set_gid(self.config['group']) if self.config['user']: helper.set_uid(self.config['user']) LOG.info('Plotter started') t.join() except: LOG.exception(helper.exc_info())