如何连接到 Xen XAPI/XCP-NG VNC/RFB 连接网址?

如何连接到 Xen XAPI/XCP-NG VNC/RFB 连接网址?

如何https://192.168.1.45/console?uuid=e82eeea4-4d88-d31a-aabd-c4207ca6c24d使用普通 vnc 客户端连接到 Xapi 样式的 URL?

Remmina 作为主机似乎直接崩溃了,并且尝试使用socat代理也会关闭连接。

KRDC 和 TigerVNC 发生混淆,Vinagre 出现错误,并且 Remmina 崩溃或挂起。

文档显示它是一个非标准的 https 代理,我想知道是否有内置有此代理支持的 Linux VNC 客户端,或者我可以运行一个命令来直接进行 http 连接?

答案1

我最终用 Ruby 编写了一个简单的代理来实现这一点。运行如下ruby thisscript.rb xapi-url yourusername

require 'socket'
require 'base64'
require 'openssl'
require 'uri'

def connect(uri, auth)
    ss = TCPSocket.new uri.host, uri.port
    ssl_socket = if uri.scheme == "https"
        ssl_context = OpenSSL::SSL::SSLContext.new()
        ssl_socket = OpenSSL::SSL::SSLSocket.new(ss, ssl_context)
        ssl_socket.sync_close = true
        ssl_socket.connect
        ssl_socket
    else
        ss
    end
    ssl_socket.puts("CONNECT #{uri.path}?#{uri.query} HTTP/1.1\r\nAuthorization: Basic #{Base64.encode64(auth)}\r\n\r\n")

    begin
        text = ""
        until text.include? "\r\n\r\n"
            text << ssl_socket.readpartial(1024).tap{|x|print x}
        end
        text = nil
    ensure
        puts text if text
    end
    return ssl_socket
end

listening = TCPServer.new 5903
uri = URI(ARGV[0])
username = ARGV[1]
ARGV.shift
ARGV.shift
print "Enter Password for #{username}: "
pass = gets.strip
loop do
    clent = listening.accept
    puts "Connecting..."
    ssl_socket = connect(uri, "#{username}:#{pass}")
    
    Thread.new do 
        # XEN -> VNC
        begin 
            loop do
                clent.write ssl_socket.readpartial(4096)
            end
        rescue EOFError
            client.close rescue nil
            ssl_socket.close rescue nil
        end
    end 
    # VNC -> XEN
    begin 
        loop do
            ssl_socket.write clent.readpartial(4096)
        end
    rescue EOFError
        client.close rescue nil
        ssl_socket.close rescue nil
    end
    puts "Closed stream"
end

相关内容