use server and username for certificate subject and issuer

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
Evan Hazlett 2015-01-26 17:56:33 -05:00
parent aae6f74f84
commit d48c0f4157
No known key found for this signature in database
GPG Key ID: A519480096146526
3 changed files with 17 additions and 2 deletions

View File

@ -117,7 +117,8 @@ func (h *Host) ConfigureAuth() error {
caKeyPath := filepath.Join(utils.GetMachineDir(), "key.pem")
serverCertPath := filepath.Join(h.storePath, "server.pem")
serverKeyPath := filepath.Join(h.storePath, "server-key.pem")
org := "docker"
org := h.Name
bits := 2048
log.Debugf("generating server cert: %s", serverCertPath)

View File

@ -16,7 +16,11 @@ func before(c *cli.Context) error {
caKeyPath := c.GlobalString("tls-ca-key")
clientCertPath := c.GlobalString("tls-client-cert")
clientKeyPath := c.GlobalString("tls-client-key")
org := "docker"
org, err := utils.GetUsername()
if err != nil {
return err
}
bits := 2048
if _, err := os.Stat(utils.GetMachineDir()); err != nil {

View File

@ -3,6 +3,7 @@ package utils
import (
"io"
"os"
"os/user"
"path/filepath"
"runtime"
)
@ -26,6 +27,15 @@ func GetMachineClientCertDir() string {
return filepath.Join(GetMachineDir(), ".client")
}
func GetUsername() (string, error) {
u, err := user.Current()
if err != nil {
return "", err
}
return u.Username, nil
}
func CopyFile(src, dst string) error {
in, err := os.Open(src)
if err != nil {