Skip to content

Commit 37925b3

Browse files
committed
go.mod, cmd/tailscaled, ipn/localapi, util/osdiag, util/winutil, util/winutil/authenticode: add Windows module list to OS-specific logs that are written upon bugreport
* We update wingoes to pick up new version information functionality (See pe/version.go in the https://github.com/dblohm7/wingoes repo); * We move the existing LogSupportInfo code (including necessary syscall stubs) out of util/winutil into a new package, util/osdiag, and implement the public LogSupportInfo function may be implemented for other platforms as needed; * We add a new reason argument to LogSupportInfo and wire that into localapi's bugreport implementation; * We add module information to the Windows implementation of LogSupportInfo when reason indicates a bugreport. We enumerate all loaded modules in our process, and for each one we gather debug, authenticode signature, and version information. Fixes tailscale#7802 Signed-off-by: Aaron Klotz <aaron@tailscale.com>
1 parent 301e59f commit 37925b3

17 files changed

+575
-305
lines changed

cmd/tailscaled/depaware.txt

+8-2
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
7777
L github.com/aws/smithy-go/waiter from github.com/aws/aws-sdk-go-v2/service/ssm
7878
L github.com/coreos/go-iptables/iptables from tailscale.com/util/linuxfw
7979
LD 💣 github.com/creack/pty from tailscale.com/ssh/tailssh
80-
W 💣 github.com/dblohm7/wingoes from github.com/dblohm7/wingoes/com
80+
W 💣 github.com/dblohm7/wingoes from github.com/dblohm7/wingoes/com+
8181
W 💣 github.com/dblohm7/wingoes/com from tailscale.com/cmd/tailscaled
8282
W github.com/dblohm7/wingoes/internal from github.com/dblohm7/wingoes/com
83+
W 💣 github.com/dblohm7/wingoes/pe from tailscale.com/util/osdiag+
8384
github.com/fxamacker/cbor/v2 from tailscale.com/tka
8485
W 💣 github.com/go-ole/go-ole from github.com/go-ole/go-ole/oleutil+
8586
W 💣 github.com/go-ole/go-ole/oleutil from tailscale.com/wgengine/winnet
@@ -332,6 +333,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
332333
tailscale.com/util/mak from tailscale.com/control/controlclient+
333334
tailscale.com/util/multierr from tailscale.com/control/controlclient+
334335
tailscale.com/util/must from tailscale.com/logpolicy
336+
💣 tailscale.com/util/osdiag from tailscale.com/cmd/tailscaled+
335337
tailscale.com/util/osshare from tailscale.com/ipn/ipnlocal+
336338
W tailscale.com/util/pidowner from tailscale.com/ipn/ipnauth
337339
tailscale.com/util/racebuild from tailscale.com/logpolicy
@@ -343,6 +345,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
343345
tailscale.com/util/systemd from tailscale.com/control/controlclient+
344346
tailscale.com/util/uniq from tailscale.com/wgengine/magicsock+
345347
💣 tailscale.com/util/winutil from tailscale.com/control/controlclient+
348+
W 💣 tailscale.com/util/winutil/authenticode from tailscale.com/util/osdiag
346349
W tailscale.com/util/winutil/policy from tailscale.com/ipn/ipnlocal
347350
tailscale.com/version from tailscale.com/derp+
348351
tailscale.com/version/distro from tailscale.com/hostinfo+
@@ -409,6 +412,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
409412
bytes from bufio+
410413
compress/flate from compress/gzip+
411414
compress/gzip from golang.org/x/net/http2+
415+
W compress/zlib from debug/pe
412416
container/heap from gvisor.dev/gvisor/pkg/tcpip/transport/tcp
413417
container/list from crypto/tls+
414418
context from crypto/tls+
@@ -433,6 +437,8 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
433437
crypto/tls from github.com/tcnksm/go-httpstat+
434438
crypto/x509 from crypto/tls+
435439
crypto/x509/pkix from crypto/x509+
440+
W debug/dwarf from debug/pe
441+
W debug/pe from github.com/dblohm7/wingoes/pe
436442
embed from tailscale.com+
437443
encoding from encoding/json+
438444
encoding/asn1 from crypto/x509+
@@ -448,7 +454,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
448454
flag from net/http/httptest+
449455
fmt from compress/flate+
450456
hash from crypto+
451-
hash/adler32 from tailscale.com/ipn/ipnlocal
457+
hash/adler32 from tailscale.com/ipn/ipnlocal+
452458
hash/crc32 from compress/gzip+
453459
hash/fnv from tailscale.com/wgengine/magicsock+
454460
hash/maphash from go4.org/mem

cmd/tailscaled/tailscaled_windows.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import (
5050
"tailscale.com/tsd"
5151
"tailscale.com/types/logger"
5252
"tailscale.com/types/logid"
53+
"tailscale.com/util/osdiag"
5354
"tailscale.com/util/winutil"
5455
"tailscale.com/version"
5556
"tailscale.com/wf"
@@ -127,7 +128,7 @@ var syslogf logger.Logf = logger.Discard
127128
// Windows started.
128129
func runWindowsService(pol *logpolicy.Policy) error {
129130
go func() {
130-
winutil.LogSupportInfo(log.Printf)
131+
osdiag.LogSupportInfo(logger.WithPrefix(log.Printf, "Support Info: "), osdiag.LogSupportInfoReasonStartup)
131132
}()
132133

133134
if winutil.GetPolicyInteger("LogSCMInteractions", 0) != 0 {

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
1919
github.com/creack/pty v1.1.18
2020
github.com/dave/jennifer v1.6.1
21-
github.com/dblohm7/wingoes v0.0.0-20230801195049-ed8077baf0cd
21+
github.com/dblohm7/wingoes v0.0.0-20230803162905-5c6286bb8c6e
2222
github.com/dsnet/try v0.0.3
2323
github.com/evanw/esbuild v0.14.53
2424
github.com/frankban/quicktest v1.14.5

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ github.com/dave/jennifer v1.6.1/go.mod h1:nXbxhEmQfOZhWml3D1cDK5M1FLnMSozpbFN/m3
240240
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
241241
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
242242
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
243-
github.com/dblohm7/wingoes v0.0.0-20230801195049-ed8077baf0cd h1:zYVpYS5d3Uf04vVCJuzqpOCwQQIzJibtOx8ivt7zt2Q=
244-
github.com/dblohm7/wingoes v0.0.0-20230801195049-ed8077baf0cd/go.mod h1:6NCrWM5jRefaG7iN0iMShPalLsljHWBh9v1zxM2f8Xs=
243+
github.com/dblohm7/wingoes v0.0.0-20230803162905-5c6286bb8c6e h1:tTRuQNnXKO6Ffu62nk9bnnPx/m+IyNMdFFfzsETyRO8=
244+
github.com/dblohm7/wingoes v0.0.0-20230803162905-5c6286bb8c6e/go.mod h1:6NCrWM5jRefaG7iN0iMShPalLsljHWBh9v1zxM2f8Xs=
245245
github.com/denis-tingaikin/go-header v0.4.3 h1:tEaZKAlqql6SKCY++utLmkPLd6K8IBM20Ha7UVm+mtU=
246246
github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c=
247247
github.com/denis-tingajkin/go-header v0.3.1/go.mod h1:sq/2IxMhaZX+RRcgHfCRx/m0M5na0fBt4/CRe7Lrji0=

ipn/localapi/localapi.go

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import (
4848
"tailscale.com/util/clientmetric"
4949
"tailscale.com/util/httpm"
5050
"tailscale.com/util/mak"
51+
"tailscale.com/util/osdiag"
5152
"tailscale.com/version"
5253
)
5354

@@ -350,6 +351,9 @@ func (h *Handler) serveBugReport(w http.ResponseWriter, r *http.Request) {
350351
// logs for them.
351352
envknob.LogCurrent(logger.WithPrefix(h.logf, "user bugreport: "))
352353

354+
// OS-specific details
355+
osdiag.LogSupportInfo(logger.WithPrefix(h.logf, "user bugreport OS: "), osdiag.LogSupportInfoReasonBugReport)
356+
353357
if defBool(r.URL.Query().Get("diagnose"), false) {
354358
h.b.Doctor(r.Context(), logger.WithPrefix(h.logf, "diag: "))
355359
}

tstest/integration/tailscaled_deps_test_windows.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

util/osdiag/mksyscall.go

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) Tailscale Inc & AUTHORS
2+
// SPDX-License-Identifier: BSD-3-Clause
3+
4+
package osdiag
5+
6+
//go:generate go run golang.org/x/sys/windows/mkwinsyscall -output zsyscall_windows.go mksyscall.go
7+
//go:generate go run golang.org/x/tools/cmd/goimports -w zsyscall_windows.go
8+
9+
//sys regEnumValue(key registry.Key, index uint32, valueName *uint16, valueNameLen *uint32, reserved *uint32, valueType *uint32, pData *byte, cbData *uint32) (ret error) [failretval!=0] = advapi32.RegEnumValueW

util/osdiag/osdiag.go

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (c) Tailscale Inc & AUTHORS
2+
// SPDX-License-Identifier: BSD-3-Clause
3+
4+
// Package osdiag provides loggers for OS-specific diagnostic information.
5+
package osdiag
6+
7+
import "tailscale.com/types/logger"
8+
9+
// LogSupportInfoReason is an enumeration indicating the reason for logging
10+
// support info.
11+
type LogSupportInfoReason int
12+
13+
const (
14+
LogSupportInfoReasonStartup LogSupportInfoReason = iota + 1 // tailscaled is starting up.
15+
LogSupportInfoReasonBugReport // a bugreport is in the process of being gathered.
16+
)
17+
18+
// LogSupportInfo obtains OS-specific diagnostic information useful for
19+
// troubleshooting and support, and writes it to logf. The reason argument is
20+
// useful for governing the verbosity of this function's output.
21+
func LogSupportInfo(logf logger.Logf, reason LogSupportInfoReason) {
22+
logSupportInfo(logf, reason)
23+
}

util/osdiag/osdiag_notwindows.go

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright (c) Tailscale Inc & AUTHORS
2+
// SPDX-License-Identifier: BSD-3-Clause
3+
4+
//go:build !windows
5+
6+
package osdiag
7+
8+
import "tailscale.com/types/logger"
9+
10+
func logSupportInfo(logger.Logf, LogSupportInfoReason) {
11+
}

0 commit comments

Comments
 (0)