技术文档

Apache和Nginx配置支持苹果ATS方法 – HTTPS SSL 教程

苹果公司的iOS9系统退出后,为了提升应用程序与Web服务之间的连接安全,苹果要求所有应用程序的HTTP协议全部升级为HTTPS协议。由于iOS平台的封闭性,遭遇到的安全问题相比于Android来说要少得多,这就导致了许多iOS开发人员对于安全性方面没有太多的深入,但苹果公司强调每个开发者都应该致力于保证客户的数据的安全。苹果公司明确表示将以身作则,在iOS9中内置App Transport Security(简称ATS)功能,通过该新特性来提高操作系统的安全性。

Apache和Nginx配置支持苹果ATS方法 – HTTPS SSL 教程

什么是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{ listen443; server_name; sslon; ssl_certificateyourdomain_bundle.crt; ssl_certificate_keyyourdomain.key; ssl_session_timeout5m; ssl_session_cacheshared:SSL:1m; ssl_protocolsTLSv1TLSv1.1TLSv1.2; ssl_ciphersECDH:AESGCM:HIGH:!RC4:!DH:!MD5:!aNULL:!eNULL; location/{ roothtml; indexindex.htmlindex.htm; } }

Apache中,需要在httpd-ssl.conf或者vhost.conf中修改ssl部分:

SSLProtocol all -SSLv2 -SSLv3

SSLCipherSuite ECDH:AESGCM:HIGH:!RC4:!DH:!MD5:!aNULL:!eNULL;

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

 

 

©2020-2024   万云SSL证书  (www.sslssl.com.cn)  万云科技   豫ICP备2020034358号-10