mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-21 02:17:36 +00:00
posture: propagate serial number from MDM on Android
Updates #16010 Signed-off-by: Anton Tolchanov <anton@tailscale.com>
This commit is contained in:

committed by
Anton Tolchanov

parent
8a3afa5963
commit
cc988596a2
27
posture/serialnumber_syspolicy.go
Normal file
27
posture/serialnumber_syspolicy.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build android || ios
|
||||
|
||||
package posture
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"tailscale.com/types/logger"
|
||||
"tailscale.com/util/syspolicy"
|
||||
)
|
||||
|
||||
// GetSerialNumbers returns the serial number of the device as reported by an
|
||||
// MDM solution. It requires configuration via the DeviceSerialNumber system policy.
|
||||
// This is the only way to gather serial numbers on iOS, tvOS and Android.
|
||||
func GetSerialNumbers(_ logger.Logf) ([]string, error) {
|
||||
s, err := syspolicy.GetString(syspolicy.DeviceSerialNumber, "")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get serial number from MDM: %v", err)
|
||||
}
|
||||
if s != "" {
|
||||
return []string{s}, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
Reference in New Issue
Block a user