Beispiel #1
0
    def startService(self):
        mask = 0
        if Settings.devel_mode:
            mask = 8000

        # Allocate local ports
        for port in Settings.bind_local_ports:
            http_sock, fail = reserve_port_for_ip('127.0.0.1', port)
            if fail is not None:
                log.err("Could not reserve socket for %s (error: %s)",
                        fail.args[0], fail.args[1])
            else:
                self.state.http_socks += [http_sock]

        # Allocate remote ports
        for port in Settings.bind_remote_ports:
            sock, fail = reserve_port_for_ip(Settings.bind_address, port+mask)
            if fail is not None:
                log.err("Could not reserve socket for %s (error: %s)",
                        fail.args[0], fail.args[1])
                continue

            if port == 80:
                self.state.http_socks += [sock]
            elif port == 443:
                self.state.https_socks += [sock]

        if Settings.disable_swap:
            disable_swap()

        fix_file_permissions(Settings.working_path,
                             Settings.uid,
                             Settings.gid,
                             0o700,
                             0o600)

        set_proc_title('globaleaks')

        drop_privileges(Settings.user, Settings.uid, Settings.gid)

        reactor.callLater(0, self.deferred_start)
Beispiel #2
0
    def startService(self):
        mask = 0
        if GLSettings.devel_mode:
            mask = 8000

        GLSettings.http_socks = []

        # Allocate local ports
        for port in GLSettings.bind_local_ports:
            http_sock, fail = reserve_port_for_ip('127.0.0.1', port)
            if fail is not None:
                log.err("Could not reserve socket for %s (error: %s)", fail[0],
                        fail[1])
            else:
                GLSettings.http_socks += [http_sock]

        # Allocate remote ports
        for port in GLSettings.bind_remote_ports:
            sock, fail = reserve_port_for_ip(GLSettings.bind_address,
                                             port + mask)
            if fail is not None:
                log.err("Could not reserve socket for %s (error: %s)", fail[0],
                        fail[1])
                continue

            if port == 80:
                GLSettings.http_socks += [sock]
            elif port == 443:
                GLSettings.https_socks += [sock]

        if GLSettings.disable_swap:
            disable_swap()

        GLSettings.fix_file_permissions()
        GLSettings.drop_privileges()
        GLSettings.check_directories()

        reactor.callLater(0, self.deferred_start)
Beispiel #3
0
    def startService(self):
        mask = 0
        if Settings.devel_mode:
            mask = 8000

        # Allocate local ports
        for port in Settings.bind_local_ports:
            http_sock, fail = reserve_port_for_ip('127.0.0.1', port)
            if fail is not None:
                log.err("Could not reserve socket for %s (error: %s)", fail[0], fail[1])
            else:
                self.state.http_socks += [http_sock]

        # Allocate remote ports
        for port in Settings.bind_remote_ports:
            sock, fail = reserve_port_for_ip(Settings.bind_address, port+mask)
            if fail is not None:
                log.err("Could not reserve socket for %s (error: %s)", fail[0], fail[1])
                continue

            if port == 80:
                self.state.http_socks += [sock]
            elif port == 443:
                self.state.https_socks += [sock]

        if Settings.disable_swap:
            disable_swap()

        fix_file_permissions(Settings.working_path,
                             Settings.uid,
                             Settings.gid,
                             0o700,
                             0o600)

        drop_privileges(Settings.user, Settings.uid, Settings.gid)

        reactor.callLater(0, self.deferred_start)