|
|
|
|
@ -29,6 +29,7 @@ import ( |
|
|
|
|
"tailscale.com/util/clientmetric" |
|
|
|
|
"tailscale.com/util/goroutines" |
|
|
|
|
"tailscale.com/util/httpm" |
|
|
|
|
"tailscale.com/util/syspolicy" |
|
|
|
|
"tailscale.com/version" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
@ -229,9 +230,17 @@ func (b *LocalBackend) handleC2NPostureIdentityGet(w http.ResponseWriter, r *htt |
|
|
|
|
|
|
|
|
|
res := tailcfg.C2NPostureIdentityResponse{} |
|
|
|
|
|
|
|
|
|
// TODO(kradalby): Use syspolicy + envknob to allow Win registry,
|
|
|
|
|
// macOS defaults and env to override this setting.
|
|
|
|
|
if b.Prefs().PostureChecking() { |
|
|
|
|
// Only collect serial numbers if enabled on the client,
|
|
|
|
|
// this will first check syspolicy, MDM settings like Registry
|
|
|
|
|
// on Windows or defaults on macOS. If they are not set, it falls
|
|
|
|
|
// back to the cli-flag, `--posture-checking`.
|
|
|
|
|
enabled, err := syspolicy.GetBoolean(syspolicy.PostureChecking, b.Prefs().PostureChecking()) |
|
|
|
|
if err != nil { |
|
|
|
|
enabled = b.Prefs().PostureChecking() |
|
|
|
|
b.logf("c2n: failed to read PostureChecking from syspolicy, returning default from CLI: %s; got error: %s", enabled, err) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if enabled { |
|
|
|
|
sns, err := posture.GetSerialNumbers(b.logf) |
|
|
|
|
if err != nil { |
|
|
|
|
http.Error(w, err.Error(), http.StatusInternalServerError) |
|
|
|
|
|