mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
virt-install: fix cloud-init ssh keys
Fix the cloud-init config file for --clouduser-ssh key.
Also change ssh_authorized_keys to `ssh_authorized_keys`, and make sure
default user is not deleted when setting ssh key for root.
Fixes commit 22478f307d
(virt-install: Add --cloud-init clouduser-ssh-key=)
Resolves: https://github.com/virt-manager/virt-manager/issues/452
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
This commit is contained in:
parent
72a74fb1fb
commit
648f52bde0
@ -4,10 +4,12 @@ chpasswd:
|
||||
root:[SCRUBBLED]
|
||||
expire: False
|
||||
users:
|
||||
- default
|
||||
- name: root
|
||||
ssh-authorized-keys:
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDAuibybX5lw2G/LPIyqgQS5KwgbOnKMA9TZyQPtRmIfKSGypdMJmGQ+Gsf54A9VI8zoL2fnq2t66zQIPJU53XveXU0oqCm7PfsEcoYjnqDeUeiqvCfTye8bIbEmIkLriH0SaISNnzyN0JSfb0VDYIg8Za6iW3/PfPs+tV0PSYyVEm3pBNJ9bHat2liA1/Afk0UWNrhCQG9/5v9kR36aIxNU+4qI9cZ2npFWt61/7t2otz2GcygJDCUYEp6wDlmoW6DHXnaUUj1USjZ9uI1IrgmjZYxfjlt/UaB7AJOJP/3bOC1iPXBe9HKt30YUG23KaVfK9DDeGD/tlAeIklaYK8RZd4zUXSm3eZjeZCGiC3XFYIIyf7e7M/IZE+/DbD1jQEGxGd7AmdVBJZPBFtkAd4Blypaidykx7n1UcfF0WWISfFsae956PHnqnSBKM5OUDh2y5LowgXjWmr/BVJmnaiNbeMhgC3axZVL3EmFSVtvwnup+sRmDwYoHh/RbmInyns=
|
||||
- ssh-authorized-keys: ssh-rsa 123453NzaC1yc2EAAAADAQABAAABgQDAuibybX5lw2G/LPIyqgQS5KwgbOnKMA9TZyQPtRmIfKSGypdMJmGQ+Gsf54A9VI8zoL2fnq2t66zQIPJU53XveXU0oqCm7PfsEcoYjnqDeUeiqvCfTye8bIbEmIkLriH0SaISNnzyN0JSfb0VDYIg8Za6iW3/PfPs+tV0PSYyVEm3pBNJ9bHat2liA1/Afk0UWNrhCQG9/5v9kR36aIxNU+4qI9cZ2npFWt61/7t2otz2GcygJDCUYEp6wDlmoW6DHXnaUUj1USjZ9uI1IrgmjZYxfjlt/UaB7AJOJP/3bOC1iPXBe9HKt30YUG23KaVfK9DDeGD/tlAeIklaYK8RZd4zUXSm3eZjeZCGiC3XFYIIyf7e7M/IZE+/DbD1jQEGxGd7AmdVBJZPBFtkAd4Blypaidykx7n1UcfF0WWISfFsae956PHnqnSBKM5OUDh2y5LowgXjWmr/BVJmnaiNbeMhgC3axZVL3EmFSVtvwnup+sRmDwYoHh/RbmInyns=
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa 123453NzaC1yc2EAAAADAQABAAABgQDAuibybX5lw2G/LPIyqgQS5KwgbOnKMA9TZyQPtRmIfKSGypdMJmGQ+Gsf54A9VI8zoL2fnq2t66zQIPJU53XveXU0oqCm7PfsEcoYjnqDeUeiqvCfTye8bIbEmIkLriH0SaISNnzyN0JSfb0VDYIg8Za6iW3/PfPs+tV0PSYyVEm3pBNJ9bHat2liA1/Afk0UWNrhCQG9/5v9kR36aIxNU+4qI9cZ2npFWt61/7t2otz2GcygJDCUYEp6wDlmoW6DHXnaUUj1USjZ9uI1IrgmjZYxfjlt/UaB7AJOJP/3bOC1iPXBe9HKt30YUG23KaVfK9DDeGD/tlAeIklaYK8RZd4zUXSm3eZjeZCGiC3XFYIIyf7e7M/IZE+/DbD1jQEGxGd7AmdVBJZPBFtkAd4Blypaidykx7n1UcfF0WWISfFsae956PHnqnSBKM5OUDh2y5LowgXjWmr/BVJmnaiNbeMhgC3axZVL3EmFSVtvwnup+sRmDwYoHh/RbmInyns=
|
||||
|
||||
<domain type="test">
|
||||
<name>fedora28</name>
|
||||
|
@ -1,7 +1,8 @@
|
||||
#cloud-config
|
||||
users:
|
||||
- default
|
||||
- name: root
|
||||
ssh-authorized-keys:
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDAuibybX5lw2G/LPIyqgQS5KwgbOnKMA9TZyQPtRmIfKSGypdMJmGQ+Gsf54A9VI8zoL2fnq2t66zQIPJU53XveXU0oqCm7PfsEcoYjnqDeUeiqvCfTye8bIbEmIkLriH0SaISNnzyN0JSfb0VDYIg8Za6iW3/PfPs+tV0PSYyVEm3pBNJ9bHat2liA1/Afk0UWNrhCQG9/5v9kR36aIxNU+4qI9cZ2npFWt61/7t2otz2GcygJDCUYEp6wDlmoW6DHXnaUUj1USjZ9uI1IrgmjZYxfjlt/UaB7AJOJP/3bOC1iPXBe9HKt30YUG23KaVfK9DDeGD/tlAeIklaYK8RZd4zUXSm3eZjeZCGiC3XFYIIyf7e7M/IZE+/DbD1jQEGxGd7AmdVBJZPBFtkAd4Blypaidykx7n1UcfF0WWISfFsae956PHnqnSBKM5OUDh2y5LowgXjWmr/BVJmnaiNbeMhgC3axZVL3EmFSVtvwnup+sRmDwYoHh/RbmInyns=
|
||||
|
||||
<domain type="test">
|
||||
|
@ -81,17 +81,18 @@ def _create_userdata_content(cloudinit_data):
|
||||
elif cloudinit_data.root_password_file:
|
||||
content += " expire: False\n"
|
||||
|
||||
if cloudinit_data.root_ssh_key or cloudinit_data.clouduser_ssh_key:
|
||||
content += "users:\n"
|
||||
if cloudinit_data.root_ssh_key:
|
||||
rootkey = cloudinit_data.get_root_ssh_key()
|
||||
userkey = cloudinit_data.get_clouduser_ssh_key()
|
||||
|
||||
if rootkey:
|
||||
content += "users:\n"
|
||||
content += " - default\n"
|
||||
content += " - name: root\n"
|
||||
content += " ssh-authorized-keys:\n"
|
||||
content += " ssh_authorized_keys:\n"
|
||||
content += " - %s\n" % rootkey
|
||||
if userkey:
|
||||
content += " - ssh-authorized-keys: %s\n" % userkey
|
||||
|
||||
if cloudinit_data.clouduser_ssh_key:
|
||||
userkey = cloudinit_data.get_clouduser_ssh_key()
|
||||
content += "ssh_authorized_keys:\n"
|
||||
content += " - %s\n" % userkey
|
||||
|
||||
if cloudinit_data.disable:
|
||||
content += "runcmd:\n"
|
||||
|
Loading…
Reference in New Issue
Block a user