mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 11:05:45 +00:00
control/controlclient: use the most recent syspolicy.MachineCertificateSubject value
This PR removes the sync.Once wrapper around retrieving the MachineCertificateSubject policy setting value, ensuring the most recent version is always used if it changes after the service starts. Although this policy setting is used by a very limited number of customers, recent support escalations have highlighted issues caused by outdated or incorrect policy values being applied. Updates #12687 Signed-off-by: Nick Khyl <nickk@tailscale.com>
This commit is contained in:
parent
eb3cd32911
commit
3353f154bb
@ -13,7 +13,6 @@
|
|||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/tailscale/certstore"
|
"github.com/tailscale/certstore"
|
||||||
@ -22,11 +21,6 @@
|
|||||||
"tailscale.com/util/syspolicy"
|
"tailscale.com/util/syspolicy"
|
||||||
)
|
)
|
||||||
|
|
||||||
var getMachineCertificateSubjectOnce struct {
|
|
||||||
sync.Once
|
|
||||||
v string // Subject of machine certificate to search for
|
|
||||||
}
|
|
||||||
|
|
||||||
// getMachineCertificateSubject returns the exact name of a Subject that needs
|
// getMachineCertificateSubject returns the exact name of a Subject that needs
|
||||||
// to be present in an identity's certificate chain to sign a RegisterRequest,
|
// to be present in an identity's certificate chain to sign a RegisterRequest,
|
||||||
// formatted as per pkix.Name.String(). The Subject may be that of the identity
|
// formatted as per pkix.Name.String(). The Subject may be that of the identity
|
||||||
@ -37,11 +31,8 @@
|
|||||||
//
|
//
|
||||||
// Example: "CN=Tailscale Inc Test Root CA,OU=Tailscale Inc Test Certificate Authority,O=Tailscale Inc,ST=ON,C=CA"
|
// Example: "CN=Tailscale Inc Test Root CA,OU=Tailscale Inc Test Certificate Authority,O=Tailscale Inc,ST=ON,C=CA"
|
||||||
func getMachineCertificateSubject() string {
|
func getMachineCertificateSubject() string {
|
||||||
getMachineCertificateSubjectOnce.Do(func() {
|
machineCertSubject, _ := syspolicy.GetString(syspolicy.MachineCertificateSubject, "")
|
||||||
getMachineCertificateSubjectOnce.v, _ = syspolicy.GetString(syspolicy.MachineCertificateSubject, "")
|
return machineCertSubject
|
||||||
})
|
|
||||||
|
|
||||||
return getMachineCertificateSubjectOnce.v
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
Loading…
Reference in New Issue
Block a user