summaryrefslogtreecommitdiffhomepage
path: root/cmd
AgeCommit message (Collapse)AuthorFilesLines
2022-03-20cmd/tailscale, ipn/ipn{local,server}: add start of CLI admin API + over Noisebradfitz/cli_adminBrad Fitzpatrick3-1/+233
Change-Id: I2936f6baf50e7eeac7190051adba493d4245b3ea Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-03-19all: use strings.Cut even moreBrad Fitzpatrick1-3/+1
Change-Id: I943ce72c6f339589235bddbe10d07799c4e37979 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-03-18net/tshttpproxy: ensure we pass the correct flags to WinHttpOpen on Win7 and ↵Aaron Klotz2-25/+26
Win8.0 The best flag to use on Win7 and Win8.0 is deprecated in Win8.1, so we resolve the flag depending on OS version info. Fixes https://github.com/tailscale/tailscale/issues/4201 Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2022-03-18cmd/tailscaled: make build fail nicely on older Go versionsBrad Fitzpatrick9-3/+34
Due to a bug in Go (golang/go#51778), cmd/go doesn't warn about your Go version being older than the go.mod's declared Go version in that case that package loading fails before the build starts, such as when you use packages that are only in the current version of Go, like our use of net/netip. This change works around that Go bug by adding build tags and a pre-Go1.18-only file that will cause Go 1.17 and earlier to fail like: $ ~/sdk/go1.17/bin/go install ./cmd/tailscaled # tailscale.com/cmd/tailscaled ./required_version.go:11:2: undefined: you_need_Go_1_18_to_compile_Tailscale note: module requires Go 1.18 Change-Id: I39f5820de646703e19dde448dd86a7022252f75c Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-03-17all: use any instead of interface{}Josh Bleecher Snyder8-26/+26
My favorite part of generics. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2022-03-17syncs: use TryLock and TryRLock instead of unsafeJosh Bleecher Snyder2-2/+2
The docs say: Note that while correct uses of TryLock do exist, they are rare, and use of TryLock is often a sign of a deeper problem in a particular use of mutexes. Rare code! Or bad code! Who can tell! Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2022-03-17cmd/tailscaled: fail early with nice error on macOS with go1.18Brad Fitzpatrick1-0/+3
Due to golang/go#51759 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-03-16cmd/derpprobe: don't alert for smaller failures.Denton Gentry1-1/+80
There is a Cosmic Background level of DERP Unreachability, with individual nodes or regions becoming unreachable briefly and returning a short time later. This is due to hosting provider outages or just the Internet sloshing about. Returning a 500 error pages a human. Being awoken at 3am for a transient error is annoying. For relatively small levels of badness don't page a human, just post to Slack. If the outage impacts a significant fraction of the DERP fleet, then page a human. Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2022-03-16go.mod: update to latest certstoreJosh Bleecher Snyder1-0/+2
It includes a fix to allow us to use Go 1.18. We can now remove our Tailscale-only build tags. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2022-03-16version: use Go 1.18's git stamping as default implementationBrad Fitzpatrick1-1/+1
No more manual version bumps! Fixes #81 Change-Id: I3a9e544a7248f0b83bcbacbaabbc4dabc435e62d Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-03-16control/controlclient: only build certstore-related code with the Tailscale ↵Josh Bleecher Snyder1-2/+0
Go toolchain The certstore code is impacted by golang/go#51726. The Tailscale Go toolchain fork contains a temporary workaround, so it can compile it. Once the upstream toolchain can compile certstore, presumably in Go 1.18.1, we can revert this change. Note that depaware runs with the upstream toolchain. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2022-03-16wgengine/magicsock: remove final alloc from ReceiveFromJosh Bleecher Snyder1-1/+2
And now that we don't have to play escape analysis and inlining games, simplify the code. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2022-03-16go.mod: require Go 1.18Josh Bleecher Snyder2-2/+3
Also, update depaware for Go 1.18's dependency tree. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2022-03-16cmd/tailscale: add file get options for dealing with existing filesDavid Eger1-28/+116
A new flag --conflict=(skip|overwrite|rename) lets users specify what to do when receiving files that match a same-named file in the target directory. Updates #3548 Signed-off-by: David Eger <david.eger@gmail.com>
2022-03-12go.mod: move from github.com/gliderlabs/ssh to github.com/tailscale/sshMaisem Ali2-5/+5
Updates #4146 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2022-03-11ssh/tailssh: make pty termios options match OpenSSHBrad Fitzpatrick1-0/+1
Still not sure the exact rules of how/when/who's supposed to set these, but this works for now on making them match. Baby steps. Will research more and adjust later. Updates #4146 (but not enough to fix it, something's still wrong) Updates #3802 Change-Id: I496d8cd7e31d45fe9ede88fc8894f35dc096de67 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-03-10cmd/tailscale/cli, ipn: move exit node IP parsing and validation from cli ↵Aaron Klotz2-209/+13
into prefs. We need to be able to provide the ability for the GUI clients to resolve and set the exit node IP from an untrusted string, thus enabling the ability to specify that information via enterprise policy. This patch moves the relevant code out of the handler for `tailscale up`, into a method on `Prefs` that may then be called by GUI clients. We also update tests accordingly. Updates https://github.com/tailscale/corp/issues/4239 Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2022-03-09cmd/tailscale: allow use of flags in gokrazyJoonas Kuorilehto1-7/+12
Enable use of command line arguments with tailscale cli on gokrazy. Before this change using arguments like "up" would cause tailscale cli to be repeatedly restarted by gokrazy process supervisor. We never want to have gokrazy restart tailscale cli, even if user would manually start the process. Expected usage is that user creates files: flags/tailscale.com/cmd/tailscale/flags.txt: up flags/tailscale.com/cmd/tailscaled/flags.txt: --statedir=/perm/tailscaled/ --tun=userspace-networking Then tailscale prints URL for user to log in with browser. Alternatively it should be possible to use up with auth key to allow unattended gokrazy installs. Signed-off-by: Joonas Kuorilehto <joneskoo@derbian.fi>
2022-03-08ssh/tailssh: create login sessions for new connectionsMaisem Ali1-1/+2
Signed-off-by: Maisem Ali <maisem@tailscale.com>
2022-03-08cmd/derper: add --stun-port flagBrad Fitzpatrick1-4/+5
And flesh out docs on the --http-port flag. Change-Id: If9d42665f67409082081cb9a25ad74e98869337b Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-03-07control/controlclient: add Noise clientMaisem Ali1-3/+5
Updates #3488 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2022-03-01cmd/tailscale: tell gokrazy to not manage the CLI as a daemonBrad Fitzpatrick1-0/+7
In the future we'll probably want to run the "tailscale web" server instead, but for now stop the infinite restart loop. See https://gokrazy.org/userguide/process-interface/ for details. Updates #1866 Change-Id: I4133a5fdb859b848813972620495865727fe397a Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-03-01cmd/tailscaled: default to userspace-networking mode on gokrazy, set pathsBrad Fitzpatrick1-1/+17
One of the current few steps to run Tailscale on gokrazy is to specify the --tun=userspace-networking flag: https://gokrazy.org/userguide/install/tailscale/ Instead, make it the default for now. Later we can change the default to kernel mode if available and fall back to userspace mode like Synology, once #391 is done. Likewise, set default paths for Gokrazy, as its filesystem hierarchy is not the Linux standard one. Instead, use the conventional paths as documented at https://gokrazy.org/userguide/install/tailscale/. Updates #1866 RELNOTE=default to userspace-networking mode on gokrazy Change-Id: I3766159a294738597b4b30629d2860312dbb7609 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-02-28net/interfaces: get Linux default route from netlink as fallbackBrad Fitzpatrick2-1/+8
If it's in a non-standard table, as it is on Unifi UDM Pro, apparently. Updates #4038 (probably fixes, but don't have hardware to verify) Change-Id: I2cb9a098d8bb07d1a97a6045b686aca31763a937 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-02-28ipn/store: add common package for instantiating ipn.StateStoresMaisem Ali4-17/+20
Also move KubeStore and MemStore into their own package. RELNOTE: tsnet now supports providing a custom ipn.StateStore. Signed-off-by: Maisem Ali <maisem@tailscale.com>
2022-02-27net/tstun: set link speed to SPEED_UNKNOWNDmytro Shynkevych1-0/+1
Fixes #3933. Signed-off-by: Dmytro Shynkevych <dm.shynk@gmail.com>
2022-02-24cmd/tailscaled: add a no-op test for profiling init-time memory allocsBrad Fitzpatrick1-0/+13
Turns out we're pretty good already at init-time work in tailscaled. The regexp/syntax shows up but it's hard to get rid of that; zstd even uses regexp. *shrug* Change-Id: I856aca056dcb7489f5fc22ef07f55f34ddf19bd6 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-02-24cmd/tailscaled/childproc: add be-child registration mechanismBrad Fitzpatrick3-0/+37
For ssh and maybe windows service babysitter later. Updates #3802 Change-Id: I7492b98df98971b3fb72d148ba92c2276cca491f Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-02-24ssh: make it build on darwinBrad Fitzpatrick1-7/+7
For local dev testing initially. Product-wise, it'll probably only be workable on the two unsandboxed builds. Updates #3802 Change-Id: Ic352f966e7fb29aff897217d79b383131bf3f92b Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-02-23net/dns: ignore permission errors on Synology DSM7 for nowBrad Fitzpatrick1-1/+14
Updates #4017 Change-Id: Ia7fd4df47588c010dea8e63d88f397cc8eb748e5 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-02-23cmd/tailscale: make configure-host on Synology also add CAP_NET_RAWBrad Fitzpatrick1-1/+1
Updates #4012 Change-Id: Ic45b5709a73b4f1cd466823e177b52d1d20ba84e Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-02-22hostinfo: use the sentinel value set by the MSI installer to detect MSI ↵Aaron Klotz1-0/+2
package type The MSI installer sets a special sentinel value that we can use to detect it. I also removed the code that bails out when the installation path is not `Program Files`, as both the NSIS and MSI installers permit the user to install to a different path. Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2022-02-22ipn/ipnlocal: use views for Peer.PrimaryRoutes and Peer.TagsMaisem Ali2-2/+2
RELNOTE=`tailscale status --json` now shows Tags and PrimaryRoutes Signed-off-by: Maisem Ali <maisem@tailscale.com>
2022-02-20cmd/tailscale: add "tailscale debug hostinfo" subcommandBrad Fitzpatrick1-0/+13
Change-Id: Ifa09364d42e0516fdf80feddaf33c95880228049 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-02-18cmd/tailscaled: add `-state=mem:` to support creation of an ephemeral node.Maisem Ali1-1/+13
RELNOTE=`tailscaled --state=mem:` registers as an ephemeral node and does not store state to disk. Signed-off-by: Maisem Ali <maisem@tailscale.com>
2022-02-17cmd/tailscale: rewrite --authkey to --auth-keyJosh Bleecher Snyder4-5/+55
That way humans don't have to remember which is correct. RELNOTE=--auth-key is the new --authkey, but --authkey still works Updates tailscale/corp#3486 Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2022-02-16tailcfg: make Node.Hostinfo a HostinfoViewMaisem Ali4-4/+23
Signed-off-by: Maisem Ali <maisem@tailscale.com>
2022-02-15ssh/tailssh: move SSH code from wgengine/netstack to this new packageBrad Fitzpatrick1-3/+4
Still largely incomplete, but in a better home now. Updates #3802 Change-Id: I46c5ffdeb12e306879af801b06266839157bc624 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-02-14net/dns/resolvconffile: unify three /etc/resolv.conf parsers into new packageBrad Fitzpatrick1-0/+1
Change-Id: I2120893ca802d12f1bd0407d49077d3672627d33 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-02-13net/netutil: unify two oneConnListeners into a new packageBrad Fitzpatrick1-0/+1
I was about to add a third copy, so unify them now instead. Change-Id: I3b93896aa1249b1250a6b1df4829d57717f2311a Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-02-11cmd/derper: fix regression from bootstrap DNS optimizationBrad Fitzpatrick1-1/+1
The commit b9c92b90db08bbcb7c726c307d2c7b2590278953 earlier today caused a regression of serving an empty map always, as it was JSON marshalling an atomic.Value instead of the DNS entries map it just built. Change-Id: I9da3eeca132c6324462dedeaa7d002908557384b Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-02-11Revert "cmd/derper: stop setting content header in handleBootstrapDNS"Josh Bleecher Snyder1-0/+1
Didn't help enough. We are setting another header anyway. Restore it. This reverts commit 60abeb027b700e7fa40aa815da8a08383372aca7. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2022-02-11cmd/derper: close connections once bootstrap DNS has been servedJosh Bleecher Snyder1-0/+4
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2022-02-11cmd/derper: stop setting content header in handleBootstrapDNSJosh Bleecher Snyder1-1/+0
No one really cares. Its cost outweighs its usefulness. name old time/op new time/op delta HandleBootstrapDNS-10 105ns ± 4% 65ns ± 2% -37.68% (p=0.000 n=15+14) name old alloc/op new alloc/op delta HandleBootstrapDNS-10 416B ± 0% 0B -100.00% (p=0.000 n=15+15) name old allocs/op new allocs/op delta HandleBootstrapDNS-10 3.00 ± 0% 0.00 -100.00% (p=0.000 n=15+15) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2022-02-11cmd/derper: optimize handleBootstrapDNSJosh Bleecher Snyder1-16/+10
Do json formatting once, rather than on every request. Use an atomic.Value. name old time/op new time/op delta HandleBootstrapDNS-10 6.35µs ± 0% 0.10µs ± 4% -98.35% (p=0.000 n=14+15) name old alloc/op new alloc/op delta HandleBootstrapDNS-10 3.20kB ± 0% 0.42kB ± 0% -86.99% (p=0.000 n=12+15) name old allocs/op new allocs/op delta HandleBootstrapDNS-10 41.0 ± 0% 3.0 ± 0% -92.68% (p=0.000 n=15+15) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2022-02-11cmd/derper: add BenchmarkHandleBootstrapDNSJosh Bleecher Snyder1-0/+35
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2022-02-11cmd/derper: add a rate limiter for accepting new connection (#3908)Joe Tsai1-1/+66
A large influx of new connections can bring down DERP since it spins off a new goroutine for each connection, where each routine may do significant amount of work (e.g., allocating memory and crunching numbers for TLS crypto). The momentary spike can cause the process to OOM. This commit sets the groundwork for limiting connections, but leaves the limit at infinite by default. Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2022-02-09cmd/tailscaled, util/winutil: add accessor functions for Windows system ↵Aaron Klotz1-1/+1
policies. This patch adds new functions to be used when accessing system policies, and revises callers to use the new functions. They first attempt the new registry path for policies, and if that fails, attempt to fall back to the legacy path. We keep non-policy variants of these functions because we should be able to retain the ability to read settings from locations that are not exposed to sysadmins for group policy edits. The remaining changes will be done in corp. Updates https://github.com/tailscale/tailscale/issues/3584 Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2022-02-08cmd/tailscale: add "tailscale configure-host" to prep a Synology machine at bootBrad Fitzpatrick3-1/+90
Updates #3761 Change-Id: Ib5ab9a4808ade074f48d3abee22c57d7670f9e21 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-01-31cmd/derper: make --stun default to on, flesh out flag docsBrad Fitzpatrick1-2/+3
Change-Id: I49e80c61ab19e78e4c8b4bc9012bb70cfe3bfa75 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>