sshkeys (ciuser) to an VM endpoint (format error)

iamralf

New Member
May 6, 2024
6
0
1
I receive following error from the Proxmox-API (v8.1.10):

{"sshkeys": "invalid format - invalid urlencoded string: ssh-rsa%20AA.................................%20eom\n"}}, "msg": "Status code was 400 and not [200]: HTTP Error 400: Parameter verification failed.", "pragma": "no-cache", "redirected": false, "server": "pve-api-daemon/3.0", "status": 400, "url": "https://proxmox:8006/api2/json/nodes/cluster01/qemu/5000/config"}

The same issue seems to be reported here, but the solution is not applicable. Sorry for posting there, but without response:
https://forum.proxmox.com/threads/sshkeys-invalid-format-invalid-urlencoded-string.126202/

{{ | urlencode }} does its job in the Ansible task (There are no "\n" or "+").
However, "\n" is appended to the content of the sshkey-variable in the error message back from the Proxmox server.
The code runs without the sshkeys line in the Ansible task below. ("ciuser" and "cipassword").

My Ansible task look like:

YAML:
   - name: configure vm
     uri:
       url: "https://{{ server_url }}:8006/api2/json/nodes/{{ node }}/qemu/{{ vmid_next | trim }}/config"
       method: POST
       return_content: yes
       body_format: json
       use_proxy: no
       validate_certs: no
       timeout: 5
       headers:
         Authorization: "PVEAPIToken=..."
         Content-Type: "application/json"
       body:
         [...]
         ciuser: "{{ inventory_settings__pve_vm_username }}"
         sshkeys: "{{ inventory_settings__pve_vm_public_key | trim | urlencode }}"
     [...]

What is the problem here? Thanks for any help!
 
Last edited:

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!