Ubuntu 12.04 LTS 下配置 apache支持SPDY, 使用wireshark 抓包分析SPDY 协议

1、安装apache

sudo apt-get install apache2

root@ubuntu:/etc/apache2/mods-enabled# apache2 -v
Server version: Apache/2.2.22 (Ubuntu)
Server built:   Jul 22 2014 14:35:32

注意apache 的版本为2.2

2、配置SSL,支持HTTPS

这步的作用是启用SSL模块和令网站支持SSL协议。

cd到 /etc/apache2/sites-enabled ,然后执行

sudo ln -s ../sites-available/default-ssl .

cd到 /etc/apache2/mods-enabled ,然后执行

sudo ln -s ../mods-available/ssl.* .

3、安装mod_spdy

https://developers.google.com/speed/spdy/mod_spdy/下载,我是64bit的,选择

下载后,
sudo dpkg -i mod-spdy-beta_current_amd64.deb
 
4、重启apache
sudo service apache2 restart
5、验证 SPYD module 可以运行
用chrome以https协议访问当前开启了SSL的apache server,并打开Network监控台,如果SPDY生效,则会在Headers里看到x-mod-spdy。
 
 
 
 6、禁用DH秘钥
 

国内的网上很多资料没提到这点:Wireshark不能解密应用了DH(Diffie–Hellman)秘钥的SSL密文。

用命令打开:

sudo gedit /etc/apache2/mods-enabled/ssl.conf

找到这行

SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5

注释掉改成:

#SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
SSLCipherSuite RSA

更保险地是改成

SSLCipherSuite RSA+AES256+SHA

 7、转换出pkcs8格式的私钥key给wireshark使用

Wireshark不能解密应用了DH(Diffie–Hellman)秘钥的SSL密文。

(TLS也是可以解密的,要从第一次握手该host开始全部的包都截到才行

在/etc/apache2/sites-enabled/default-ssl.conf文件中,能看到这行

SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

它表示了默认的私钥文件路径。但这个目录只有root用户可以打开,所以先用命令行操作把它复制出来并加上访问权限:

cd ~

sudo cp /etc/ssl/private/ssl-cert-snakeoil.key .

sudo chmod 777 ssl-cert-snakeoil.key

然后是转换:

openssl pkcs8 -nocrypt -in ssl-cert-snakeoil.key -out key.pem -outform PEM

转换出来的key.pem将交给Wireshark使用来解密。

 8、设置wireshark

先去 https://1.as.dl.wireshark.org/win64/下载Wireshark-win64-1.12.2.exe 支持spdy插件的wireshark,

在wireshark的ssl协议中添加私钥
菜单:Edit->Preferences->Protocols->SSL->Edit
解释
apache 服务器ip和端口:192.168.230.136和443
私钥路径:D:\server.pem
 

第五步,启动wireshark抓取spdy包

启动wireshark,输入过滤条件

 
打开apache的首页
通过chrome浏览器打开 https:192.168.85.136
 
 
通过wireshark查看抓包结果
 
 
 
参考:
http://blog.csdn.net/hursing/article/details/20049381
http://blog.csdn.net/hursing/article/details/20543837
http://www.tuicool.com/articles/eMJbey
http://blog.csdn.net/chq123456/article/details/40710611
posted @ 2014-12-01 14:05  穆穆兔兔  阅读(891)  评论(0编辑  收藏  举报