Pilot

From PRAGMA wiki
Jump to: navigation, search

Purpose

To give an user total control of a hosted VM in your Rocks VM hosting server, so the user can access a VM console, power on or off his/her VM with a single command from a laptop.

Procedure at a glance

In this procedure, the User is a VM owner and the Administrator is the administrator of the VM hosting server.

  • User
    • Install/setup Pilot on his/her laptop
  • Administrator
    • Setup an user account for the user on the VM hosting server
      • Ask the user to email you his/her ssh public key
      • Setup an user account on the VM hosting server
      • Email the user his/her account name and VM hosting server name
  • User
    • Ssh to the VM hosting server
    • Create a RSA key
    • Email the RSA public key to the administrator
  • Administrator
    • Associate the user's public key to his/her VM
    • Email the user his/her VM mac address
  • User
    • Run pilot to access his/her VM

MAC laptop users

See http://build-x86-64.rocksclusters.org/roll-documentation/xen/5.4/pilot.html

Windows laptop users

In this example, the user is John, the administrator is Cindy, the VM hosting server is vmhostsvr.sdsc.edu and John needs full control of the VM geoapp1.

Setup Pilot on a Windows laptop

C:\Users\john>cd pilot
C:\Users\john\pilot>dir
...
02/23/2011  11:43 AM    <DIR>          .
02/23/2011  11:43 AM    <DIR>          ..
02/22/2011  02:11 PM    <DIR>          curl-7.21.2-ssl-sspi-zlib-static-bin-w32
02/22/2011  02:07 PM         1,361,602 curl-7.21.2-ssl-sspi-zlib-static-bin-w32.zip
02/22/2011  02:12 PM               859 DLSupport.bat
...

Add curl path and run DLsupport

   
C:\Users\john\pilot>PATH=%PATH%;C:\Users\john\pilot\curl-7.21.2-ssl-sspi-zlib-static-bin-w32
C:\Users\john\pilot>DLsupport

The DLsupport should download 4 additional files

C:\Users\john\pilot>dir
...
02/22/2011  02:11 PM    <DIR>          curl-7.21.2-ssl-sspi-zlib-static-bin-w32
02/22/2011  02:07 PM         1,361,602 curl-7.21.2-ssl-sspi-zlib-static-bin-w32.zip
02/22/2011  02:12 PM               859 DLSupport.bat
02/22/2011  02:44 PM           347,465 M2Crytpo-0.20.2.win32-py2.7.exe
02/22/2011  02:44 PM        15,913,472 python-2.7.msi
02/22/2011  02:44 PM         4,216,840 vcredist_x86.exe
02/22/2011  02:44 PM         1,952,444 Win32OpenSSL_Light-1_0_0a.exe
...

Install the 4 packages in the following order (ignore the warning about missing Visual C++ redistributable 2008)

C:\Users\john\pilot>vcredist_x86.exe
C:\Users\john\pilot>python-2.7.msi
C:\Users\john\pilot>Win32OpenSSL_Light-1_0_0a.exe
C:\Users\john\pilot>M2Crytpo-0.20.2.win32-py2.7.exe

Start Putty, expand "SSH" under "Connection" in the left pane, click "Tunnels", fill the "Destination" and "Source port"
For example
Putty1.jpg
Click "Add".
Click "Session" in the left pane, fill in the "Host Name (or IP address)", "Port" and a name in the "Saved Sessions"
For example
Putty2.jpg
Click "Save", then "Open"

  • A login window open

Putty3.jpg
Before login to open the tunnel, John needs the administrator to help setup access to vmhostsvr and geoapp1. See next session.

Setup user VM access

  • John emails his ssh public key to Cindy
  • Cindy creates user account john on vmhostsvr.sdsc.edu and inform John his username and geoapp1 mac address.
  • John ssh to the vmhostsvr and creates a key
$ ssh john@vmhostsvr.sdsc.edu
[john@vmhostsvr ~]$ mkdir pilot-keys
[john@vmhostsvr ~]$ cd pilot-keys
[john@vmhostsvr ~]$ rocks create keys key=private.key
Generating RSA private key, 1024 bit long modulus
......++++++
....................++++++
e is 65537 (0x10001)
Enter pass phrase for private.key:
Verifying - Enter pass phrase for private.key:
Enter pass phrase for private.key:
writing RSA key
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDEvOerlo60HA2CzTAiNUSJ3fQ/
a56d8sxwsQzyuT7GiKs9j4s6YsSnlh+9phrvb16d+zq+ZQtrz9u9S/R2od7iI6UY
8UMTEPTUHnvQaZIXKs+S7IUGlkNnyYvJNjSDgJ+R0H6FRvbh+8aaZb42WxCtccgt
StllctwqrgejWFS+ewIDAQAB
-----END PUBLIC KEY-----

Copy the RSA key to public.key file.

[john@vmhostsvr ~]$ cat public.key
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDEvOerlo60HA2CzTAiNUSJ3fQ/
a56d8sxwsQzyuT7GiKs9j4s6YsSnlh+9phrvb16d+zq+ZQtrz9u9S/R2od7iI6UY
8UMTEPTUHnvQaZIXKs+S7IUGlkNnyYvJNjSDgJ+R0H6FRvbh+8aaZb42WxCtccgt
StllctwqrgejWFS+ewIDAQAB
-----END PUBLIC KEY-----

Set user account password (after open Putty SSH tunnel, login to vmhostsvr requires user password)

[john@vmhostsvr ~]$ passwd
  • John transport (scp) the private.key and public.key files to his laptop folder c:\Users/john/pilot, then inform Cindy the location of the public.key on vmhostsvr.
  • Cindy setup access to geoapp1 VM for this key (Note: for Rocks 5.4 or ealier, do NOT specify the key file path with ~, which feeds to a bug that can messed up the host key database. This bug will be fixed in the later version.)
[root@vmhostsvr ~]# rocks add host key geoapp1 key=/export/home/john/pilot-key/public.key

Access and control VM

From John's Windows laptop

  • Start Putty
  • In Session tab, click "pilot tunnel" under "Saved Sessions", click "Load", then click "Open".


For example
Putty4.jpg

  • A terminal window open

Putty3.jpg

  • Login as john in the Putty terminal window
  • Open a Command window on the laptop (Click "Start", then "Command Prompt")
C:\Users\john>cd pilot

To see VM status

C:\Users\john\pilot>pilot.py list host macs host=76:77:6e:40:00:00 key=private.key status=yes
76:77:6e:40:00:00 active  

To power off the VM

C:\Users\john\pilot>pilot.py set host power host=76:77:6e:40:00:00 key=private.key action=off 

To connect to the VM console

C:\Users\john\pilot>pilot.py open host console host=76:77:6e:40:00:00 key=private.key 

Putty5.jpg
To see supported commands

C:\Users\john\pilot>pilot.py
command not recognized

Supported commands are:

        C:\Users\john\pilot\pilot.py create keys key=path-to-private-key-file <passphrase=[yes|no]>

        C:\Users\john\pilot\pilot.py list host macs host=mac-address-of-virtual-frontend key=path-to-private-key-file <status=[yes|no]>

        C:\Users\john\pilot\pilot.py open host console host=mac-address-of-virtual-machine key=path-to-private-key-file

        C:\Users\john\pilot\pilot.py set host power host=mac-address-of-virtual-machine key=path-to-private-key-file action=[on|off|install]