Skip to content
This repository has been archived by the owner on Jan 21, 2023. It is now read-only.

Commit

Permalink
put generated certs into home/.vmproxy folder
Browse files Browse the repository at this point in the history
  • Loading branch information
blacktop committed Mar 19, 2018
1 parent 8427198 commit aa81c2e
Show file tree
Hide file tree
Showing 8 changed files with 208 additions and 6 deletions.
8 changes: 7 additions & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@
[[constraint]]
branch = "master"
name = "github.com/kabukky/httpscerts"

[[constraint]]
branch = "master"
name = "github.com/mitchellh/go-homedir"
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ $ brew services start blacktop/tap/vm-proxy
### Start `VirtualBox` client within Docker

```sh
$ docker run --rm --add-host=dockerhost:$(ipconfig getifaddr en0) blacktop/vbox --help
$ docker run --rm \
--add-host=dockerhost:$(ipconfig getifaddr en0) \
-v $HOME/.vmproxy:/root/.vmproxy \
blacktop/vbox --help

Oracle VM VirtualBox Command Line Management Interface Version 5.0.20
(C) 2005-2016 Oracle Corporation
Expand Down Expand Up @@ -98,7 +101,10 @@ Use "VBoxManage [command] --help" for more information about a command.
#### List `VirtualBox` VMs

```sh
$ docker run --rm --add-host=dockerhost:$(ipconfig getifaddr en0) blacktop/vbox list vms
$ docker run --rm \
--add-host=dockerhost:$(ipconfig getifaddr en0) \
-v $HOME/.vmproxy:/root/.vmproxy \
blacktop/vbox list vms

"win-test_default_1456716033001_71487" {f11be617-b053-4a0f-b22c-59887290ec96}
"malice_dev" {cdb35dc9-31f6-469f-aebf-6f69830f7864}
Expand Down
5 changes: 4 additions & 1 deletion clients/vbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
## Getting Started

```sh
$ docker run --rm --add-host=dockerhost:$(ipconfig getifaddr en0) blacktop/vbox --help
$ docker run --rm \
--add-host=dockerhost:$(ipconfig getifaddr en0) \
-v $HOME/.vmproxy:/root/.vmproxy \
blacktop/vbox --help

Oracle VM VirtualBox Command Line Management Interface Version 5.0.20
(C) 2005-2016 Oracle Corporation
Expand Down
15 changes: 13 additions & 2 deletions server/utils.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
package main

import (
"path/filepath"

"github.com/kabukky/httpscerts"
homedir "github.com/mitchellh/go-homedir"
"github.com/pkg/errors"
)

// GenerateCerts generates SSL certs for vm-proxy server
func GenerateCerts(host string) error {
home, err := homedir.Dir()
if err != nil {
return errors.Wrap(err, "could not detect users home directory")
}

certPath := filepath.Join(home, ".vmproxy", "cert.pem")
keyPath := filepath.Join(home, ".vmproxy", "key.pem")

// Check if the cert files are available.
err := httpscerts.Check("cert.pem", "key.pem")
err = httpscerts.Check(certPath, keyPath)
// If they are not available, generate new ones.
if err != nil {
err = httpscerts.Generate("cert.pem", "key.pem", host)
err = httpscerts.Generate(certPath, keyPath, host)
if err != nil {
return errors.Wrap(err, "could not create https certs")
}
Expand Down
21 changes: 21 additions & 0 deletions vendor/github.com/mitchellh/go-homedir/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions vendor/github.com/mitchellh/go-homedir/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

137 changes: 137 additions & 0 deletions vendor/github.com/mitchellh/go-homedir/homedir.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit aa81c2e

Please sign in to comment.