Skip to content

Commit 5347e6a

Browse files
committed
control/controlclient: support certstore without cgo
We no longer build Windows releases with cgo enabled, which automatically turned off certstore support. Rather than re-enabling cgo, we updated our fork of the certstore package to no longer require cgo. This updates the package, cleans up how the feature is configured, and removes the cgo build tag requirement. Fixes tailscale/corp#14797 Fixes tailscale/coral#118 Change-Id: Iaea34340761c0431d759370532c16a48c0913374 Signed-off-by: Adrian Dewhurst <adrian@tailscale.com>
1 parent 68da155 commit 5347e6a

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

cmd/tailscaled/depaware.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
133133
L github.com/pierrec/lz4/v4/internal/lz4errors from github.com/pierrec/lz4/v4+
134134
L github.com/pierrec/lz4/v4/internal/lz4stream from github.com/pierrec/lz4/v4
135135
L github.com/pierrec/lz4/v4/internal/xxh32 from github.com/pierrec/lz4/v4/internal/lz4stream
136-
W github.com/pkg/errors from github.com/tailscale/certstore
137136
LD github.com/pkg/sftp from tailscale.com/ssh/tailssh
138137
LD github.com/pkg/sftp/internal/encoding/ssh/filexfer from github.com/pkg/sftp
139138
W 💣 github.com/tailscale/certstore from tailscale.com/control/controlclient
@@ -367,7 +366,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
367366
tailscale.com/util/testenv from tailscale.com/ipn/ipnlocal+
368367
tailscale.com/util/uniq from tailscale.com/wgengine/magicsock+
369368
tailscale.com/util/vizerror from tailscale.com/types/ipproto+
370-
💣 tailscale.com/util/winutil from tailscale.com/control/controlclient+
369+
💣 tailscale.com/util/winutil from tailscale.com/clientupdate+
371370
W 💣 tailscale.com/util/winutil/authenticode from tailscale.com/util/osdiag+
372371
W tailscale.com/util/winutil/policy from tailscale.com/ipn/ipnlocal
373372
tailscale.com/version from tailscale.com/derp+

control/controlclient/sign_supported.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
// Copyright (c) Tailscale Inc & AUTHORS
22
// SPDX-License-Identifier: BSD-3-Clause
33

4-
//go:build windows && cgo
4+
//go:build windows
55

6-
// darwin,cgo is also supported by certstore but machineCertificateSubject will
7-
// need to be loaded by a different mechanism, so this is not currently enabled
8-
// on darwin.
6+
// darwin,cgo is also supported by certstore but untested, so it is not enabled.
97

108
package controlclient
119

@@ -21,7 +19,7 @@ import (
2119
"github.com/tailscale/certstore"
2220
"tailscale.com/tailcfg"
2321
"tailscale.com/types/key"
24-
"tailscale.com/util/winutil"
22+
"tailscale.com/util/syspolicy"
2523
)
2624

2725
var getMachineCertificateSubjectOnce struct {
@@ -40,7 +38,7 @@ var getMachineCertificateSubjectOnce struct {
4038
// Example: "CN=Tailscale Inc Test Root CA,OU=Tailscale Inc Test Certificate Authority,O=Tailscale Inc,ST=ON,C=CA"
4139
func getMachineCertificateSubject() string {
4240
getMachineCertificateSubjectOnce.Do(func() {
43-
getMachineCertificateSubjectOnce.v, _ = winutil.GetRegString("MachineCertificateSubject")
41+
getMachineCertificateSubjectOnce.v, _ = syspolicy.GetString("MachineCertificateSubject", "")
4442
})
4543

4644
return getMachineCertificateSubjectOnce.v

control/controlclient/sign_unsupported.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Tailscale Inc & AUTHORS
22
// SPDX-License-Identifier: BSD-3-Clause
33

4-
//go:build !windows || !cgo
4+
//go:build !windows
55

66
package controlclient
77

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ require (
5858
github.com/prometheus/client_golang v1.17.0
5959
github.com/prometheus/common v0.44.0
6060
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
61-
github.com/tailscale/certstore v0.1.1-0.20220316223106-78d6e1c49d8d
61+
github.com/tailscale/certstore v0.1.1-0.20231020161753-77811a65f4ff
6262
github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502
6363
github.com/tailscale/goexpect v0.0.0-20210902213824-6e8c725cea41
6464
github.com/tailscale/golang-x-crypto v0.0.0-20230713185742-f0b76a10a08e

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,8 +864,8 @@ github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8
864864
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
865865
github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8=
866866
github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk=
867-
github.com/tailscale/certstore v0.1.1-0.20220316223106-78d6e1c49d8d h1:K3j02b5j2Iw1xoggN9B2DIEkhWGheqFOeDkdJdBrJI8=
868-
github.com/tailscale/certstore v0.1.1-0.20220316223106-78d6e1c49d8d/go.mod h1:2P+hpOwd53e7JMX/L4f3VXkv1G+33ES6IWZSrkIeWNs=
867+
github.com/tailscale/certstore v0.1.1-0.20231020161753-77811a65f4ff h1:vnxdYZUJbsSRcIcduDW3DcQqfqaiv4FUgy25q8X+vfI=
868+
github.com/tailscale/certstore v0.1.1-0.20231020161753-77811a65f4ff/go.mod h1:XrBNfAFN+pwoWuksbFS9Ccxnopa15zJGgXRFN90l3K4=
869869
github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502 h1:34icjjmqJ2HPjrSuJYEkdZ+0ItmGQAQ75cRHIiftIyE=
870870
github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502/go.mod h1:p9lPsd+cx33L3H9nNoecRRxPssFKUwwI50I3pZ0yT+8=
871871
github.com/tailscale/goexpect v0.0.0-20210902213824-6e8c725cea41 h1:/V2rCMMWcsjYaYO2MeovLw+ClP63OtXgCF2Y1eb8+Ns=

0 commit comments

Comments
 (0)