You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Francois Gaudreault <fg...@cloudops.com> on 2015/02/16 21:03:59 UTC

Remove/Change SSH Keys from instance

Hi,

Quick question, using the API, how would a user remove an associated SSH 
keys to an instance? What call should we use? Seems that you can't based 
on the existing API calls.

Furthermore, how can we change the SSH Key? Is it the 
resetSSHKeyForVirtualMachine call?

Thanks.

-- 
Francois Gaudreault
Gestionnaire de Produit | Product Manager - Cloud Platform & Services
t:514-629-6775

CloudOps Votre partenaire infonuagique | Cloud Solutions Experts
420 rue Guy | Montreal | Quebec | H3J 1S6
w: cloudops.com | tw: @CloudOps_


Re: Remove/Change SSH Keys from instance

Posted by Sebastien Goasguen <ru...@gmail.com>.
I think nux put a ? In there, which means he is not sure ...

So his yes is a maybe , maybe ?

-Sebastien

> On 16 Feb 2015, at 23:22, Francois Gaudreault <fg...@cloudops.com> wrote:
> 
> Yes what? That API call is not clear at all.
> 
> I guess a "try it yourself" is what you meant?
> 
> Thanks for your great help.
> 
> FG
>> On Feb 16, 2015 5:04 PM, "Nux!" <nu...@li.nux.ro> wrote:
>> 
>> yes?
>> 
>> 
>> https://cloudstack.apache.org/docs/api/apidocs-4.4/user/resetSSHKeyForVirtualMachine.html
>> 
>> --
>> Sent from the Delta quadrant using Borg technology!
>> 
>> Nux!
>> www.nux.ro
>> 
>> ----- Original Message -----
>>> From: "Francois Gaudreault" <fg...@cloudops.com>
>>> To: dev@cloudstack.apache.org
>>> Sent: Monday, 16 February, 2015 20:03:59
>>> Subject: Remove/Change SSH Keys from instance
>> 
>>> Hi,
>>> 
>>> Quick question, using the API, how would a user remove an associated SSH
>>> keys to an instance? What call should we use? Seems that you can't based
>>> on the existing API calls.
>>> 
>>> Furthermore, how can we change the SSH Key? Is it the
>>> resetSSHKeyForVirtualMachine call?
>>> 
>>> Thanks.
>>> 
>>> --
>>> Francois Gaudreault
>>> Gestionnaire de Produit | Product Manager - Cloud Platform & Services
>>> t:514-629-6775
>>> 
>>> CloudOps Votre partenaire infonuagique | Cloud Solutions Experts
>>> 420 rue Guy | Montreal | Quebec | H3J 1S6
>>> w: cloudops.com | tw: @CloudOps_
>> 

Re: Remove/Change SSH Keys from instance

Posted by Nux! <nu...@li.nux.ro>.
Depending on what you actually want to achieve, you could also register a bogus public key and reset to that one, knowing it will never really work.

Lucian

--
Sent from the Delta quadrant using Borg technology!

Nux!
www.nux.ro

----- Original Message -----
> From: "Francois Gaudreault" <fg...@cloudops.com>
> To: "Nux!" <nu...@li.nux.ro>
> Cc: dev@cloudstack.apache.org
> Sent: Monday, 16 February, 2015 23:53:52
> Subject: Re: Remove/Change SSH Keys from instance

> Thanks for looking at it and testing it.
> 
> That answers the key replacement. Looks like there is no way to actually
> removing the key from a created VM. I believe the only way left is the
> deletion. The updateVM call won't update it either :S
> 
> FG
> 
> On 2015-02-16 6:37 PM, Nux! wrote:
>> "resetSSHKeyForVirtualMachine
>> Resets the SSH Key for virtual machine. The virtual machine must be in a
>> "Stopped" state. [async]"
>>
>> Apologies for causing you extra stress. We all had a long Monday.
>>
>> I also never used this function before and here's how I tested.
>>
>> - empty or move /root/.ssh/authorized_keys on the VM prior to the operation
>> - in cloudmonkey
>>    - stop virtualmachine id=XXX
>>    - reset sshkeyforvirtualmachine keypair=newkey id=XXX
>>    - start virtualmachine id=XXX
>> - after it came back I checked /root/.ssh/authorized_keys and .. lo & behold,
>> the new key was there.
>>
>> So, answer: yes, that's how to reset the SSH key and no, you can't remove it
>> that way - it will check if the provided key name actually exists and you must
>> provide one.
>>
>>   ☕ :-)
>>
>>
>> --
>> Sent from the Delta quadrant using Borg technology!
>>
>> Nux!
>> www.nux.ro
>>
>> ----- Original Message -----
>>> From: "Francois Gaudreault" <fg...@cloudops.com>
>>> To: "Nux!" <nu...@li.nux.ro>
>>> Cc: dev@cloudstack.apache.org
>>> Sent: Monday, 16 February, 2015 22:22:34
>>> Subject: Re: Remove/Change SSH Keys from instance
>>> Yes what? That API call is not clear at all.
>>>
>>> I guess a "try it yourself" is what you meant?
>>>
>>> Thanks for your great help.
>>>
>>> FG
>>> On Feb 16, 2015 5:04 PM, "Nux!" <nu...@li.nux.ro> wrote:
>>>
>>>> yes?
>>>>
>>>>
>>>> https://cloudstack.apache.org/docs/api/apidocs-4.4/user/resetSSHKeyForVirtualMachine.html
>>>>
>>>> --
>>>> Sent from the Delta quadrant using Borg technology!
>>>>
>>>> Nux!
>>>> www.nux.ro
>>>>
>>>> ----- Original Message -----
>>>>> From: "Francois Gaudreault" <fg...@cloudops.com>
>>>>> To: dev@cloudstack.apache.org
>>>>> Sent: Monday, 16 February, 2015 20:03:59
>>>>> Subject: Remove/Change SSH Keys from instance
>>>>> Hi,
>>>>>
>>>>> Quick question, using the API, how would a user remove an associated SSH
>>>>> keys to an instance? What call should we use? Seems that you can't based
>>>>> on the existing API calls.
>>>>>
>>>>> Furthermore, how can we change the SSH Key? Is it the
>>>>> resetSSHKeyForVirtualMachine call?
>>>>>
>>>>> Thanks.
>>>>>
>>>>> --
>>>>> Francois Gaudreault
>>>>> Gestionnaire de Produit | Product Manager - Cloud Platform & Services
>>>>> t:514-629-6775
>>>>>
>>>>> CloudOps Votre partenaire infonuagique | Cloud Solutions Experts
>>>>> 420 rue Guy | Montreal | Quebec | H3J 1S6
>>>>> w: cloudops.com | tw: @CloudOps_
>>
> 
> 
> --
> Francois Gaudreault
> Gestionnaire de Produit | Product Manager - Cloud Platform & Services
> t:514-629-6775
> 
> CloudOps Votre partenaire infonuagique | Cloud Solutions Experts
> 420 rue Guy | Montreal | Quebec | H3J 1S6
> w: cloudops.com | tw: @CloudOps_

Re: Remove/Change SSH Keys from instance

Posted by Francois Gaudreault <fg...@cloudops.com>.
Thanks for looking at it and testing it.

That answers the key replacement. Looks like there is no way to actually 
removing the key from a created VM. I believe the only way left is the 
deletion. The updateVM call won't update it either :S

FG

On 2015-02-16 6:37 PM, Nux! wrote:
> "resetSSHKeyForVirtualMachine
> Resets the SSH Key for virtual machine. The virtual machine must be in a "Stopped" state. [async]"
>
> Apologies for causing you extra stress. We all had a long Monday.
>
> I also never used this function before and here's how I tested.
>
> - empty or move /root/.ssh/authorized_keys on the VM prior to the operation
> - in cloudmonkey
>    - stop virtualmachine id=XXX
>    - reset sshkeyforvirtualmachine keypair=newkey id=XXX
>    - start virtualmachine id=XXX
> - after it came back I checked /root/.ssh/authorized_keys and .. lo & behold, the new key was there.
>
> So, answer: yes, that's how to reset the SSH key and no, you can't remove it that way - it will check if the provided key name actually exists and you must provide one.
>
>   ☕ :-)
>
>
> --
> Sent from the Delta quadrant using Borg technology!
>
> Nux!
> www.nux.ro
>
> ----- Original Message -----
>> From: "Francois Gaudreault" <fg...@cloudops.com>
>> To: "Nux!" <nu...@li.nux.ro>
>> Cc: dev@cloudstack.apache.org
>> Sent: Monday, 16 February, 2015 22:22:34
>> Subject: Re: Remove/Change SSH Keys from instance
>> Yes what? That API call is not clear at all.
>>
>> I guess a "try it yourself" is what you meant?
>>
>> Thanks for your great help.
>>
>> FG
>> On Feb 16, 2015 5:04 PM, "Nux!" <nu...@li.nux.ro> wrote:
>>
>>> yes?
>>>
>>>
>>> https://cloudstack.apache.org/docs/api/apidocs-4.4/user/resetSSHKeyForVirtualMachine.html
>>>
>>> --
>>> Sent from the Delta quadrant using Borg technology!
>>>
>>> Nux!
>>> www.nux.ro
>>>
>>> ----- Original Message -----
>>>> From: "Francois Gaudreault" <fg...@cloudops.com>
>>>> To: dev@cloudstack.apache.org
>>>> Sent: Monday, 16 February, 2015 20:03:59
>>>> Subject: Remove/Change SSH Keys from instance
>>>> Hi,
>>>>
>>>> Quick question, using the API, how would a user remove an associated SSH
>>>> keys to an instance? What call should we use? Seems that you can't based
>>>> on the existing API calls.
>>>>
>>>> Furthermore, how can we change the SSH Key? Is it the
>>>> resetSSHKeyForVirtualMachine call?
>>>>
>>>> Thanks.
>>>>
>>>> --
>>>> Francois Gaudreault
>>>> Gestionnaire de Produit | Product Manager - Cloud Platform & Services
>>>> t:514-629-6775
>>>>
>>>> CloudOps Votre partenaire infonuagique | Cloud Solutions Experts
>>>> 420 rue Guy | Montreal | Quebec | H3J 1S6
>>>> w: cloudops.com | tw: @CloudOps_
>


-- 
Francois Gaudreault
Gestionnaire de Produit | Product Manager - Cloud Platform & Services
t:514-629-6775

CloudOps Votre partenaire infonuagique | Cloud Solutions Experts
420 rue Guy | Montreal | Quebec | H3J 1S6
w: cloudops.com | tw: @CloudOps_


Re: Remove/Change SSH Keys from instance

Posted by Nux! <nu...@li.nux.ro>.
"resetSSHKeyForVirtualMachine
Resets the SSH Key for virtual machine. The virtual machine must be in a "Stopped" state. [async]"

Apologies for causing you extra stress. We all had a long Monday.

I also never used this function before and here's how I tested.

- empty or move /root/.ssh/authorized_keys on the VM prior to the operation
- in cloudmonkey
  - stop virtualmachine id=XXX
  - reset sshkeyforvirtualmachine keypair=newkey id=XXX
  - start virtualmachine id=XXX
- after it came back I checked /root/.ssh/authorized_keys and .. lo & behold, the new key was there.

So, answer: yes, that's how to reset the SSH key and no, you can't remove it that way - it will check if the provided key name actually exists and you must provide one.

 ☕ :-)


--
Sent from the Delta quadrant using Borg technology!

Nux!
www.nux.ro

----- Original Message -----
> From: "Francois Gaudreault" <fg...@cloudops.com>
> To: "Nux!" <nu...@li.nux.ro>
> Cc: dev@cloudstack.apache.org
> Sent: Monday, 16 February, 2015 22:22:34
> Subject: Re: Remove/Change SSH Keys from instance

> Yes what? That API call is not clear at all.
> 
> I guess a "try it yourself" is what you meant?
> 
> Thanks for your great help.
> 
> FG
> On Feb 16, 2015 5:04 PM, "Nux!" <nu...@li.nux.ro> wrote:
> 
>> yes?
>>
>>
>> https://cloudstack.apache.org/docs/api/apidocs-4.4/user/resetSSHKeyForVirtualMachine.html
>>
>> --
>> Sent from the Delta quadrant using Borg technology!
>>
>> Nux!
>> www.nux.ro
>>
>> ----- Original Message -----
>> > From: "Francois Gaudreault" <fg...@cloudops.com>
>> > To: dev@cloudstack.apache.org
>> > Sent: Monday, 16 February, 2015 20:03:59
>> > Subject: Remove/Change SSH Keys from instance
>>
>> > Hi,
>> >
>> > Quick question, using the API, how would a user remove an associated SSH
>> > keys to an instance? What call should we use? Seems that you can't based
>> > on the existing API calls.
>> >
>> > Furthermore, how can we change the SSH Key? Is it the
>> > resetSSHKeyForVirtualMachine call?
>> >
>> > Thanks.
>> >
>> > --
>> > Francois Gaudreault
>> > Gestionnaire de Produit | Product Manager - Cloud Platform & Services
>> > t:514-629-6775
>> >
>> > CloudOps Votre partenaire infonuagique | Cloud Solutions Experts
>> > 420 rue Guy | Montreal | Quebec | H3J 1S6
>> > w: cloudops.com | tw: @CloudOps_

Re: Remove/Change SSH Keys from instance

Posted by Francois Gaudreault <fg...@cloudops.com>.
Yes what? That API call is not clear at all.

I guess a "try it yourself" is what you meant?

Thanks for your great help.

FG
On Feb 16, 2015 5:04 PM, "Nux!" <nu...@li.nux.ro> wrote:

> yes?
>
>
> https://cloudstack.apache.org/docs/api/apidocs-4.4/user/resetSSHKeyForVirtualMachine.html
>
> --
> Sent from the Delta quadrant using Borg technology!
>
> Nux!
> www.nux.ro
>
> ----- Original Message -----
> > From: "Francois Gaudreault" <fg...@cloudops.com>
> > To: dev@cloudstack.apache.org
> > Sent: Monday, 16 February, 2015 20:03:59
> > Subject: Remove/Change SSH Keys from instance
>
> > Hi,
> >
> > Quick question, using the API, how would a user remove an associated SSH
> > keys to an instance? What call should we use? Seems that you can't based
> > on the existing API calls.
> >
> > Furthermore, how can we change the SSH Key? Is it the
> > resetSSHKeyForVirtualMachine call?
> >
> > Thanks.
> >
> > --
> > Francois Gaudreault
> > Gestionnaire de Produit | Product Manager - Cloud Platform & Services
> > t:514-629-6775
> >
> > CloudOps Votre partenaire infonuagique | Cloud Solutions Experts
> > 420 rue Guy | Montreal | Quebec | H3J 1S6
> > w: cloudops.com | tw: @CloudOps_
>

Re: Remove/Change SSH Keys from instance

Posted by Francois Gaudreault <fg...@cloudops.com>.
Look...I apologize for the sarcasm. I was a little bit irritated. I just 
wanted to get some help.

I read the API documentation, I read the User guide. I just wanted to 
same some time and ask on this list.

Thanks.

FG

On 2015-02-16 5:04 PM, Nux! wrote:
> yes?
>
> https://cloudstack.apache.org/docs/api/apidocs-4.4/user/resetSSHKeyForVirtualMachine.html
>
> --
> Sent from the Delta quadrant using Borg technology!
>
> Nux!
> www.nux.ro
>
> ----- Original Message -----
>> From: "Francois Gaudreault" <fg...@cloudops.com>
>> To: dev@cloudstack.apache.org
>> Sent: Monday, 16 February, 2015 20:03:59
>> Subject: Remove/Change SSH Keys from instance
>> Hi,
>>
>> Quick question, using the API, how would a user remove an associated SSH
>> keys to an instance? What call should we use? Seems that you can't based
>> on the existing API calls.
>>
>> Furthermore, how can we change the SSH Key? Is it the
>> resetSSHKeyForVirtualMachine call?
>>
>> Thanks.
>>
>> --
>> Francois Gaudreault
>> Gestionnaire de Produit | Product Manager - Cloud Platform & Services
>> t:514-629-6775
>>
>> CloudOps Votre partenaire infonuagique | Cloud Solutions Experts
>> 420 rue Guy | Montreal | Quebec | H3J 1S6
>> w: cloudops.com | tw: @CloudOps_


-- 
Francois Gaudreault
Gestionnaire de Produit | Product Manager - Cloud Platform & Services
t:514-629-6775

CloudOps Votre partenaire infonuagique | Cloud Solutions Experts
420 rue Guy | Montreal | Quebec | H3J 1S6
w: cloudops.com | tw: @CloudOps_


Re: Remove/Change SSH Keys from instance

Posted by Nux! <nu...@li.nux.ro>.
yes?

https://cloudstack.apache.org/docs/api/apidocs-4.4/user/resetSSHKeyForVirtualMachine.html

--
Sent from the Delta quadrant using Borg technology!

Nux!
www.nux.ro

----- Original Message -----
> From: "Francois Gaudreault" <fg...@cloudops.com>
> To: dev@cloudstack.apache.org
> Sent: Monday, 16 February, 2015 20:03:59
> Subject: Remove/Change SSH Keys from instance

> Hi,
> 
> Quick question, using the API, how would a user remove an associated SSH
> keys to an instance? What call should we use? Seems that you can't based
> on the existing API calls.
> 
> Furthermore, how can we change the SSH Key? Is it the
> resetSSHKeyForVirtualMachine call?
> 
> Thanks.
> 
> --
> Francois Gaudreault
> Gestionnaire de Produit | Product Manager - Cloud Platform & Services
> t:514-629-6775
> 
> CloudOps Votre partenaire infonuagique | Cloud Solutions Experts
> 420 rue Guy | Montreal | Quebec | H3J 1S6
> w: cloudops.com | tw: @CloudOps_