Exemplo n.º 1
0
    def run(self):
        import Hooks

        #now make sure that the kids can't setuid back to root
        groupToRunAs=getattr(Configuration, 'groupToRunAs', None)
        userToRunAs=getattr(Configuration, 'userToRunAs', None)
        if groupToRunAs is not None or userToRunAs is not None:
            # in case we are seteuid something else, which would
            # cause setuid or getuid to fail, undo any existing
            # seteuid. (The only reason to do this is for the case
            # os.getuid()==0, AFAIK).
            try:
                seteuid=os.seteuid
            except AttributeError:
                # the OS may not support seteuid, in which
                # case everything is hotsy-totsy.
                pass
            else:
                seteuid(os.getuid())
            if groupToRunAs is not None:
                gid = grp.getgrnam(groupToRunAs)[2]
                os.setgid(gid)

            if userToRunAs is not None:
                uid = pwd.getpwnam(userToRunAs)[2]
                os.setuid(uid)
            
        Hooks.ChildStart()
        SocketMan.run(self)
Exemplo n.º 2
0
    def __init__(self):
        SocketMan.__init__(self, Configuration.maxRequests,
                           Configuration.numProcs, Configuration.maxKillTime,
                           Configuration.pidFile, Configuration.pollPeriod,
                           LogObj)

        signal.signal(signal.SIGINT, self._SIGTERMHandler)
Exemplo n.º 3
0
    def run(self):
        import Hooks

        #now make sure that the kids can't setuid back to root
        groupToRunAs = getattr(Configuration, 'groupToRunAs', None)
        userToRunAs = getattr(Configuration, 'userToRunAs', None)
        if groupToRunAs is not None or userToRunAs is not None:
            # in case we are seteuid something else, which would
            # cause setuid or getuid to fail, undo any existing
            # seteuid. (The only reason to do this is for the case
            # os.getuid()==0, AFAIK).
            try:
                seteuid = os.seteuid
            except AttributeError:
                # the OS may not support seteuid, in which
                # case everything is hotsy-totsy.
                pass
            else:
                seteuid(os.getuid())
            if groupToRunAs is not None:
                gid = grp.getgrnam(groupToRunAs)[2]
                os.setgid(gid)

            if userToRunAs is not None:
                uid = pwd.getpwnam(userToRunAs)[2]
                os.setuid(uid)

        Hooks.ChildStart()
        SocketMan.run(self)
Exemplo n.º 4
0
    def __init__(self):
        SocketMan.__init__(self,
                           Configuration.maxRequests,
                           Configuration.numProcs,
                           Configuration.maxKillTime,
                           Configuration.pidFile,
                           Configuration.pollPeriod,
                           LogObj)

        signal.signal(signal.SIGINT, self._SIGTERMHandler)
Exemplo n.º 5
0
    def run(self):
        import Hooks

        #now make sure that the kids can't setuid back to root
        if hasattr(Configuration, 'groupToRunAs'):
            gid = grp.getgrnam(Configuration.groupToRunAs)[2]
            os.setgid(gid)

        if hasattr(Configuration, 'userToRunAs'):
            uid = pwd.getpwnam(Configuration.userToRunAs)[2]
            if hasattr(os, 'seteuid'):
                os.seteuid(os.getuid())
            os.setuid(uid)

        Hooks.ChildStart()
        SocketMan.run(self)
Exemplo n.º 6
0
    def run(self):
        import Hooks

        #now make sure that the kids can't setuid back to root
        if hasattr(Configuration, 'groupToRunAs'):
            gid = grp.getgrnam(Configuration.groupToRunAs)[2]
            os.setgid(gid)

        if hasattr(Configuration, 'userToRunAs'):
            uid = pwd.getpwnam(Configuration.userToRunAs)[2]
            if hasattr(os, 'seteuid'):
                os.seteuid(os.getuid())
            os.setuid(uid)
            
        Hooks.ChildStart()
        SocketMan.run(self)
Exemplo n.º 7
0
    def reload(self):
        # extract what we need from configuration, and wipe it out
        global Configuration
        ver, cf, sr= (Configuration.SkunkWebVersion,
                      Configuration._config_files_,
                      Configuration.SkunkRoot)
        SocketMan.reload(self)
        del Configuration
        
        global LogObj
        del LogObj
        
        sm = ['ConfigAdditives',
              'Configuration',
              'Hooks',
              'KickStart',
              'ServiceRegistry',
              'LogObj']
        for i in sm:
            del sys.modules['SkunkWeb.%s' % i]
        
        f = sys.modules.keys(); f.sort()
        f = sys.modules['SkunkWeb']
        for i in sm:
            delattr(f, i)
            
        import bootloader
        bootloader.init(cf, sr)
        import LogObj
        # replace the previous (massacred) LogObj with the new one
        self.logInterface=LogObj
        bootloader.load()

        #global Configuration
        import Configuration
        _setConfigDefaults()
            
        self.userModuleCleanup = Configuration.userModuleCleanup
        self.maxRequests = Configuration.maxRequests
        self.numProcs = Configuration.numProcs
        self.pidFile = Configuration.pidFile
        self.pollPeriod = Configuration.pollPeriod
        self.maxKillTime = Configuration.maxKillTime
        self.foreground=Configuration.runInForeground
Exemplo n.º 8
0
    def reload(self):
        # extract what we need from configuration, and wipe it out
        global Configuration
        ver, cf, sr = (Configuration.SkunkWebVersion,
                       Configuration._config_files_, Configuration.SkunkRoot)
        SocketMan.reload(self)
        del Configuration

        global LogObj
        del LogObj

        sm = [
            'ConfigAdditives', 'Configuration', 'Hooks', 'KickStart',
            'ServiceRegistry', 'LogObj'
        ]
        for i in sm:
            del sys.modules['SkunkWeb.%s' % i]

        f = sys.modules.keys()
        f.sort()
        f = sys.modules['SkunkWeb']
        for i in sm:
            delattr(f, i)

        import bootloader
        bootloader.init(cf, sr)
        import LogObj
        # replace the previous (massacred) LogObj with the new one
        self.logInterface = LogObj
        bootloader.load()

        #global Configuration
        import Configuration
        _setConfigDefaults()

        self.userModuleCleanup = Configuration.userModuleCleanup
        self.maxRequests = Configuration.maxRequests
        self.numProcs = Configuration.numProcs
        self.pidFile = Configuration.pidFile
        self.pollPeriod = Configuration.pollPeriod
        self.maxKillTime = Configuration.maxKillTime
        self.foreground = Configuration.runInForeground
Exemplo n.º 9
0
 def run(self):
     import Hooks
     Hooks.ChildStart()
     SocketMan.run(self)
Exemplo n.º 10
0
 def run(self):
     import Hooks
     Hooks.ChildStart()
     SocketMan.run(self)