• Apache和Nginx配置支持苹果ATS方法


    什么是ATS功能?

    ATS是iOS9和OS X El Capitan的一个新特性。开启该功能后,ATS对使用NSURLConnection, CFURL或NSURLSession 等APIs 进行的网络请求默认强制使用HTTPS加密传输,目标是提高Apple 操作系统以及应用程序的安全性。

    WWDC 16 中,Apple 表示将继续在 iOS 10 和OS X 10.12 中持续收紧对普通 HTTP站点的访问限制。从 2017 年 1 月 1 日起,所有新提交到appstore中的 app 默认都将不再允许使用 NSAllowsArbitraryLoads 来绕过 ATS 限制的。也就是说,我们最好保证 与app 通讯的所有网络服务器都部署了 HTTPS 加密的,否则可能会在应用审核时遇到大麻烦。

    苹果公司官方文章指出,https必须符合ATS要求,服务器必须支持传输层安全(TLS)协议1.2以上版本;证书必须使用SHA256或更高的 哈希算法签名,并使用2048位以上RSA密钥或256位以上ECC算法;使用安全度更高的ECDHE加密套件。下面是苹果官方要求的3点关于SSL的技 术要点:

    Requirements for Connecting Using ATS

    With ATS fully enabled, your app’s HTTP connections must use HTTPS and must satisfy the following security requirements:

    The server certificate must meet at least one of the following trust requirements:

    Issued by a certificate authority (CA) whose root certificate is incorporated into the operating system

    Issued by a trusted root CA and installed by the user or a system administrator

    The negotiated Transport Layer Security version must be TLS 1.2

    The negotiated TLS connection cipher suite must support forward secrecy (FS) and be one of the following:

    TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384

    TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256

    TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384

    TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA

    TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256

    TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA

    TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384

    TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384

    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256

    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA

    The leaf server certificate must be signed with one of the following types of keys:

    Rivest-Shamir-Adleman (RSA) key with a length of at least 2048 bits

    Elliptic-Curve Cryptography (ECC) key with a size of at least 256 bits

    In addition, the leaf server certificate hashing algorithm must be Secure Hash Algorithm 2 (SHA-2) with a digest length of at least 256 (that is, SHA-256 or greater).

    If ATS is not enabled, the system still performs HTTPS server trust evaluation but you can override it on a case-by-case basis, as described in HTTPS Server Trust Evaluation. With ATS fully enabled, you cannot override the default HTTPS server trust evaluation.

    其中需要证书必须使用SHA256或更高的哈希算法签名,并使用2048位以上RSA密钥或256位以上ECC算法证书。支持TLS1.2协议和ECDHE算法需要在 Services端做相应的调整。

    Nginx中,需要修改nginx.conf,在其中SSL部分修改配置:

            server { 
    
                    listen       443; 
    
                    server_name  localhost; 
    
                    ssl                  on; 
    
                    ssl_certificate      yourdomain_bundle.crt; 
    
                    ssl_certificate_key  yourdomain.key; 
    
                    ssl_session_timeout  5m; 
    
                    ssl_session_cache    shared:SSL:1m;
    
                    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
    
                    ssl_ciphers ECDH:AESGCM:HIGH:!RC4:!DH:!MD5:!aNULL:!eNULL;
    
            location / { 
    
                        root   html; 
    
                        index  index.html index.htm; 
    
                    } 
    
            } 
    

    由于容器的一些限制,在解决IOS ATS适配SSL的问题上面推荐使用apache和nginx来安装证书,同时openssl的版本建议使用 1.0.1+,因为openssl在1.0.1以后才开始支持TLSv1.2协议,介于一些其他漏洞的因素,openssl版本 官方推荐使用1.0.1g+版本.

  • 相关阅读:
    2019-2020-1 20175323 实验四 外设驱动程序设计
    2019-2020-1 20175323 实验三 并发程序
    2019-2020-1-20175332 20175323 20175228-实验二固件程序设计
    2019-2020-1 20175323 20175332 20175228 实验一开发环境的熟悉
    20175323 团队项目 服务器端函数功能与业务逻辑详解
    2018-2019-2-20175323 java实验五 网络编程与安全
    2018-2019-2-20175323 java实验四 Android程序设计
    2018-2019-2-20175323 java实验三敏捷开发与XP实践
    2018-2019-2-20175323 java实验二《Java面向对象程序设计》
    2018-2019-2 20175323 实验一《Java开发环境的熟悉》实验报告
  • 原文地址:https://www.cnblogs.com/kabi/p/6198097.html
Copyright © 2020-2023  润新知