From 2d3e16b626d2369aa371189ca2308de628aed596 Mon Sep 17 00:00:00 2001 From: Otto Mao Date: Mon, 23 Mar 2015 11:29:56 +0800 Subject: [PATCH] =?UTF-8?q?Created=20HTTPS=E7=9B=B8=E5=85=B3=E6=95=99?= =?UTF-8?q?=E7=A8=8B=20(markdown)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HTTPS相关教程.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 HTTPS相关教程.md diff --git a/HTTPS相关教程.md b/HTTPS相关教程.md new file mode 100644 index 0000000..24537b4 --- /dev/null +++ b/HTTPS相关教程.md @@ -0,0 +1,30 @@ + +AnyProxy解析HTTPS的原理是自制根证书(rootCA),待终端信任这份证书之后,再用它签发各个URL的二级证书,用这个二级证书来重新对各个页面进行编解码。这种方案和HTTPS的“中间人攻击”(MITM)是一致的。 + +这份中文文档简略概述了用AnyProxy做HTTPS处理的相关流程。更完整的内容可以读这里的英文文档:[https://github.com/alibaba/anyproxy/wiki/How-to-config-https-proxy](https://github.com/alibaba/anyproxy/wiki/How-to-config-https-proxy) + +#### Step 1 - 安装openSSL + +* OSX系统自带了openSSL,可以略过这步 +* openSSL的安装:[http://wiki.openssl.org/index.php/Compilation_and_Installation](http://wiki.openssl.org/index.php/Compilation_and_Installation) +* 安装完成后可以通过``openssl version -a ``看到安装情况。 + +#### Step 2 - 生成RootCA,信任它 + +* 命令行执行 ``sudo anyproxy --root`` +* 方法一: 执行完成之后,会打开证书的安装路径,打开并信任 rootCA.crt 文件 +* 方法二: 启动anyproxy,浏览器打开 [http://localhost:8002/fetchCrtFile](http://localhost:8002/fetchCrtFile) ,也能获取rootCA.crt文件 +* 方法三:启动anyproxy,[http://localhost:8002/qr_root](http://localhost:8002/qr_root) 可以获取证书路径的二维码,移动端安装时会比较便捷 +* 如果在访问时出现UNAUTHORIZED_CERTIFICATE一类的安全警告,请重新检查证书的安装情况 +* 证书只需生成一次,每个终端都需要信任它 + +#### Step 3 - 明文解析HTTPS + +* 需要解析HTTPS时,用intercept参数来启动anyproxy ``anyproxy --intercept`` +* 为终端设置代理,在UI界面就能看到明文的HTTPS请求数据了,带把小锁各行的就是HTTPS请求 + +![](http://gtms04.alicdn.com/tps/i4/TB1BlqiHXXXXXX1apXXxQJt_XXX-1229-391.jpg_400x400.jpg) + +#### 其他 + +* ``anyproxy --clear``可以清除所有已生成的证书