iOS MDM 是无客户端协议。因此,您开发了一个服务器,但您没有为它开发一个客户端应用程序。其实有一个客户端应用程序,但它是由苹果公司开发并内置在操作系统中的。
所以,你的服务器会发送一个命令,内置的 MDM 客户端会接收并执行它。
一般来说,如果你想开发 MDM 服务器,你需要注册到 Enterprise Developer Program 并获得 MDM 文档。
一个文档here 我相信它会帮助您从头开始创建自己的 mdm 解决方案
Reference
其他一些关于开发 mdm 服务器的有用链接
Ref 1,
Ref 2
这是堆栈溢出浏览中MDM tag 的链接,这将帮助您获得大部分常见问题解答的答案
如果您想在下面的评论中获得任何澄清。
我已经准备好帮助你了
更新
概述
-
为了管理设备,我们可以使用 iOS 设置应用手动配置它
但它存在可扩展性问题,并且需要手动配置每个设备的大量工作,并且需要物理访问
-
所以苹果推出了iPCU(iPhone Configuration Utility) 工具,我们可以使用它创建配置文件(.moibleconfig),我们可以通过 USB 或 OTA(Over the Air) 安装它
但它需要用户交互
-
所以苹果为 iOS 引入了 MDM 服务,它不需要用户交互,我们可以在没有用户同意的情况下非常轻松地做很多事情,例如远程锁定、解锁、擦除、配置邮件等......
MDM 基本上是一种协议,您可以使用它远程管理设备。
概览
我们在 iOS 设置应用中所做的更改存储在
/var/mobile/Library/ConfigurationProfiles 作为 .plist 文件以及 iPCU 和 MDM 安装的配置文件 (.plist)
假设我们正在关闭设备中的 App Store 应用安装,为此我们将转到 Settings->Restrictions 并关闭 App Store 安装,以便 allowAppInstallation em> 将在其配置(.plist)中变为 false 假设我们正在使用 iPCU 以及 MDM 配置应用程序安装,然后当 iOS 设置应用程序配置文件的配置配置文件之间发生冲突时,我们将采用最严格的一个, iPCU 配置文件和 MDM 配置文件。
iOS 通过合并所有这些配置文件来创建一个名为 ProfileTruth.plist 的配置文件,并且 iOS 针对此 plist 工作
MDM 基本上由这些东西组成
-
iOS 设备
它可以是任何使用 iOS 运行的设备。所有 iOS 设备都有一个内置的 MDM 客户端。它将根据 MDM 服务器提供的指令进行操作
-
MDM 服务器
它基本上是一个托管在应用程序或 Web 服务器上的应用程序,它将命令提供给托管在 iOS 设备上的 MDM 客户端
-
信令
这是一种从服务器调用 mdm 客户端的机制,在我们的例子中是 APNS
我附上了 MDM 工作流程
- MDM 服务器使用 APNS 发送通知
- APNS 将其传送到设备
- 内置 MDM 客户端连接到 MDM Server
- 连接后,MDM 服务器将排队的命令发送回客户端,客户端根据 MDM 服务器发送的命令执行操作,并通过适当的确认回复 MDM 服务器
创建简单 MDM 的步骤
MDM 注册
从 MDM 注册配置文件开始
在 iPCU 中,您可以选择 MDM 有效负载创建新配置文件
签入网址
The is the URL where enrolment of the device happens.
i.e upon installation of profile on the device MDM client sends necessary information to the MDM server which MDM server will use to authenticate and connect with the device
服务器网址
Once the MDM server got the enrolment information.It can use the information to connect the device using APNS and when MDM client wakes up it connects with the URL mentioned in Server URL and Server can send back the queued commands to MDM client
主题
Enter the subject of APNS certificate that's going to be used for MDM.
身份
It can be any certificate generated by Certificate Assistant but important thing is it has to be signed by globally trusted CA or in the case of self signed CA the CA has be installed in the device.
安装 MDM 注册配置文件
您可以使用 Over the Air 或 Over the USB
安装此配置文件
一旦安装,iOS 内置客户端将通过身份验证请求连接到 MDM 服务器(签入 URL)
PUT:/签入
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>MessageType</key>
<string>Authenticate</string>
<key>Topic</key>
<string>com.example.mdm.pushcert</string>
<key>UDID</key>
<string> [ redacted ] </string>
</dict>
</plist>
现在服务器可以接受或拒绝 Authenticate 请求。为了接受服务器必须以空白 plist 响应
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>
MDM客户端收到响应后会发送TokenUpdate请求
PUT:/签入
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>MessageType</key>
<string>TokenUpdate</string>
<key>PushMagic</key>
<string> [ redacted uuid string ] </string>
<key>Token</key>
<data> [ 32 byte string, base64 encoded, redacted ] </data>
</data>
<key>Topic</key>
<string>com.example.mdm.pushcert</string>
<key>UDID</key>
<string> [ redacted ] </string>
<key>UnlockToken</key>
<data>
[ long binary string encoded in base64, redacted ]
</data>
</dict>
</plist>
再次服务器需要发送一个普通的 plist 来完成注册过程
MDM 服务器必须在服务器中存储以下密钥
PushMagic
服务器必须将此附加到它发送的所有推送通知以连接 MDM 客户端
令牌
向 APNS 标识设备的唯一 ID
解锁令牌
用于清除设备密码的密钥。
管理设备
现在服务器必须通过将上面的 Token 传递给推送通知库的 Token 和 Pushmagic 的 Payload 作为键 MDM 的值来发送推送通知em>
{"mdm":"996ac527-9993-4a0a-8528-60b2b3c2f52b"}
请参阅 aps 在此有效负载中不存在
一旦设备收到推送通知,MDM 客户端就会联系 服务器 URL 而不是 签入 URL,状态空闲
PUT:/服务器
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Status</key>
<string>Idle</string>
<key>UDID</key>
<string> [ redacted ] </string>
</dict>
</plist>
然后,服务器会响应它为设备排队的任何命令。
让我们看一个设备锁的例子
The server has to respond with command like this to the client request
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Command</key>
<dict>
<key>RequestType</key>
<string>DeviceLock</string>
</dict>
<key>CommandUUID</key>
<string></string>
</dict>
</plist>
当 MDM 客户端收到之前发送的 status idle 请求时。它将立即锁定设备并以以下标准确认响应服务器
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CommandUUID</key>
<string></string>
<key>Status</key>
<string>Acknowledged</string>
<key>UDID</key>
<string> [ redacted ] </string>
</dict>
</plist>
你可以在这里找到一些命令列表
就是这样。这种方法可以做一个简单的演示。
注意:
我会尝试在这里微调或添加更多内容以便于理解