2

我们正在构建一个 iOS MDM 服务器来管理 iOS 设备。以下是将 iOS 设备注册到 MDM 服务器所涉及的步骤

  1. 发送注册配置
  2. 执行 SCEP
  3. 发送 MDM 服务器证书。
  4. 创建 APNS 证书。
  5. 向设备发送推送通知。

设备收到推送通知并联系 MDM 服务器的“serverUrl”。它以如下所示的 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>Status</key>
    <string>Idle</string>
    <key>UDID</key>
    <string><udid-of-device></string>
</dict>
</plist>

响应此命令以获取设备信息,发送如下。

<?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>DeviceInformation</string>
            <key>Queries</key>
            <array>
                <string>UDID</string>
                <string>DeviceName</string>
                <string>OSVersion</string>
                <string>ModelName</string>
                <string>IMEI</string>
            </array>
        </dict>
        <key>CommandUUID</key>
        <string>command-for-the-session</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>command-for-the-session</string>
    <key>QueryResponses</key>
    <dict>
        <key>DeviceName</key>
        <string>iPhone</string>
        <key>IMEI</key>
        <string>01 353150 432467 8</string>
        <key>ModelName</key>
        <string>iPhone</string>
        <key>OSVersion</key>
        <string>7.1</string>
        <key>UDID</key>
        <string><udid-device></string>
    </dict>
    <key>Status</key>
    <string>Acknowledged</string>
    <key>UDID</key>
    <string><udid-device></string>
</dict>
</plist>

此流程按要求工作。在此之后,我想结束与设备的连接,因为没有更多内容要发送到设备。

我的问题是在我们从设备收到该 CommandUUID 的有效详细信息后如何停止或关闭此连接。它继续调用 mdm 服务器 url 并且不结束连接。

我试过发送一个空的 plist 来停止连接,但没有运气。

请帮忙。

谢谢阅读。!

4

2 回答 2

1

设备将通过发送以下内容不断向您的服务器查询新命令:

<?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><udid-of-device></string>
</dict>
</plist>

在这种情况下,如果您没有任何命令,则应返回带有空正文的 HTTP 200。这会向设备发出信号,它应该停止轮询,直到您发送下一个推送通知。

于 2014-08-20T16:38:58.167 回答
0

这就是我在java中所做的发送和清空响应。

如果一切顺利,响应状态默认为 200。

发送空响应的代码:

response.setStatus(200); // set status explicitly in case device polls to the mdm server
OutputStream outStream = response.getOutputStream();
outStream.write(new byte[0]);
outStream.close();

服务器日志如下:

iPhone mdmd[302] <Notice>: (Note ) MDM: mdmd starting...
 iPhone mdmd[302] <Notice>: (Note ) MDM: Looking for managed app states to clean up
 iPhone profiled[303] <Notice>: (Note ) profiled: Service starting...
 iPhone mdmd[302] <Notice>: (Note ) MDM: Network reachability has changed.
 iPhone mdmd[302] <Notice>: (Note ) MDM: Network reachability has changed.
 iPhone mdmd[302] <Notice>: (Note ) MDM: Push token received.
iPhone mdmd[302] <Notice>: (Note ) MDM: Push token received.
iPhone mdmd[302] <Notice>: (Note ) MDM: Received push notification.
iPhone mdmd[302] <Notice>: (Note ) MDM: Polling MDM server https://myserver-url:port/server for next command.
 iPhone mdmd[302] <Notice>: (Note ) MDM: Transaction completed. Status: 200
 iPhone mdmd[302] <Notice>: (Note ) MDM: Attempting to perform MDM request: DeviceInformation
iPhone mdmd[302] <Notice>: (Note ) MDM: Command Status: Acknowledged
iPhone mdmd[302] <Notice>: (Note ) MDM: Polling MDM server https://myserver-url:port/server for next command.
iPhone profiled[303] <Notice>: (Note ) profiled: Service stopping.
iPhone mdmd[302] <Notice>: (Note ) MDM: Transaction completed. Status: 200
 iPhone mdmd[302] <Notice>: (Note ) MDM: Server has no commands for this device.
iPhone mdmd[302] <Notice>: (Note ) MDM: mdmd stopping.
于 2014-08-21T06:38:32.277 回答