我公司有许多iOS设备需要统一管理,因此我们尝试使用第三方MDM应用程序,例如:Airwatch,但价格非常昂贵。
我们决定不使用它,并考虑从零开始创建MDM。我们尝试了所有在线可用的解决方案,但没有找到任何解决方案。请问有人能帮助我吗?
为了管理设备,我们可以使用iOS设置应用程序手动配置它
但是它存在可扩展性问题,手动配置每个设备需要大量工作,并且需要物理访问
因此,苹果推出了iPCU(iPhone配置实用程序)工具,使用该工具我们可以创建配置文件(.moibleconfig),并可以通过USB或OTA(空中)安装它
但是需要用户交互
因此,苹果为iOS引入了MDM服务,它不需要用户交互,我们可以轻松地执行许多操作而无需用户同意,例如远程锁定、解锁、擦除、配置邮件等...
MDM基本上是一种协议,可以远程管理设备。
概述
iOS设置应用程序中所做的更改存储在/var/mobile/Library/ConfigurationProfiles中,作为.plist文件与iPCU和MDM安装的配置文件(.plist)一起。
假设我们正在关闭设备中的应用商店应用程序安装,因此要这样做,我们将转到设置->限制并关闭应用商店安装,因此在其配置(.plist)中将allowAppInstallation变为false。假设我们也使用iPCU和MDM配置应用程序安装,那么当iOS设置应用程序配置文件、iPCU配置文件和MDM配置文件之间发生冲突时,iOS将采取最严格的配置文件。
iOS通过合并所有这些配置文件创建一个名为ProfileTruth.plist的配置文件,并根据此plist工作
MDM基本上由以下内容组成
iOS设备
它可以是运行iOS的任何设备。所有iOS设备都有内置的MDM客户端。它将根据MDM服务器提供的指令执行操作
MDM服务器
它基本上是托管在应用程序或Web服务器上的应用程序,并向托管在iOS设备上的MDM客户端提供命令
信令
这是一种机制,从服务器中调用mdm客户端,在我们的情况下是APNS
现附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
服务器 URL
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.
<?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>
<!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>
<?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客户端的所有推送通知中
Token
用于标识设备到APNS的唯一ID
UnlockToken
用于清除设备密码的密钥。
管理设备
现在,服务器必须通过将上述 Token 传递给Push通知库的Token和将 Pushmagic 的Payload作为键 MDM 的值来发送Push通知。
{"mdm":"996ac527-9993-4a0a-8528-60b2b3c2f52b"}
这个负载中没有出现aps
设备接收到推送通知后,MDM客户端会以空闲状态联系服务器URL而不是签入URL
PUT: /server
<?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>
<?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>
您可以在此处找到一些命令列表
这就是全部了。这种方法可以做一个简单的演示。
注意:
我会尝试微调或添加更多内容,以便更容易理解。