Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add guest tools framework #1257

Merged
merged 1 commit into from
Jul 1, 2016
Merged

Add guest tools framework #1257

merged 1 commit into from
Jul 1, 2016

Conversation

dougm
Copy link
Member

@dougm dougm commented Jun 29, 2016

Initial version to support vmware-tools "lite" in pure Go.

Towards:

Issue #742
Issue #407
Issue #406

@caglar10ur
Copy link
Contributor

👯 👯 👯


s.wg.Add(1)
go func() {
defer s.wg.Done()
Copy link
Contributor

@casualjim casualjim Jun 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@dougm dougm force-pushed the toolbox branch 3 times, most recently from 4a51de9 to 7da5621 Compare June 29, 2016 16:07
@dougm
Copy link
Member Author

dougm commented Jun 29, 2016

I haven't tried within tether/container VM yet. Have tested cmd/toolbox on Ubuntu (devbox on ESX), just requires that you turn off the existing tools first:

sudo service open-vm-tools stop

I used debian to test a VM that doesn't have tools pre-installed:

govc datastore.upload debian-live-8.5.0-amd64-standard.iso debian-live.iso
govc vm.create -iso debian-live.iso debian-live
govc vm.vnc -enable -port -1 -password 6b33546b debian-live | awk '{print $NF}' | xargs open

Within the VNC console, boot live debian (user/pass is user/live).

/sbin/ifconfig # see your current IP
ssh-keygen
cat .ssh/id_rsa.pub > .ssh/authorized_keys
scp .ssh/id_rsa your-machine:debian-id

On your-machine:

ssh-add debian-id
scp $GOPATH/bin/toolbox debian-ip
ssh debian-ip sudo ./toolbox # start tools-lite

See tools-lite in action:

govc vm.ip debian-live
192.168.247.243

govc guest.start -vm debian-live -l user:pass kill SIGHUP
-1

You'll see the following toolbox trace output:

ignoring credentials: 'user:pass'
guest-command: kill SIGHUP
SEND 10...
00000000  4f 4b 20 30 20 30 20 2d  31 00                    |OK 0 0 -1.|

vixPropertyTypeBlob
)

const (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add some comments to explain where are those coming from?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the [Vv]ix constants are from vix.h, I was thinking about moving them all to a vix.go. Maybe even generate vix.go from vix.h, but there's a bunch that we don't need.

@caglar10ur
Copy link
Contributor

LGTM 🐑 🇮🇹

@@ -0,0 +1,71 @@
// Copyright 2016 VMware, Inc. All Rights Reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is linux specific given the vmw-guestinfo package - should it be backdoor_linux.go?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file does compile and run on Darwin as well, tho if you run cmd/toolbox/main.go it'll bail with an error "not in a virtual world" - but in theory that wouldn't happen if run within a VM. Likewise for Windows.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

however the bdoor package doesn't build on Windows.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, the code in sigma/bdoor is unix only. I've added a tag for now so backdoor.go isn't built on windows:

// +build !windows

We can look at porting bdoor to windows in the future and/or use Go asm instead of cgo.

@hickeng
Copy link
Member

hickeng commented Jun 29, 2016

LGTM
We need to be careful not to allow direct command execution in the containerVMs.
Do you have a plan for how to register a callback on message so tether can validate and perform the kill?

@dougm
Copy link
Member Author

dougm commented Jun 30, 2016

@hickeng this PR doesn't support execution of arbitrary commands. See cmd/toolbox/main.go, the example sets vix.ProcessStartCommand to just print the command path and args. So the tether can set this func to only handle a pseudo 'kill' command. We could also make use of the name/pass credentials to validate, but that is currently ignored.

@hickeng
Copy link
Member

hickeng commented Jun 30, 2016

Not sure why LGTM isn't picked up

Initial version to support vmware-tools "lite" in pure Go.

Towards:

Issue vmware#742
Issue vmware#407
Issue vmware#406
@dougm
Copy link
Member Author

dougm commented Jul 1, 2016

rebased

@dougm dougm merged commit 03c7f04 into vmware:master Jul 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants