additional key added to ssh authorized_keys on azure
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Hi, running a standard Ubuntu 18.04 image on Azure.
If the System-Assigned Managed Identity is enabled at the launch of the VM, the public key of this identity will be added as an ssh authorized_key for both the admin user and root, in addition to the key provided in the launch details.
I launched a test VM with the managed identity enabled. Immediately after launch, ~/.ssh/
It appears that cloud init reads this Certificates.pem, and converts them to the format needed by authorized_keys. So it appears that both public keys are coming from here.
This second Certificate has issuer=
ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: cloud-init 18.4-0ubuntu1~
ProcVersionSign
Uname: Linux 4.15.0-1035-azure x86_64
ApportVersion: 2.20.9-0ubuntu7.5
Architecture: amd64
CloudName: Azure
Date: Thu Jan 10 17:52:56 2019
PackageArchitec
ProcEnviron:
TERM=xterm-
PATH=(custom, no user)
LANG=C.UTF-8
SHELL=/bin/bash
SourcePackage: cloud-init
UpgradeStatus: No upgrade log present (probably fresh install)
user_data.txt:
Related branches
- David Krauser (community): Approve
- Robert C Jennings (community): Approve
-
Diff: 13 lines (+0/-3)1 file modifiedtemplates/img-azure-18.10-addin.tmpl (+0/-3)
information type: | Private Security → Public Security |
Thanks for filing the bug, and making Ubuntu better.
Quick note: cloud-init.log reports all files read and written to /var/lib/waagent with 'Writing to' && 'Reading from' prefixes. It doesn't directly parse those pem files (that's all walinuxagent effort)
The only thing cloud-init writes is /var/lib/ waagent/ ovf-env. xml whose content it receives from Azure's IMDS service or reprovision API route.
I have a couple of questions to help me understand:
1. How did you provide an additional ssh-key (Azure cli, UI or #cloud-config userdata)?
2.Could you explain what the bug is here? Your instance was configured to use a System-Assigned Managed Identity key by default and you provided at launch time a second key.
It feels a bit like having the 2 keys supplement may be intended behavior as far as Azure is concerned right?