【问题标题】:Setting up a VPN Configuration Profile on iOS 7 [closed]在 iOS 7 上设置 VPN 配置文件 [关闭]
【发布时间】:2013-09-27 16:48:18
【问题描述】:

我有一个我在 iOS 6 上设置的配置文件,这样当某个 URL 被点击时,VPN 就会启动。

我是使用以下配置文件键执行此操作的:

<key>OnDemandEnabled</key>
<integer>1</integer>
<key>OnDemandMatchDomainsAlways</key>
<array>
    <string>my_homepage.com</string>
</array>

在 iOS 6 上,这似乎工作正常。但是,在 iOS 7 中,似乎 OnDemandMatchDomainAlways 已被弃用,取而代之的是 OnDemandRules 键,并且“OnDemandMatchDomainAlways”的默认行为类似于“OnDemandMatchDomainsOnRetry”。 所以现在,我正在尝试使用 OnDemandRules 键让我之前的设置在 iOS 7 上运行,如下所示:

<key>OnDemandRules</key>
<array>
    <dict>
        <key>Action</key>
        <string>Connect</string>
        <key>DNSDomainMatch</key>
        <array>
            <string>my_homepage.com</string>
        </array>
    </dict>
</array>

我也试过用这个方法设置:

<key>OnDemandRules</key>
    <array>
        <dict>
                    <key>Action</key>
            <string>EvaluateConnection</string>
            <key>ActionParameters</key>
            <array>
                <dict>
                    <key>Domains</key>
                    <array>
                        <string>url-that-redirects-if-vpn-off.com</string>
                    </array>
                    <key>DomainAction</key>
                    <string>ConnectIfNeeded</string>
            </dict>
        </array>
    </dict>
</array>

但是,这些方法似乎都不起作用。有谁知道如何设置 iOS VPN 配置文件,以便 VPN OnDemand 功能在 iOS 7 上的工作方式与在 iOS6 上的工作方式相同?

提前致谢,

【问题讨论】:

    标签: ios7 vpn ondemand configuration-profile


    【解决方案1】:

    这是我在 iOS 7 和 7.1 上用于 VPN on Demand 的个人资料的摘录。

                <key>AuthenticationMethod</key>
                <string>Certificate</string>
                <key>OnDemandEnabled</key>
                <integer>1</integer>
                <key>OnDemandRules</key>
                <array>
                    <dict>
                    <key>Action</key>
                    <string>Connect</string>
                    <key>URLStringProbe</key>
                    <string>http://internet-accessible-url.example.com</string>
                    </dict>
                </array>
                <key>PayloadCertificateUUID</key>
    

    每当 iOS 设备尝试通过移动数据或 WiFi 访问互联网时,它都会触发自动 VPN on Demand 连接,无需用户交互。

    我正在使用 StrongSwan 5.1.2 服务器作为与 Cisco IPSec 兼容的 VPN 服务器,具有明显的证书身份验证,但我使用 Xauth-noauth 来防止 iOS 设备不断询问用户名/密码以进行辅助即 xauth 身份验证。

    配置文件管理器不允许 iOS 客户端设备保存辅助 xauth 凭据的密码。

    请参阅我的博客http://jelockwood.blogspot.co.uk/2014/03/how-to-do-vpn-on-demand-for-ios-at-zero.html

    【讨论】:

    • 我之前已经设法让它与私有域一起工作,但有趣的是,我开始考虑让它与任何输入的域一起工作,所以这是一个很好的时机。不幸的是,看起来 URLStringProbe 导致它在任何 url 上被激活(它基本上在我启动 Firefox 时就启用了 VPN,不管我的个人资料中有什么),所以我可能不得不尝试让它与其他字典一起工作条目。
    • 嗨@john lockwood:非常感谢您的博客,这真的很有帮助,但我认为您应该在博客上提供示例配置文件。
    • @john lockwood - &lt;dict&gt;&lt;key&gt;Action&lt;/key&gt; &lt;string&gt;Connect&lt;/string&gt; &lt;/dict&gt; 它在 iOS 7 中运行良好,但是当 VPN 服务器关闭时,设备必须使用公共互联网,所以我把它变成了这样 &lt;dict&gt;&lt;key&gt;Action&lt;/key&gt; &lt;string&gt;Connect&lt;/string&gt;&lt;key&gt;URLStringProbe&lt;/key&gt; &lt;string&gt;https://www.google.com&lt;/string&gt;&lt;/dict&gt; 但它甚至没有建立 VPN 连接。感谢任何帮助!
    【解决方案2】:

    这个 sn-p 对我有用。我试图模仿“始终连接”的行为

            <key>IPSec</key>
            <dict>
                <key>AuthenticationMethod</key>
                <string>Certificate</string>
                <key>OnDemandEnabled</key>
                <integer>1</integer>
                        <!-- on demand rules -->
                        <key>OnDemandRules</key>
                        <array>
                        <dict>
                        <key>Action</key>
                        <string>EvaluateConnection</string>
                        <key>ActionParameters</key>
                        <array>
                        <dict>
                        <key>Domains</key>
                        <array>
                        <string>domain.com</string>
                        </array>
                        <key>RequiredURLStringProbe</key>
                        <string>https://host.domain.com/nonexistent_url</string>                    
                        <key>DomainAction</key>
                        <string>ConnectIfNeeded</string>
                        </dict>
                        </array>
                        </dict>
                        </array>
                        <!-- on demand rules -->
                <key>PayloadCertificateUUID</key>
                <string>...</string>
                <key>PromptForVPNPIN</key>
                <false/>
                <key>RemoteAddress</key>
                <string>...</string>
            </dict>
    

    【讨论】:

      【解决方案3】:

      我遇到了同样的问题,并且能够通过将 OnDemanRules 密钥作为 IPSec 块的一部分再次获得按需功能,即,

      <key>IPSec</key>
      <dict>
          <key>AuthenticationMethod</key>
          <string>Certificate</string>
      
          <!-- Other IPSEC VPN properties here. -->
      
          <key>OnDemandEnabled</key>
          <integer>1</integer>
          <key>OnDemandRules</key>
          <array>
              <dict>
              <key>Action</key>
              <string>Connect</string>
              <key>DNSDomainMatch</key>
              <array>
                <string>my_homepage.com</string>
              </array>
          </dict>
          </array>
      </dict>
      

      请注意,这与已发布的配置文件参考文档相矛盾。但是,就我而言,它使事情变得正常。

      【讨论】:

      • 嗨@ricardog:非常感谢您的博客,它真的很有帮助,但我认为您应该在您的博客上提供一个示例配置文件。
      猜你喜欢
      • 2013-06-09
      • 2012-03-31
      • 2012-02-17
      • 1970-01-01
      • 2019-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多