logpolicy: don't use C:\ProgramData use for tailscale-ipn GUI's log dir

tailscale-ipn.exe (the GUI) shouldn't use C:\ProgramData.

Also, migrate the earlier misnamed wg32/wg64 conf files if they're present.
(That was stopped in 2db877caa3, but the
files exist from fresh 1.14 installs)

Updates #2856

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2021-09-20 15:57:06 -07:00
committed by Brad Fitzpatrick
parent 2db877caa3
commit 7d8227e7a6
3 changed files with 90 additions and 40 deletions

View File

@@ -595,14 +595,14 @@ func (s *server) writeToClients(n ipn.Notify) {
// Returns a string of the path to use for the state file.
// This will be a fallback %LocalAppData% path if migration fails,
// a %ProgramData% path otherwise.
func tryWindowsAppDataMigration(path string) string {
func tryWindowsAppDataMigration(logf logger.Logf, path string) string {
if path != paths.DefaultTailscaledStateFile() {
// If they're specifying a non-default path, just trust that they know
// what they are doing.
return path
}
oldFile := filepath.Join(os.Getenv("LocalAppData"), "Tailscale", "server-state.conf")
return paths.TryConfigFileMigration(oldFile, path)
return paths.TryConfigFileMigration(logf, oldFile, path)
}
// Run runs a Tailscale backend service.
@@ -648,7 +648,7 @@ func Run(ctx context.Context, logf logger.Logf, logid string, getEngine func() (
}
default:
if runtime.GOOS == "windows" {
path = tryWindowsAppDataMigration(path)
path = tryWindowsAppDataMigration(logf, path)
}
store, err = ipn.NewFileStore(path)
if err != nil {