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) set_proc_title('globaleaks') drop_privileges(Settings.user, Settings.uid, Settings.gid) reactor.callLater(0, self.deferred_start)
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)