[SOLVED] 401 Credentials failure when connecting to proxmox novnc websocket on private web

shbaek

New Member
Dec 5, 2024
11
0
1

The domains are the same internal network, but the IPs are different.(pve server:32.99:8006, web server:32.22:4200)

Problem Statement:​

  1. I called the /api2/json/access/ticket endpoint to retrieve the ticket and CSRFPreventionToken values. The ticket was used as a browser cookie, but I’m not sure exactly when the CSRFPreventionToken should be applied. Regardless, I kept both values.
  2. Next, I called the /api2/json/nodes/${node}/qemu/${vmid}/vncproxy endpoint to obtain the port value and the vncticket required for VNC connections. The request headers included:
  • Content-Type: application/x-www-form-urlencoded
  • Authorization: PVEAPIToken=root@pam!admin=ceed553a-1938-4119-9d44-5905d29b0ebf
  • CSRFPreventionToken: csrfToken
  1. I then attempted to use the retrieved port and vncticket to establish a WebSocket connection.
  2. However, the browser returned an error indicating that it could not connect. Upon checking the access.log on the Proxmox VE server, I found the following 401 Unauthorized error:
::ffff:192.168.32.22 - - [18/12/2024:10:01:17 +0900] "GET /api2/json/nodes/itzone/qemu/2002/vncwebsocket?port=5900&vncticket=PVEVNC:67621EDD::Z6WTOCxW1/Pc667XJcEahyfkpqEeALwc543ZXp6Zcd30IeWseu1ouW3mZLOdY4fuNGjCbb3d3osNMrH3mCwlkoZ9vjLKVDjhNIPpTqpSWfCWUSjKEXDJBuiCmYFppKtDrftxz9wdz2/uwo+tx+2Bpg/QEZH3vBUQZ79qLS95xMgPjhnuqUFW/WJ9+yeHGMnxAh/oT9IOuuwir65+mEZN44UTMr++CpdjDByLVYEU3cmmIYPPUElWiWQHSdTgqGpIzQJ/BiJv7wuT1c6gVn9AdPJP9o7ajgDDRQR+rU3WXhqhUIWSXndpon/TMpwVhj95U1XIdWNYQrve5x6XRmtN2w== HTTP/1.1" 401 -

Key Observations:​

  • The VNC WebSocket API request failed with a 401 Unauthorized error.
  • The vncticket and port values appear to be correct, but there seems to be an issue with the authentication process.

Question:​

  • Are there any common pitfalls or missing configurations when attempting to connect to Proxmox VE’s VNC WebSocket API?
  • What steps should I take to successfully establish the WebSocket connection using the provided vncticket and port values?
Any advice or solutions would be greatly appreciated!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!