xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #1213: websockify-ssl.patch

File websockify-ssl.patch, 6.6 KB (added by Antoine Martin, 5 years ago)

attempts at passing an ssl socket to websockify after we have read from it

  • etc/pam.d/xpra

     
    11session    required     pam_localuser.so
    2 session    sufficient   pam_systemd.so class=background type=x11
     2session    optional     pam_systemd.so class=user type=x11 debug=1
  • etc/xpra/cuda.conf

     
    99
    1010# Blacklist some devices:
    1111#blacklist = GTX 1080
    12 #blacklist = GTX 1070
     12blacklist = GTX 1070
    1313#blacklist = GTX 680
  • etc/xpra/nvenc.keys

     
    22#
    33# One key per line in the following format:
    44# 01234567-89AB-CDEF-0123-456789ABCDEF
    5 #
    6  No newline at end of file
     5#
     6#585d7fe6-531d-496c-856a-5de6a39224a5
     7#fd5466cb-cc1f-4f82-aad1-dcd0acad8d45
     8#
     9#12d1a7ed-77eb-46f7-b4cb-50b646ad28c5
     10
     114d70ff7c-c64a-4142-8421-3ccbf64bd1e4
  • tests/unit/codecs/image_wrapper_test.py

     
    2525        for x in range(3):
    2626            SW, SH = 6, 6
    2727            sub = img.get_sub_image(x, 0, SW, SH)
    28             #print("%s.get_sub_image%s=%s" % (img, (x, 0, SW, SH), sub))
     28            print("%s.get_sub_image%s=%s" % (img, (x, 0, SW, SH), sub))
    2929            assert sub.get_rowstride()==(SW*4)
    3030            sub_buf = sub.get_pixels()
    3131            #print("pixels for %ix%i: %i" % (SW, SH, len(sub_buf)))
  • xpra/server/server_core.py

     
    3131from xpra.scripts.config import InitException, parse_bool
    3232from xpra.net.bytestreams import SocketConnection, log_new_connection, inject_ssl_socket_info, pretty_socket, SOCKET_TIMEOUT
    3333from xpra.platform import set_name
    34 from xpra.os_util import load_binary_file, get_machine_id, get_user_uuid, platform_name, SIGNAMES
     34from xpra.os_util import load_binary_file, get_machine_id, get_user_uuid, platform_name, Queue, SIGNAMES
    3535from xpra.version_util import version_compat_check, get_version_info_full, get_platform_info, get_host_info, local_version
    3636from xpra.net.protocol import Protocol, get_network_caps, sanity_checks
    3737from xpra.net.crypto import crypto_backend_init, new_cipher_caps, \
     
    613613        protocol.start()
    614614        self.timeout_add(SOCKET_TIMEOUT*1000, self.verify_connection_accepted, protocol)
    615615
    616     def may_wrap_socket(self, conn, v):
     616    def may_wrap_socket(self, conn, v, read_data=None):
    617617        """
    618618            Returns:
    619619            * a flag indicating if we should continue processing this connection
     
    636636                    netlog.info("New http connection received from %s", frominfo)
    637637                    tname = "websockify-proxy"
    638638                def run_websockify():
    639                     self.start_websockify(conn, conn.remote)
     639                    self.start_websockify(conn, conn.remote, read_data)
    640640                start_thread(run_websockify, "%s-for-%s" % (tname, frominfo), daemon=True)
    641641                return False, conn, None
    642642        if self._ssl_wrap_socket and v[0] in (chr(0x16), 0x16):
     
    656656
    657657    def invalid_header(self, proto, data):
    658658        netlog("invalid_header(%s, %s bytes: '%s') input_packetcount=%s, tcp_proxy=%s, html=%s, ssl=%s", proto, len(data or ""), repr_ellipsized(data), proto.input_packetcount, self._tcp_proxy, self._html, bool(self._ssl_wrap_socket))
    659         err = "invalid packet format, not an xpra client?"
    660         proto.gibberish(err, data)
     659        read_data = Queue()
     660        read_data.put(data)
     661        def read_callback(packet):
     662            log.info("read_callback(%s)", nonl(packet))
     663            if packet:
     664                read_data.put(packet)
     665        proto.steal_connection(read_callback)
     666        cont, _, data = self.may_wrap_socket(proto._conn, data, read_data)
     667        if cont:
     668            err = "invalid packet format, not an xpra client?"
     669            proto.gibberish(err, data)
     670        #else:
     671        #    proto.steal_connection(read_callback)
    661672
    662 
    663     def start_websockify(self, conn, frominfo):
    664         netlog("start_websockify(%s, %s) www dir=%s", conn, frominfo, self._www_dir)
     673    def start_websockify(self, conn, frominfo, read_data=None):
     674        netlog("start_websockify(%s, %s, %s) www dir=%s", conn, frominfo, nonl(read_data), self._www_dir)
    665675        from xpra.net.websocket import WebSocketConnection, WSRequestHandler
    666676        try:
    667677            sock = conn._socket
    668678            sock.setblocking(1)
    669             if sys.platform.startswith("win"):
    670                 from xpra.net.bytestreams import untilConcludes
    671                 #workaround for win32 servers (this should not be needed on any other platform)
    672                 #which don't seem to honour our request to use blocking sockets
    673                 #maybe this should go in websockify somewhere?
     679            #sock.settimeout(0)
     680            from xpra.net.bytestreams import untilConcludes
     681            #workaround for win32 servers (this should not be needed on any other platform)
     682            #which don't seem to honour our request to use blocking sockets
     683            #maybe this should go in websockify somewhere?
     684            #optionally, we can inject data which has already been read from the socket
     685            if sys.platform.startswith("win") or read_data:
    674686                saved_recv = sock.recv
    675687                saved_send = sock.send
    676                 def recv(*args):
    677                     return untilConcludes(conn.is_active, saved_recv, *args)
     688                def is_active(*args):
     689                    return True
     690                def recv(bufsize, *args):
     691                    log.info("recv(%i, %s)", bufsize, args)
     692                    if read_data and read_data.qsize()>0:
     693                        return read_data.get()
     694                    #return saved_recv(bufsize, *args)
     695                    return untilConcludes(is_active, saved_recv, bufsize, *args)
    678696                def send(*args):
    679                     return untilConcludes(conn.is_active, saved_send, *args)
     697                    #return saved_send(*args)
     698                    return untilConcludes(is_active, saved_send, *args)
    680699                sock.recv = recv
    681700                sock.send = send
    682701            def new_websocket_client(wsh):