ipn/localapi: send Tailscale version in ACME User-Agent (#5499)

Requested by a friend at Let's Encrypt.

Signed-off-by: Andrew Dunham <andrew@tailscale.com>
This commit is contained in:
Andrew Dunham 2022-08-30 16:48:59 -04:00 committed by GitHub
parent 761163815c
commit 1ac4a26fee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -38,6 +38,7 @@
"tailscale.com/envknob" "tailscale.com/envknob"
"tailscale.com/ipn/ipnstate" "tailscale.com/ipn/ipnstate"
"tailscale.com/types/logger" "tailscale.com/types/logger"
"tailscale.com/version"
"tailscale.com/version/distro" "tailscale.com/version/distro"
) )
@ -185,7 +186,10 @@ func (h *Handler) getCertPEM(ctx context.Context, logf logger.Logf, traceACME fu
if err != nil { if err != nil {
return nil, fmt.Errorf("acmeKey: %w", err) return nil, fmt.Errorf("acmeKey: %w", err)
} }
ac := &acme.Client{Key: key} ac := &acme.Client{
Key: key,
UserAgent: "tailscaled/" + version.Long,
}
a, err := ac.GetReg(ctx, "" /* pre-RFC param */) a, err := ac.GetReg(ctx, "" /* pre-RFC param */)
switch { switch {

View File

@ -23,7 +23,8 @@
// Short is a short version number for this build, of the form // Short is a short version number for this build, of the form
// "x.y.z" for builds stamped in the usual way (see // "x.y.z" for builds stamped in the usual way (see
// build_dist.sh in the root) or, for binaries built by hand with the // go tool, it's like Long's dev form, but ending at the date part, // build_dist.sh in the root) or, for binaries built by hand with the
// go tool, it's like Long's dev form, but ending at the date part,
// of the form "1.23.0-dev20220316". // of the form "1.23.0-dev20220316".
var Short = "" var Short = ""