我们的服务遍布中国

我们的服务遍布中国
乃至世界

光网所服务的品牌地域与城市
北京 天津 上海 广州 深圳 香港 厦门 江苏 浙江 山东
重庆 长沙 武汉 成都 西安 宁夏 丽江 青海 云南 乌鲁木齐
黑龙江 内蒙古 河北 ...
光网服务与合作的全球各地
美国 加拿大 德国 法国 英国 瑞士 意大利 荷兰
印度 日本 韩国 ...

不论你的品牌在何处
我们都可以提供完善的服务与帮助

致电

0512-56969630
您所在的位置:首页 > SSL证书

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

发布时间:2016/12/30 2:03:02 浏览:106打印字号:

苹果公司2015年推出iOS9系统,为了提升应用程序与Web服务之间的连接安全,苹果要求所有应用程序的HTTP协议全部升级为HTTPS协议。由于iOS平台的封闭性,遭遇到的安全问题相比于Android来说要少得多,这就导致了许多iOS开发人员对于安全性方面没有太多的深入,但苹果公司强调每个开发者都应该致力于保证客户的数据的安全。在今年的WWDC大会上,苹果公司明确表示将以身作则,在iOS9中内置App Transport Security(简称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; 

                } 

        }

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+版本。