diff --git a/lib/autoupdate/agent/telemetry.go b/lib/autoupdate/agent/telemetry.go index 4ecdd9b3bb91e..b671132c679ac 100644 --- a/lib/autoupdate/agent/telemetry.go +++ b/lib/autoupdate/agent/telemetry.go @@ -31,9 +31,14 @@ func IsEnabled() (bool, error) { if err != nil { return false, trace.Wrap(err, "cannot find Teleport binary") } - if !strings.HasPrefix(teleportPath, teleportOptDir) { + updaterBasePath := filepath.Clean(teleportOptDir) + "/" + absPath, err := filepath.Abs(teleportPath) + if err != nil { + return false, trace.Wrap(err, "cannot get absolute path for Teleport binary") + } + if !strings.HasPrefix(absPath, updaterBasePath) { return false, nil } systemDir := filepath.Join(teleportOptDir, systemNamespace) - return !strings.HasPrefix(teleportPath, systemDir), nil + return !strings.HasPrefix(absPath, systemDir), nil }