2925 Commits

Author SHA1 Message Date
Brad Fitzpatrick
fd7e7ed5d3 cmd/tailscale: make cert subcommand give hints on access denied
Lot of people have been hitting this.

Now it says:

    $ tailscale cert tsdev.corp.ts.net
    Access denied: cert access denied

    Use 'sudo tailscale cert' or 'tailscale up --operator=$USER' to not require root.

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit f62e6d83a9cdc2dc62d15411aeb45927e916ead4)
2021-10-01 11:04:21 -07:00
Brad Fitzpatrick
349015098d net/tlsdial: bake in LetsEncrypt's ISRG Root X1 root
We still try the host's x509 roots first, but if that fails (like if
the host is old), we fall back to using LetsEncrypt's root and
retrying with that.

tlsdial was used in the three main places: logs, control, DERP. But it
was missing in dnsfallback. So added it there too, so we can run fine
now on a machine with no DNS config and no root CAs configured.

Also, move SSLKEYLOGFILE support out of DERP. tlsdial is the logical place
for that support.

Fixes #1609

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 7cf8ec8108f4e26092bf07f698c8c5ce70d27d13)
2021-10-01 11:04:21 -07:00
Filippo Valsorda
ea2536ab3f net/dns/resolver: add unsecured Quad9 resolvers
DNSSEC is an availability issue, as recently demonstrated by the
Slack issue, with limited security advantage. DoH on the other hand
is a critical security upgrade. This change adds DoH support for the
non-DNSSEC endpoints of Quad9.

https://www.quad9.net/service/service-addresses-and-features#unsec
Signed-off-by: Filippo Valsorda <hi@filippo.io>
(cherry picked from commit d7ce2be5f4588e5451aebc457adf778081e0a114)
2021-10-01 11:04:21 -07:00
Brad Fitzpatrick
db2e9ada10 cmd/tailscale: make cert give hints on usage failure
Like mentioning which cert domain(s) are valid.

(cherry picked from commit 891e7986cce17a3c5ff24047a2e5c6158dd66d67)
(cherry picked from commit b10a55e4ed82a42cc0b46c8c8d87af4d08569e16)

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-01 11:04:18 -07:00
Brad Fitzpatrick
fe5162a366 net/tstun: block looped disco traffic, take 17
It was in the wrong filter direction before, per CPU profiles
we now have.

Updates #1526 (maybe fixes? time will tell)

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 080381c79fa4fa273c486e45edbd7f6cc5ee73ac)
2021-10-01 11:04:18 -07:00
Brad Fitzpatrick
a151ef021d net/tstun: block looped disco traffic
Updates #1526 (maybe fixes? time will tell)

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit dabeda21e0392eaea76643a9e5653ca85d84ce79)
2021-10-01 11:04:18 -07:00
Brad Fitzpatrick
7bb2fd5c76 wgengine/netstack: include DNS.ExtraRecords in DNSMap
So SOCKS5 dialer can dial HTTPS cert names, for instance.

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 29a8fb45d32b562c7b0624a56170978076506a67)
2021-10-01 11:04:18 -07:00
Brad Fitzpatrick
22b881e82b cmd/tailscaled: set StateDirectoryMode=0700 in tailscaled.service
Updates #2934

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 56d8c2da3463801df70a6bf442d0c585dce0f03a)
2021-10-01 11:04:18 -07:00
Brad Fitzpatrick
56f7013628 wgengine/monitor: ignore ipsec link monitor events on iOS/macOS
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 52737c14ac6e411ef768792d03aa985af9d8ed2b)
2021-10-01 11:04:18 -07:00
Brad Fitzpatrick
c293be6434 tstest: backport MemLogger from main
(it was part of things we don't want to cherry-pick)

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-01 11:04:15 -07:00
Denton Gentry
3ff68e6784 VERSION.txt: this is v1.14.5
Signed-off-by: Denton Gentry <dgentry@tailscale.com>
v1.14.5
2021-09-29 20:54:51 -07:00
Brad Fitzpatrick
f121bb0c8a paths: skip unix chmod if state directory is already 0700
Updates #2934

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-09-29 20:45:40 -07:00
Brad Fitzpatrick
1469105ab9 ipn{,/localapi,ipnlocal}: infer cert dir from state file location
This fixes "tailscale cert" on Synology where the var directory is
typically like /volume2/@appdata/Tailscale, or any other tailscaled
user who specifies a non-standard state file location.

This is a interim fix on the way to #2932.

Fixes #2927
Updates #2932

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-09-29 20:45:28 -07:00
Denton Gentry
3020e58f57 VERSION.txt: this is v1.14.4
Signed-off-by: Denton Gentry <dgentry@tailscale.com>
v1.14.4
2021-09-24 15:40:05 -07:00
Aaron Klotz
f3be05e6ea ipn, paths: unconditionally attempt to set state dir perms, but only if the state dir is ours
We unconditionally set appropriate perms on the statefile dir.

We look at the basename of the statefile dir, and if it is "tailscale", then
we set perms as appropriate.

Fixes #2925
Updates #2856

Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2021-09-24 15:12:20 -07:00
Aaron Klotz
6b5081ab31 ipn, paths: ensure that the state directory for Windows has the correct perms
ProgramData has a permissive ACL. For us to safely store machine-wide
state information, we must set a more restrictive ACL on our state directory.
We set the ACL so that only talescaled's user (ie, LocalSystem) and the
Administrators group may access our directory.

We must include Administrators to ensure that logs continue to be easily
accessible; omitting that group would force users to use special tools to
log in interactively as LocalSystem, which is not ideal.

(Note that the ACL we apply matches the ACL that was used for LocalSystem's
AppData\Local).

There are two cases where we need to reset perms: One is during migration
from the old location to the new. The second case is for clean installations
where we are creating the file store for the first time.

Updates #2856

Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2021-09-24 13:55:11 -07:00
Brad Fitzpatrick
7afb4a1f43 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 2db877caa332c8968ee1b1eb08ef40a219ff3eec, but the
files exist from fresh 1.14 installs)

Updates #2856

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-09-24 13:54:24 -07:00
Denton Gentry
4bc90fee03 ipn/ipnserver, paths, logpolicy: move Window config files out of %LocalAppData%
C:\WINDOWS\system32\config\systemprofile\AppData\Local\
is frequently cleared for almost any reason: Windows updates,
System Restore, even various System Cleaner utilities.

The server-state.conf file in AppData\Local could be deleted
at any time, which would break login until the node is removed
from the Admin Panel allowing it to create a new key.

Carefully copy any AppData state to ProgramData at startup.
If copying the state fails, continue to use AppData so at
least there will be connectivity. If there is no state,
use ProgramData.

We also migrate the log.conf file. Very old versions of
Tailscale named the EXE tailscale-ipn, so the log conf was
tailscale-ipn.log.conf and more recent versions preserved
this filename and cmdName in logs. In this migration we
always update the filename to
c:\ProgramData\Tailscale\tailscaled.log.conf

Updates https://github.com/tailscale/tailscale/issues/2856

Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2021-09-24 13:53:28 -07:00
Brad Fitzpatrick
46e42292a5 wgengine: fix link monitor / magicsock Start race
Fixes #2733

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-09-16 22:07:54 -07:00
Denton Gentry
a5b1456410 VERSION.txt: this is v1.14.3
Signed-off-by: Denton Gentry <dgentry@tailscale.com>
v1.14.3
2021-09-16 16:56:31 -07:00
Denton Gentry
27d0e7cb0a net/dnsfallback: add DERP servers
Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2021-09-13 20:46:41 -07:00
Denton Gentry
f0b70ff186 Revert "net/dnsfallback: add DERP servers"
This reverts commit f5d17dae18560075d77f90084ebb3f400b31be39.
2021-09-13 20:46:31 -07:00
Denton Gentry
f5d17dae18 net/dnsfallback: add DERP servers 2021-09-13 18:24:53 -07:00
Denton Gentry
ceaecdd4d5 Revert back to pre-1.14.1 build.
This reverts the following commits:
8704fb308d6109baf9797231c09bcc6af9681771
afb95d7246b3f7776185abf0959544549d425f06
277bf8f48c0e52dd26b36a39ddf88b924927ee72
c995ac72a39dbc3a99ce7752f4a3c996f6fb7d99
e699226e802fed16e5af64d7eaa6c3c4537058bb

We're going to try again to build 1.14.1

Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2021-09-13 18:23:54 -07:00
Denton Gentry
8704fb308d VERSION.txt: this is v1.14.2
I had updated VERSION.txt to 1.14.1, tagged and pushed the tag, then
noticed that continuous integration failed because the list of DERP
servers for emergency DNS fallback needed to be updated.

I tried to revert VERSION.txt, delete the tag, update DERP, and tag
again but it won't import in the next step because the checksum is
wrong. I had deleted the tag and moved it, and something out there
wants none of that funny business.

Honestly I'm kindof glad, gives confidence in the integrity of
the tree.

ANYWAY, 1.14.1 is unusable and we're going to 1.14.2.

Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2021-09-09 19:33:30 -07:00
Denton Gentry
afb95d7246 VERSION.txt: this is v1.14.1
Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2021-09-09 19:27:15 -07:00
Denton Gentry
277bf8f48c net/dnsfallback: add DERP servers 2021-09-09 19:26:18 -07:00
Denton Gentry
c995ac72a3 Revert "VERSION.txt: this is v1.14.1"
Nevermind, that was not 1.14.1 after all
This reverts commit e699226e802fed16e5af64d7eaa6c3c4537058bb.

Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2021-09-09 19:25:37 -07:00
Denton Gentry
e699226e80 VERSION.txt: this is v1.14.1
Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2021-09-09 19:20:38 -07:00
Brad Fitzpatrick
d8e37edb40 safesocket: add connect retry loop to wait for tailscaled
Updates #2708

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 21cb0b361fbbb7580fae8f8a01193b3ec361e56a)
2021-09-01 11:54:21 -07:00
Joe Tsai
0744d75238 tstime/rate: deflake TestLongRunningQPS
This test is highly dependent on the accuracy of OS timers.
Reduce the number of failures by decreasing the required
accuracy from 0.999 to 0.995.
Also, switch from repeated time.Sleep to using a time.Ticker
for improved accuracy.

Updates #2727

Signed-off-by: Joe Tsai <joetsai@digital-static.net>
(cherry picked from commit 30458c71c81a3d680aacecafa67fabc1c728c52d)
2021-08-30 12:20:31 -07:00
Joe Tsai
15835f03b3 util/deephash: fix TestArrayAllocs
Unfortunately this test fails on certain architectures.
The problem comes down to inconsistencies in the Go escape analysis
where specific variables are marked as escaping on certain architectures.
The variables escaping to the heap are unfortunately in crypto/sha256,
which makes it impossible to fixthis locally in deephash.

For now, fix the test by compensating for the allocations that
occur from calling sha256.digest.Sum.

See golang/go#48055

Fixes #2727

Signed-off-by: Joe Tsai <joetsai@digital-static.net>
(cherry picked from commit 3f1317e3e52e63c8aaaf251ae77efc0e4dfe0f6e)
2021-08-30 12:19:30 -07:00
Brad Fitzpatrick
e78ac523da net/interfaces: fix default route lookup on Windows
It wasn't using the right metric. Apparently you're supposed to sum the route
metric and interface metric. Whoops.

While here, optimize a few little things too, not that this code
should be too hot.

Fixes #2707 (at least; probably dups but I'm failing to find)

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 3606e68721d6e11e01b31acfc66e959635bf9926)
2021-08-26 14:51:47 -07:00
David Anderson
15c87017b8 net/portmapper: fix "running a test" condition.
Fixes #2686.

Signed-off-by: David Anderson <danderson@tailscale.com>
(cherry picked from commit b49d9bc74ded7d17b1bedad47b4beac4e4ba3d67)
2021-08-25 22:06:49 -07:00
Brad Fitzpatrick
bd911fdb12 wgengine/netstack: fix crash in userspace netstack TCP forwarding
Fixes #2658

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 1925fb584e3636ca2fe4601e73b34a390793010a)
2021-08-25 15:48:44 -07:00
Brad Fitzpatrick
0111d33eb8 tailcfg,ipn/ipnlocal: support DNSConfig.Routes with empty values [mapver 23]
Fixes #2706
Updates #1235

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 88bd79662225dff0156b1eaab2435070d5b7d978)
2021-08-25 11:42:10 -07:00
Denton Gentry
62a458f7f4 VERSION.txt: this is v1.14.0
Signed-off-by: Denton Gentry <dgentry@tailscale.com>
v1.14.0
2021-08-23 13:36:49 -07:00
Brad Fitzpatrick
37053801bb wgengine/magicsock: restore a bit of logging on node becoming active
Fixes #2695

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-23 12:22:23 -07:00
Brad Fitzpatrick
51976ab3a2 tsweb: add vars for unix process start time and version
To be scraped in the Go expvar JSON format, as a string is involved.

For a future tool to record when processes restarted exactly, and at
what version.

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-23 10:36:28 -07:00
Brad Fitzpatrick
246fa67e56 version: bump date
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-23 09:16:45 -07:00
Brad Fitzpatrick
6990a314f5 hostinfo: set DeviceModel from Linux devicetree model
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-22 21:28:36 -07:00
Brad Fitzpatrick
3ac731dda1 hostinfo: fix earlier git fail, add files lost in move
This was meant to be part of 47045265b9b340418fbfe08e50297dc875e54ce9
which instead deleted them :(

Updates tailscale/corp#1959
2021-08-22 21:14:04 -07:00
Aaditya Chaudhary
71b375c502
api.md: add acl validation docs
Signed-off-by: Aaditya Chaudhary <32117362+AadityaChaudhary@users.noreply.github.com>
2021-08-22 18:27:45 -04:00
David Crawshaw
0ac2130590 net/dns: resolveConfExists reading the wrong error
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2021-08-21 20:15:51 -07:00
Matt Drollette
c1aa5a2e33 ipn/ipnlocal: update requested tags in host info
Fixes #2641

Signed-off-by: Matt Drollette <matt@drollette.com>
2021-08-21 20:07:00 -07:00
Brad Fitzpatrick
f35b8c3ead derp: fix meshing accounting edge case bug
If a peer is connected to multiple nodes in a region (so
multiForwarder is in use) and then a node restarts and re-sends all
its additions, this bug about whether an element is in the
multiForwarder could cause a one-time flip in the which peer node we
forward to.  Note a huge deal, but not written as intended.

Thanks to @lewgun for the bug report in #2141.

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-21 19:54:55 -07:00
Alessandro Mingione
fab296536c words: add more tails and scales
Signed-off-by: Alessandro Mingione <alessandro@tailscale.com>
2021-08-21 16:35:00 -07:00
Denton Gentry
6731f934a6 Revert "wgengine: actively log FlushDNS."
This log is quite verbose, it was only to be left in for one
unstable build to help debug a user issue.

This reverts commit 1dd25520326f0adc1d37c12710c9f33c830a7ef5.

Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2021-08-20 18:12:47 -07:00
Brad Fitzpatrick
47045265b9 hostinfo: add SetDeviceModel setter, move remaining code from controlclient
Updates tailscale/corp#1959

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-20 10:45:22 -07:00
Josh Bleecher Snyder
4ff0757d44 cmd/testcontrol: add test control server
This is useful for manual performance testing
of networks with many nodes.
I imagine it'll grow more knobs over time.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-08-19 17:50:48 -07:00