From 9decde57cc4d3f2efff7879e8d7a0eab0b6fce8a Mon Sep 17 00:00:00 2001 From: dmitri Date: Thu, 22 Sep 2016 13:43:58 +0200 Subject: [PATCH] tctl: do not create datadir/host_uuid if none has been found - if the client runs with elevated permissions and the command fails (for instance, when the auth server state has not yet been generated), it will leave the file behind possibly making further attempts to properly generate content in data directory by a lower-privilege process impossible. --- lib/utils/cli.go | 2 +- tool/tctl/main.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/utils/cli.go b/lib/utils/cli.go index 8a1c09de8c9..ebfdc3fca5c 100644 --- a/lib/utils/cli.go +++ b/lib/utils/cli.go @@ -82,7 +82,7 @@ func InitLoggerForTests() { log.SetOutput(ioutil.Discard) } -// FatalError is for CLI front-ends: it detects gravitational.Trace debugging +// FatalError is for CLI front-ends: it detects gravitational/trace debugging // information, sends it to the logger, strips it off and prints a clean message to stderr func FatalError(err error) { fmt.Fprintln(os.Stderr, UserMessageFromError(err)) diff --git a/tool/tctl/main.go b/tool/tctl/main.go index 727b12cb7c4..d3494d2a2cd 100644 --- a/tool/tctl/main.go +++ b/tool/tctl/main.go @@ -716,11 +716,11 @@ func connectToAuthService(cfg *service.Config) (client *auth.TunClient, err erro return client, nil } -// validateConfig updtes&validates tctl configuration +// validateConfig validates and updates tctl configuration func validateConfig(cfg *service.Config) { var err error - // read or generate a host UUID for this node - cfg.HostUUID, err = utils.ReadOrMakeHostUUID(cfg.DataDir) + // read a host UUID for this node + cfg.HostUUID, err = utils.ReadHostUUID(cfg.DataDir) if err != nil { utils.FatalError(err) }