summaryrefslogtreecommitdiffhomepage
path: root/hostinfo
AgeCommit message (Collapse)AuthorFilesLines
2026-01-27hostinfo: retrieve OS version for Macs running the OSS clientAlex Chan1-0/+17
Updates #18520 Change-Id: If86a1f702c704b003002aa7e2f5a6b1418b469cc Signed-off-by: Alex Chan <alexc@tailscale.com>
2026-01-23all: remove AUTHORS file and references to itWill Norris11-11/+11
This file was never truly necessary and has never actually been used in the history of Tailscale's open source releases. A Brief History of AUTHORS files --- The AUTHORS file was a pattern developed at Google, originally for Chromium, then adopted by Go and a bunch of other projects. The problem was that Chromium originally had a copyright line only recognizing Google as the copyright holder. Because Google (and most open source projects) do not require copyright assignemnt for contributions, each contributor maintains their copyright. Some large corporate contributors then tried to add their own name to the copyright line in the LICENSE file or in file headers. This quickly becomes unwieldy, and puts a tremendous burden on anyone building on top of Chromium, since the license requires that they keep all copyright lines intact. The compromise was to create an AUTHORS file that would list all of the copyright holders. The LICENSE file and source file headers would then include that list by reference, listing the copyright holder as "The Chromium Authors". This also become cumbersome to simply keep the file up to date with a high rate of new contributors. Plus it's not always obvious who the copyright holder is. Sometimes it is the individual making the contribution, but many times it may be their employer. There is no way for the proejct maintainer to know. Eventually, Google changed their policy to no longer recommend trying to keep the AUTHORS file up to date proactively, and instead to only add to it when requested: https://opensource.google/docs/releasing/authors. They are also clear that: > Adding contributors to the AUTHORS file is entirely within the > project's discretion and has no implications for copyright ownership. It was primarily added to appease a small number of large contributors that insisted that they be recognized as copyright holders (which was entirely their right to do). But it's not truly necessary, and not even the most accurate way of identifying contributors and/or copyright holders. In practice, we've never added anyone to our AUTHORS file. It only lists Tailscale, so it's not really serving any purpose. It also causes confusion because Tailscalars put the "Tailscale Inc & AUTHORS" header in other open source repos which don't actually have an AUTHORS file, so it's ambiguous what that means. Instead, we just acknowledge that the contributors to Tailscale (whoever they are) are copyright holders for their individual contributions. We also have the benefit of using the DCO (developercertificate.org) which provides some additional certification of their right to make the contribution. The source file changes were purely mechanical with: git ls-files | xargs sed -i -e 's/\(Tailscale Inc &\) AUTHORS/\1 contributors/g' Updates #cleanup Change-Id: Ia101a4a3005adb9118051b3416f5a64a4a45987d Signed-off-by: Will Norris <will@tailscale.com>
2025-04-14hostinfo, ipnlocal: add optional os-specific callback for querying the ↵Jonathan Nobels2-1/+48
hostname (#15647) updates tailscale/tailscale#13476 On darwin, os.Hostname is no longer reliable when called from a sandboxed process. To fix this, we will allow clients to set an optional callback to query the hostname via an alternative native API. We will leave the default implementation as os.Hostname since this works perfectly well for almost everything besides sandboxed darwin clients. Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
2025-04-02all: use network less when running in v86 emulatorBrad Fitzpatrick2-2/+51
Updates #5794 Change-Id: I1d8b005a1696835c9062545f87b7bab643cfc44d Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-01-22feature/*: make Wake-on-LAN conditional, start supporting modular featuresBrad Fitzpatrick2-108/+13
This pulls out the Wake-on-LAN (WoL) code out into its own package (feature/wakeonlan) that registers itself with various new hooks around tailscaled. Then a new build tag (ts_omit_wakeonlan) causes the package to not even be linked in the binary. Ohter new packages include: * feature: to just record which features are loaded. Future: dependencies between features. * feature/condregister: the package with all the build tags that tailscaled, tsnet, and the Tailscale Xcode project extension can empty (underscore) import to load features as a function of the defined build tags. Future commits will move of our "ts_omit_foo" build tags into this style. Updates #12614 Change-Id: I9c5378dafb1113b62b816aabef02714db3fc9c4a Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-01-08hostinfo: improve accuracy of Linux desktop detection heuristicBrad Fitzpatrick1-1/+0
DBus doesn't imply desktop. Updates #1708 Change-Id: Id43205aafb293533119256adf372a7d762aa7aca Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-12-09hostinfo: fix testing in container (#14330)Tom Proctor1-3/+7
Previously this unit test failed if it was run in a container. Update the assert to focus on exactly the condition we are trying to assert: the package type should only be 'container' if we use the build tag. Updates #14317 Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
2024-11-05types/result, util/lineiter: add package for a result type, use itBrad Fitzpatrick2-17/+20
This adds a new generic result type (motivated by golang/go#70084) to try it out, and uses it in the new lineutil package (replacing the old lineread package), changing that package to return iterators: sometimes over []byte (when the input is all in memory), but sometimes iterators over results of []byte, if errors might happen at runtime. Updates #12912 Updates golang/go#70084 Change-Id: Iacdc1070e661b5fb163907b1e8b07ac7d51d3f83 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-10-15hostinfo,build_docker.sh,tailcfg: more reliably detect being in a container ↵Tom Proctor3-3/+34
(#13826) Our existing container-detection tricks did not work on Kubernetes, where Docker is no longer used as a container runtime. Extends the existing go build tags for containers to the other container packages and uses that to reliably detect builds that were created by Tailscale for use in a container. Unfortunately this doesn't necessarily improve detection for users' custom builds, but that's a separate issue. Updates #13825 Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
2024-10-04hostinfo: update SetPackage doc with new Android values (#13537)kari-ts1-2/+7
Fixes tailscale/corp#23283 Signed-off-by: kari-ts <kari@tailscale.com>
2024-08-09hostinfo: add hostinfo.IsNATLabGuestVMBrad Fitzpatrick1-0/+13
And don't make guests under vnet/natlab upload to logcatcher, as there won't be a valid cert anyway. Updates #13038 Change-Id: Ie1ce0139788036b8ecc1804549a9b5d326c5fef5 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-17hostinfo: set Hostinfo.PackageType for mkctr container buildsBrad Fitzpatrick2-0/+17
Fixes tailscale/corp#21448 Change-Id: Id60fb5cd7d31ef94cdbb176141e034845a480a00 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-06-18hostinfo: update Windows hostinfo to include MSIDist registry valueAaron Klotz1-12/+10
We need to expand our enviornment information to include info about the Windows store. Thinking about future plans, it would be nice to include both the packaging mechanism and the distribution mechanism. In this PR we change packageTypeWindows to check a new registry value named MSIDist, and concatenate that value to "msi/" when present. We also remove vestigial NSIS detection. Updates https://github.com/tailscale/corp/issues/2790 Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2024-04-18hostinfo: use Distro field for distinguishing Windows Server buildsAaron Klotz1-0/+10
Some editions of Windows server share the same build number as their client counterpart; we must use an additional field found in the OS version information to distinguish between them. Even though "Distro" has Linux connotations, it is the most appropriate hostinfo field. What is Windows Server if not an alternate distribution of Windows? This PR populates Distro with "Server" when applicable. Fixes #11785 Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2024-04-02hostinfo: cache device model to speed up initKyle Carberry2-10/+18
This was causing a relatively consistent ~10ms of delay on Linux. Signed-off-by: Kyle Carberry <kyle@carberry.com>
2023-11-01hostinfo: fix a couple of logic simplification lintsJames Tucker1-8/+2
Updates #cleanup Signed-off-by: James Tucker <james@tailscale.com>
2023-10-23ipn/ipnlocal: set the push device token correctlyMaisem Ali1-16/+6
It would end up resetting whatever hostinfo we had constructed and leave the backend statemachine in a broken state. This fixes that by storing the PushDeviceToken on the LocalBackend and populating it on Hostinfo before passing it to controlclient. Updates tailscale/corp#8940 Updates tailscale/corp#15367 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-10-05hostinfo, ipnlocal: flesh out Wake-on-LAN support, send MACs, add c2n senderBrad Fitzpatrick2-0/+107
This optionally uploads MAC address(es) to control, then adds a c2n handler so control can ask a node to send a WoL packet. Updates #306 RELNOTE=now supports waking up peer nodes on your LAN via Wake-on-LAN packets Change-Id: Ibea1275fcd2048dc61d7059039abfbaf1ad4f465 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-09-26winutil: refactor methods to get values from registry to also return (#9536)Claire Wang1-1/+2
errors Updates tailscale/corp#14879 Signed-off-by: Claire Wang <claire@tailscale.com>
2023-08-15tailcfg: Add FirewallMode to NetInfo to record wether host using iptables or ↵KevinLiang101-0/+11
nftables To record wether user is using iptables or nftables after we add support to nftables on linux, we are adding a field FirewallMode to NetInfo in HostInfo to reflect what firewall mode the host is running, and form metrics. The information is gained from a global constant in hostinfo.go. We set it when selection heuristic made the decision, and magicsock reports this to control. Updates: tailscale/corp#13943 Signed-off-by: KevinLiang10 <kevinliang@tailscale.com>
2023-08-11hostinfo: add Home Assistant Add-On detection (#8857)shayne1-9/+20
Fixes #8856 Signed-off-by: Shayne Sweeney <shayne@tailscale.com>
2023-06-26hostinfo: make lxcfs container check more specificAnton Tolchanov1-1/+1
Instead of treating any lxcfs mount as an indicator that we're running in a container, check for one of the mounts actually used by LXC containers. For reference, here's a list of mounts I am seeing in an LXC container: ``` $ grep lxcfs /proc/mounts lxcfs /proc/cpuinfo fuse.lxcfs rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other 0 0 lxcfs /proc/diskstats fuse.lxcfs rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other 0 0 lxcfs /proc/loadavg fuse.lxcfs rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other 0 0 lxcfs /proc/meminfo fuse.lxcfs rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other 0 0 lxcfs /proc/stat fuse.lxcfs rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other 0 0 lxcfs /proc/swaps fuse.lxcfs rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other 0 0 lxcfs /proc/uptime fuse.lxcfs rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other 0 0 lxcfs /sys/devices/system/cpu/online fuse.lxcfs rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other 0 0 ``` Fixes #8444 Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2023-06-20ssh/tailssh: work around lack of scontext in SELinuxMaisem Ali1-0/+11
Trying to SSH when SELinux is enforced results in errors like: ``` ➜ ~ ssh ec2-user@<ip> Last login: Thu Jun 1 22:51:44 from <ip2> ec2-user: no shell: Permission denied Connection to <ip> closed. ``` while the `/var/log/audit/audit.log` has ``` type=AVC msg=audit(1685661291.067:465): avc: denied { transition } for pid=5296 comm="login" path="/usr/bin/bash" dev="nvme0n1p1" ino=2564 scontext=system_u:system_r:unconfined_service_t:s0 tcontext=unconfined_u:unconfined_r:unconfined_t:s0 tclass=process permissive=0 ``` The right fix here would be to somehow install the appropriate context when tailscale is installed on host, but until we figure out a way to do that stop using the `login` cmd in these situations. Updates #4908 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-05-04various: add detection and Taildrop for UnraidDerek Kaser1-0/+4
Updates tailscale/tailscale#8025 Signed-off-by: Derek Kaser <derek.kaser@gmail.com>
2023-04-19ci: add more lints (#7909)Andrew Dunham1-1/+1
This is a follow-up to #7905 that adds two more linters and fixes the corresponding findings. As per the previous PR, this only flags things that are "obviously" wrong, and fixes the issues found. Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: I8739bdb7bc4f75666a7385a7a26d56ec13741b7c
2023-02-27tailcfg,hostinfo: add App field to identify tsnet usesMaisem Ali1-0/+14
This allows us to differentiate between the various tsnet apps that we have like `golinks` and `k8s-operator`. Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-02-11version: unexport all vars, turn Short/Long into funcsDavid Anderson1-1/+1
The other formerly exported values aren't used outside the package, so just unexport them. Signed-off-by: David Anderson <danderson@tailscale.com>
2023-02-03tailcfg, localapi: plumb device token to serverDavid Crawshaw1-4/+14
Updates tailscale/corp#8940 Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2023-02-01all: update to Go 1.20, use strings.CutPrefix/Suffix instead of our forkBrad Fitzpatrick1-2/+1
Updates #7123 Updates #5309 Change-Id: I90bcd87a2fb85a91834a0dd4be6e03db08438672 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-01-27all: update copyright and license headersWill Norris8-24/+16
This updates all source files to use a new standard header for copyright and license declaration. Notably, copyright no longer includes a date, and we now use the standard SPDX-License-Identifier header. This commit was done almost entirely mechanically with perl, and then some minimal manual fixes. Updates #6865 Signed-off-by: Will Norris <will@tailscale.com>
2023-01-25hostinfo: [windows] check if running via Scoop (#7068)shayne1-0/+5
You can now install Tailscale on Windows via [Scoop](https://scoop.sh). This change adds a check to `packageTypeWindows()`, looking at the exe's path, and checking if it starts with: `C:\User\<NAME>\scoop\apps\tailscale`. If so, it returns `"scoop"` as the package type. Fixes: #6988 Signed-off-by: Shayne Sweeney <shayne@tailscale.com>
2023-01-24hostinfo: add an environment type for ReplitAnton Tolchanov1-0/+12
Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2023-01-23envknob, hostinfo, ipn/ipnlocal: add start of opt-in remote update supportBrad Fitzpatrick1-0/+1
Updates #6907 Change-Id: I85db4f6f831dd5ff7a9ef4bfa25902607e0c1558 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-01-22tailcfg,hostinfo: add Hostinfo.Machine and Hostinfo.GoArchVarBrad Fitzpatrick2-0/+65
For detecting a non-ideal binary running on the current CPU. And for helping detect the best Synology package to update to. Updates #6995 Change-Id: I722f806675b60ce95364471b11c388150c0d4aea Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-11-30types/ptr: move all the ptrTo funcs to one new package's ptr.ToBrad Fitzpatrick4-9/+11
Change-Id: Ia0b820ffe7aa72897515f19bd415204b6fe743c7 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-11-04all: remove old +build tagsBrad Fitzpatrick4-4/+0
The //go:build syntax was introduced in Go 1.17: https://go.dev/doc/go1.17#build-lines gofmt has kept the +build and go:build lines in sync since then, but enough time has passed. Time to remove them. Done with: perl -i -npe 's,^// \+build.*\n,,' $(git grep -l -F '+build') Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-09-15refactor: move from io/ioutil to io and os packagesEng Zer Jun1-5/+4
The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Reference: https://golang.org/doc/go1.16#ioutil Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-09-13cmd/tailscaled, tailcfg, hostinfo: add flag to disable logging + supportBrad Fitzpatrick1-15/+17
As noted in #5617, our documented method of blocking log.tailscale.io DNS no longer works due to bootstrap DNS. Instead, provide an explicit flag (--no-logs-no-support) and/or env variable (TS_NO_LOGS_NO_SUPPORT=true) to explicitly disable logcatcher uploads. It also sets a bit on Hostinfo to say that the node is in that mode so we can end any support tickets from such nodes more quickly. This does not yet provide an easy mechanism for users on some platforms (such as Windows, macOS, Synology) to set flags/env. On Linux you'd used /etc/default/tailscaled typically. Making it easier to set flags for other platforms is tracked in #5114. Fixes #5617 Fixes tailscale/corp#1475 Change-Id: I72404e1789f9e56ec47f9b7021b44c025f7a373a Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-09-12hostinfo: detect being run in a container in more waysBrad Fitzpatrick1-0/+9
Change-Id: I038ff7705ba232e6cf8dcc9775357ef708d43762 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-09-11hostinfo, tailcfg: split Hostinfo.OSVersion into separate fieldsBrad Fitzpatrick5-93/+172
Stop jamming everything into one string. Fixes #5578 Change-Id: I7dec8d6c073bddc7dc5f653e3baf2b4bf6b68378 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-08-26tailcfg: add Hostinfo.GoVersionBrad Fitzpatrick1-0/+1
So next time something like #5340 happens we can identify all affected nodes and have the control plane send them health warnings. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-08-05hostinfo, net/netcheck: use CutPrefixBrad Fitzpatrick1-1/+2
Updates #5309 Change-Id: I37e594cfd245784bf810c493de68a66d3ff20677 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-08-04all: use syncs.AtomicValueMaisem Ali1-3/+3
Signed-off-by: Maisem Ali <maisem@tailscale.com>
2022-07-22hostinfo: determine QNAP QTS versionDenton Gentry2-0/+51
Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2022-06-30util/cloudenv: add Azure support & DNS IPsBrad Fitzpatrick1-0/+2
And rewrite cloud detection to try to do only zero or one metadata discovery request for all clouds, only doing a first (or second) as confidence increases. Work remains for Windows, but a start. And add Cloud to tailcfg.Hostinfo, which helped with testing using "tailcfg debug hostinfo". Updates #4983 (Linux only) Updates #4984 Change-Id: Ib03337089122ce0cb38c34f724ba4b4812bc614e Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-06-05hostinfo,distro: Identify Western Digital MyCloud devices.Denton Gentry1-0/+4
root@WDMyCloud HD_a2 # ./tailscale debug hostinfo { "IPNVersion": "1.25.0-dev20220605-t7fea52e02", "OS": "linux", "OSVersion": "5.22.113", "Desktop": false, "DeviceModel": "WD My Cloud Gen2: Marvell Armada 375", "Hostname": "WDMyCloud", "GoArch": "arm" } Updates https://github.com/tailscale/tailscale/issues/4622 Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2022-06-01hostinfo: use ByteSliceToString from golang.org/x/sys/unixTobias Klauser2-12/+3
Use unix.ByteSliceToString in osVersionFreebsd and osVersionLinux to convert the Utsname.Release []byte field to string. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2022-06-01hostinfo: use Uname from golang.org/x/sys/unix in osVersionLinuxTobias Klauser1-3/+2
As already done in osVersionFreebsd. This will allow to use the Utsname fields as []byte for easier conversion to string. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2022-04-18hostinfo, tailcfg: add desktop detection on Linux to hostinfoTom DNetto1-0/+30
From the machines tab its hard to differenciate desktop Linux installs from server Linux installs. Transmitting this information should make this determination a lot easier. Due to the reality that tailscaled is likely a system process, the standard checks based on XDG_SESSION_TYPE or DISPLAY environment variables are not possible (those variables won't be set). Instead, we look for listening unix sockets that are typical of desktop installs. Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-03-25tsnet: set Hostinfo.Package to "tsnet" on useBrad Fitzpatrick1-2/+3
Fixes #4256 Change-Id: I11276596c3724bead1e0aa1f2e57ba75cef3b6be Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>