Key pair not imported when passing cloud-init script on initiation
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Description
===========
The public SSH key is not imported when an instance is created with a key pair (key pair tab) + cloud-init script (configuration tab)
- Reproduced in dashboard (Horizon)
- Reproduced with python (nova.server.
Steps to reproduce
==================
- Create an instance in the GUI
- with a key pair
Key pair is inserted
-------
[ 22.212331] cloud-init[993]: Cloud-init v. 18.4-0ubuntu1~
2019 09:44:27 +0000. Up 21.13 seconds.
[[0;32m OK [0m] Started Apply the settings specified in cloud-config.
Starting Execute cloud user/final scripts...
ci-info: +++++Authorized keys from /home/ubuntu/
ci-info: +------
ci-info: | Keytype | Fingerprint (md5) | Options | Comment |
ci-info: +------
ci-info: | ssh-rsa | 36:b4:ea:
ci-info: +------
=> login to VM with key pair
-> Login successful
- Create a second instance
- with a key pair
- pass a cloud-init script in the user configuration
#cloud-config
chpasswd:
expire: false
list: |
root:toor
jelle:jelle
users:
- name: jelle
lock-passwd: false
sudo: ['ALL=(ALL) NOPASSWD:ALL']
groups: sudo
shell: /bin/bash
==> Public key from the key-pair is not imported
[ 21.472835] cloud-init[937]: Cloud-init v. 18.4-0ubuntu1~
[[0;32m OK [0m] Started Apply the settings specified in cloud-config.
Starting Execute cloud user/final scripts...
ci-info: no authorized ssh keys fingerprints found for user jelle.
<14>Feb 26 09:36:23 ec2:
<14>Feb 26 09:36:23 ec2: #######
<14>Feb 26 09:36:23 ec2: -----BEGIN SSH HOST KEY FINGERPRINTS-----
<14>Feb 26 09:36:23 ec2: 1024 SHA256:
<14>Feb 26 09:36:23 ec2: 256 SHA256:
<14>Feb 26 09:36:23 ec2: 256 SHA256:
<14>Feb 26 09:36:23 ec2: 2048 SHA256:
<14>Feb 26 09:36:23 ec2: -----END SSH HOST KEY FINGERPRINTS-----
<14>Feb 26 09:36:23 ec2: #######
-----BEGIN SSH HOST KEY KEYS-----
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXN
ssh-ed25519 AAAAC3NzaC1lZDI
ssh-rsa AAAAB3NzaC1yc2E
-----END SSH HOST KEY KEYS-----
[ 22.295189] cloud-init[995]: Cloud-init v. 18.4-0ubuntu1~
[ 22.299328] cloud-init[995]: ci-info: no authorized ssh keys fingerprints found for user jelle.
[ 22.301658] cloud-init[995]: Cloud-init v. 18.4-0ubuntu1~
=> Login with keypair
-> login fails
Environment
===========
ubuntu@
15.1.5
ubuntu@
ii nova-api-os-compute 2:15.1.
ii nova-common 2:15.1.
ii nova-conductor 2:15.1.
ii nova-consoleauth 2:15.1.
ii nova-novncproxy 2:15.1.
ii nova-placement-api 2:15.1.
ii nova-scheduler 2:15.1.
ii python-nova 2:15.1.
xx@xx-
openstack 3.14.2
WORKAROUND
==========
Is it possible because the key pair insertion is also using cloud-init.
This is overruled by the userdata?
As a solution I will try to use cloud-init to insert the pub key.
i belive you are correct that this behavior is caused by the fact you are creating a usever via cloud init.
if you think this is really a nova bug feel free to set the status back to New for the bug to be retriaged.