I am trying to import a RSA Private Key into Cloudmin but it keeps rejecting the private key with the following error:
Failed to save SSH key : Pasted text does not appear to be an SSH key
Call Stack Trace
File Line Function
/usr/libexec/webmin/server-manager/save_key.cgi 71 WebminCore::error
(eval 43) 6 (eval)
/usr/libexec/webmin/miniserv.pl 2333 (eval)
/usr/libexec/webmin/miniserv.pl 917 miniserv::handle_request
I login to CloudMin, click on “CloudMin Settings” > “SSH Keys” > “Add SSH Key” > select “Pasted into textbox below…” and paste the key in
This is what they key looks like:
-----BEGIN RSA PRIVATE KEY-----
… snip …
-----END RSA PRIVATE KEY-----
I believe it’s looking for a public key in that particular screen, rather than a private key.
I actually tried both a Private Key and Public Key and get the same error.
The Public Key I’m using looks as follows:
------------------- snip -------------------
Can someone please tell me when this will be resolved? I still can’t add Public SSH Keys from a cPanel server to CloudMin, to allow CloudMin to manage (i.e add / remove Network Interfaces, memory, view bandwidth usage, etc) a cPanel server which uses SSH Keys to CloudMin
Well, we haven’t been able to reproduce the issue you’re seeing – adding a public SSH key normally works without a problem.
Can you share the full public SSH key that you’re trying to paste in?
This form may be wanting an ascii armored version, perhaps? I’m not sure. When copy/pasting, the client can do weird things with more complex data. Browsers may choose different encodings, etc.
It’s kinda bug-like that you’re getting a traceback, anyway. I’ll ask Jamie to have a look at this thread.
I think the issue is the lines :
at the start of your public key. Try removing those from the text box, and see if Cloudmin accepts it.
I ran into this problem as well using Cloudmin GPL (7.4.kvm) and removing those lines did not work for me.
I looked at the code (server-manager-lib-funcs.pl, check_ssh_key_data) and it looks like the issue is the regexp back match: $3 should be $4. I made the patch to my local copy and I can now add a private key properly via upload or pasting it in.
But there seems to be a larger issue here. It appears that the first key generated MUST either be generated by Cloudmin or be a private key. Once one gets over that hurdle, one can add public keys that get added to newly-created VMs (which was my original intent). Is that a bug in the code, UI, or an issue with my understanding?
Thanks for pointing out this bug - I’ll include your fix in the next release.
Cloudmin needs a private key when creating a new VM so that it can SSH into the system.
I’m glad that my edit was helpful. After I posted, I played around with things a bit more and better understand the use case. There seems to be something else awry here. In my case, I merely wanted to add a public SSH key that would be installed for root of the new machine.
It seems that if no SSH keys are defined, the code defaults to insisting that the first key be a private/public key pair. What I did to work around this was generate a keypair using the first option, but I am not using that key pair for the VM creation. I have it generating random root passwords. After I created this first key, I can go ahead and add in a public key to be included in roots authorized_keys file.
Is this behavior a bug? Or is it just a case of the UI/help needing to make this more clear. I’m happy to volunteer a fix in either case; just let me know your preference.
That could be a bug. What error message were you getting when the first key isn’t a public/private key pair?
Instead of flapping my arms or using sock puppets, I made a screen recording so you could see. Link is here:
Ok, I see the bug that causes this now - a fix will be included in the next Cloudmin release.
Great! I didn’t even have to write any code!