iOS MDM - 如何在设备响应有效响应后关闭或停止连接 [英] iOS MDM - How to close or stop connection after device responds back with valid response

查看:211
本文介绍了iOS MDM - 如何在设备响应有效响应后关闭或停止连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

We are building an iOS MDM server to manage iOS devices. Below were the steps which were involved in enrolling an iOS device into the MDM server


  1. 发送注册配置

  2. 执行SCEP

  3. 发送MDM服务器证书。

  4. 创建APNS证书。

  5. 将推送通知发送到设备。

  1. Send enroll configuration
  2. Perform SCEP
  3. send MDM server certificate.
  4. Create APNS certificate.
  5. Send push notification to the device.

设备接收推送通知并联系MDM服务器的serverUrl。它响应Status =Idle,如下所示

The device receives the push notification and contacts the MDM server's "serverUrl". It responds with Status = "Idle" shown below

<?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>

响应此命令获取设备信息,如下所示。

In response to this command to get device information is sent as below.

<?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>

设备回复设备信息,如下所示

Device responds back with the device information as shown below

<?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>

此流程按要求运行。
在此之后我想结束与设备的连接,因为没有更多的东西要发送到设备。

This flow works as required. After this i want to end connection with the device as there is nothing more to be sent to the device.

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

My query is how to stop or close this connection after we receive the valid details from the device for that CommandUUID. It keeps on calling the mdm server url and does not end the connection.

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

I have tried send an empty plist to stop the connection but no luck.

请帮忙。

感谢您的阅读。!

推荐答案

这是我在java中发送和清空响应的行为。

This is what i did in java to send and empty response.

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

If all goes well the response status is defaulted to 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.

这篇关于iOS MDM - 如何在设备响应有效响应后关闭或停止连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆