Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

envknob, hostinfo, ipn/ipnlocal: add start of opt-in remote update support #7031

Merged
merged 1 commit into from
Jan 23, 2023

Conversation

bradfitz
Copy link
Member

Updates #6907

@bradfitz
Copy link
Member Author

Rebased. PTAL.

Copy link
Member

@andrew-d andrew-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! The double opt-in is great from a security perspective 👍

return
}
res.Started = true
defer cmd.Wait()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be a race condition here on Windows:

  1. We start the update process
  2. tailscale.exe copies itself and kicks off the update process
  3. msiexec stops this process during the update before the selfCopy exits(?)
  4. This doesn't return because the process is dead

This seems fairly unlikely, but worth flagging?

return
}

func findCmdTailscale() (string, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the safe way to do this; not relying on $PATH but checking the location where everything is expected to be 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment to that effect lest somebody add a PATH check later.

@@ -77,3 +88,92 @@ func (b *LocalBackend) handleC2N(w http.ResponseWriter, r *http.Request) {
http.Error(w, "unknown c2n path", http.StatusBadRequest)
}
}

func (b *LocalBackend) handleC2NUpdate(w http.ResponseWriter, r *http.Request) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought for the future: we may want some sort of semaphore that prevents two concurrent updates, or if one happened in the past 5 minutes, or something.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added TODO with that text

ipn/ipnlocal/c2n.go Outdated Show resolved Hide resolved
ipn/ipnlocal/c2n.go Outdated Show resolved Hide resolved
…pport

Updates #6907

Change-Id: I85db4f6f831dd5ff7a9ef4bfa25902607e0c1558
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
@bradfitz bradfitz merged commit b6aa1c1 into main Jan 23, 2023
@bradfitz bradfitz deleted the bradfitz/remote_update branch January 23, 2023 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants