1

On Gandi (or other providers) you can activate an emergency console to your VM. It binds a SSH channel to a temporary IP and port.

I have my own server running on xen. I would like to implement an emergency console, but I don't know where to start.

A console can be accessed with the xm console <servername> command. I guess it can be possible to bind stdin/stdout/stderr to an SSH server that runs on a chosen random port.

The overall idea is, when somebody needs an emergency access to their VM they can log in on the hypervisor website with its own credentials and hit the "enable my emergency SSH access". From there a random port is bound to the VM for a specified duration.

Another way to phrase this is, how did Gandi manage to implement an emergency console access without having to reboot the VM?

migrated from superuser.com Jul 7 '15 at 15:02

This question came from our site for computer enthusiasts and power users.

  • How can I easily migrate a question? – nowox Jul 7 '15 at 6:05
2

Possible Solutions

Offline: Strictly SSH Access

It is not feasible to inject a binary into a running Xen virtual machine to have it create an SSH server and access the filesystem.

If you strictly need an emergency SSH session opened, you will have to destroy the virtual machine then attach its disks to a separate general read-only rescue image that has a running SSH server. The rescue image would take the place of the broken guest, and the virtual machine administrator could use this rescue image to make whatever changes necessary to repair the broken guest.

Through the Host: Allowing Console Access

Smiling Dragon's answer explains how to do this, but it would be a really bad idea for security.

Online: VNC Proxy

Since it is not trivial to allow console access over SSH on the host (Smiling Dragon's answer), you could set up a VNC proxy using something like noVNC and protecting VNC sessions with authentication tokens. OpenStack does this.

This solution is a rather secure way (if implemented properly, like OpenStack) to let a virtual machine administrator access into a live running instance, but it takes the most engineering to set up properly.

  • Thanks for you answer. I just edited my question. From what you are saying. Implementation of such ssh access is not easily feasible. However gandi did manage it without having to reboot the VM. – nowox Jul 6 '15 at 21:17
  • @nowox: I've never used Gandi, but judging from their documentation, it looks like they have developed a custom console.gandi.net system that allows their customers to connect to their instances. The instances themselves likely have some sort of backdoor (with the exception of "AI mode" instances, according to them) to allow the console system to connect to the instances. – Deltik Jul 6 '15 at 21:24
  • @Delitk seems interesting. It's looks more secure than SmilingDragon's answer. However I don't know how to implement that kind of backdoor without using the network layer. – nowox Jul 7 '15 at 5:41
1

A somewhat hacky solution could be to dynamically create an ssh account with the authorized_keys containing the VM owner's public key. The shell would be set to xm console <servername> && <command to remove the user again>.

You'd need to think through the security implications of the user breaking out of the xm session of course.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.