vm-bhyve icon indicating copy to clipboard operation
vm-bhyve copied to clipboard

cloudinit -k flag only supports a single ssh-key

Open sarcasticadmin opened this issue 5 years ago • 2 comments

Description

Related to: #291

While running: vm create -i ~/imgs/bionic-server-cloudimg-amd64.raw -t mytemplate -s 20G -C -n "ip=192.168.1.249/24;gateway=192.168.1.1;nameservers=8.8.4.4,8.8.8.8" -k ~/.ssh/authorized_keys robstest

I was attempting to add multiple ssh-keys using -C -k keys.file but this yields the following error during vm start:

[   10.577473] cloud-init[675]: 2020-02-18 08:49:31,806 - util.py[WARNING]: Failed loading yaml blob. Invalid format at line 6 column 1: "while scanning a simple key                                                                   
[   10.580129] cloud-init[675]:   in "<unicode string>", line 6, column 1:                                                                                                                                                              
[   10.581694] cloud-init[675]:     ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB ...                                                                                                                                                                
[   10.583186] cloud-init[675]:     ^                                                                                                                                                                                                   
[   10.584219] cloud-init[675]: could not find expected ':'
[   10.585842] cloud-init[675]:   in "<unicode string>", line 7, column 1:
[   10.587359] cloud-init[675]:     ecdsa-sha2-nistp256 AAAAE2VjZHNh ...
[   10.589045] cloud-init[675]:     ^"
[   10.590120] cloud-init[675]: 2020-02-18 08:49:31,827 - util.py[WARNING]: Failed loading yaml blob. Invalid format at line 6 column 1: "while scanning a simple key
[   10.593092] cloud-init[675]:   in "<unicode string>", line 6, column 1:
[   10.594599] cloud-init[675]:     ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB ...
[   10.597268] cloud-init[675]:     ^
[   10.598323] cloud-init[675]: could not find expected ':'
[   10.599646] cloud-init[675]:   in "<unicode string>", line 7, column 1:
[   10.601199] cloud-init[675]:     ecdsa-sha2-nistp256 AAAAE2VjZHNh ...
[   10.602684] cloud-init[675]:     ^"
[   10.603760] cloud-init[675]: 2020-02-18 08:49:31,827 - util.py[WARNING]: Failed at merging in cloud config part from part-001
[   11.699653] cloud-init[675]: Generating public/private rsa key pair.
[   11.701319] cloud-init[675]: Your identification has been saved in /etc/ssh/ssh_host_rsa_key.
[   11.703102] cloud-init[675]: Your public key has been saved in /etc/ssh/ssh_host_rsa_key.pub.
[   11.704942] cloud-init[675]: The key fingerprint is:
[   11.706229] cloud-init[675]: SHA256:KglmWr/uvj/NSvD6jttJFmPQCbXK2lLinm4ORuq31Xg root@robstest
[   11.708013] cloud-init[675]: The key's randomart image is:
[   11.709408] cloud-init[675]: +---[RSA 2048]----+

Expected Result

  • multiple keys to be added to the vm default user's authorized_keys file

System Info

~ # uname -a
FreeBSD devil2 12.1-RELEASE FreeBSD 12.1-RELEASE r354233 GENERIC  amd64
~ # vm version
vm-bhyve: Bhyve virtual machine management v1.5-devel (rev. 105010)

sarcasticadmin avatar Feb 19 '20 07:02 sarcasticadmin

Hi @sarcasticadmin Thank you for reporting this issue. Unfortunately, I don't have free cycles at this moment to improve this but I'll appreciate PR.

mateuszkwiatkowski avatar Mar 19 '20 14:03 mateuszkwiatkowski

@mateuszkwiatkowski no problem, thanks for following up. Its not a blocker for me at the moment but I'll keep you posted when I get around to fixing this.

sarcasticadmin avatar Mar 20 '20 23:03 sarcasticadmin