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 check binary owner on PreCreateCheck() #75

Merged
merged 2 commits into from
Jan 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ If you were doubt problem either, please post to this repository [issues](https:

## Install

Use [Homebrew/homebrew](https://github.com/Homebrew/homebrew),

```bash
$ brew install docker-machine-driver-xhyve

# docker-machine-driver-xhyve need root owner and uid
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
```

Use `go get`,

```bash
# Need Go 1.5 vendoring support
$ export GO15VENDOREXPERIMENT=1
Expand Down
10 changes: 10 additions & 0 deletions xhyve/xhyve.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,16 @@ func (d *Driver) PreCreateCheck() error {
ver +
"\n\t Please upgrade to version 5 at https://www.virtualbox.org/wiki/Downloads")
}

// Check binary owner
bin, err := os.Stat(os.Args[0])
if err != nil {
return err
}
if int(bin.Sys().(*syscall.Stat_t).Uid) == 501 {
return fmt.Errorf("%s need root owner. See https://github.com/zchee/docker-machine-driver-xhyve#install", os.Args[0])
}

return nil
}

Expand Down