iOS 9 ATS - 禁用所有域的前向保密

时间:2016-02-03 23:18:27

标签: ios app-transport-security nsapptransportsecurity

在iOS 9中启用ATS后,我的许多客户无法满足前向保密要求。但是,它们可以满足https和TLS 1.2要求。因此,我希望放宽前向保密要求,同时保持https和TLS 1.2。

我想知道是否有人想出了一种方法来使用NSExceptionRequiresForwardSecrecy或NSThirdPartyExceptionRequiresForwardSecrecy来禁用所有域的前向保密。

我尝试使用*用于NSExceptionDomains或* .com但是当我使用它时问题链接不起作用。当我使用其domain.com时,问题链接将加载。我正在查看它上面的Apple Docs,但没有看到任何方法来实现我的目标。

是否可以通过将NSAppTransportSecurity / NSAllowsArbitraryLoads设置为true来完全禁用所有域的前向保密?

谢谢!

2 个答案:

答案 0 :(得分:5)

是的,有可能。您可能至少有一个域肯定会连接到。如果不是这样,请尝试使用任何可靠的网站(google.com,facebook.com等)。 您应该通过以下方式指定NSExceptionDomains配置为此域添加NSAppTransportSecurity规则:

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>google.com</key>   
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>                
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
        </dict>
    </dict>

仅供参考,Facebook应用使用相同的NSAppTransportSecurity配置。

答案 1 :(得分:2)

可能,尝试以下。

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

即使你可以添加特定的例外,

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>testdomain.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <false/>
            <key>NSExceptionAllowInsecureHTTPSLoads</key>
            <false/>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <true/>
            <key>NSExceptionMinimumTLSVersion</key>
            <string>TLSv1.2</string>
            <key>NSThirdPartyExceptionAllowInsecureHTTPSLoads</key>
            <false/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <true/>
            <key>NSThirdPartyExceptionMinimumTLSVersion</key>
            <string>TLSv1.2</string>
            <key>NSRequiresCertificateTransparency</key>
            <false/>
        </dict>

        ...

    </dict>
</dict>
相关问题