设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 技术文摘 查看内容

Nginx+LibreSSL-尝鲜测试

2014-7-23 11:16| 发布者: joejoe0332| 查看: 4601| 评论: 0|原作者: mingshun|来自: oschina

摘要: 7月11日,LibreSSL团队发布 LibreSSL 的可移植版本,这是第一个可在 OpenBSD, Linux, OSX, Solaris 和 FreeBSD 上运行的版本。 本文会介绍一些 Nginx 与 Libressl 一起使用实践经验。 ...


做了一个小小的性能测试,结果显示没有什么大问题;LibreSSL 与平均水平相比慢了 4%。原因可能是 openssl 是静态链接到 nginx 的,而 libressl 则是动态链接到 nginx 的,所以会产生更多的资源开销。

纯数字的测试结果:

1
2
3
4
5
6
7
8
9
10
11
| Parallel Requests | OpenSSL-RPS | LibreSSL-RPS 
| 10                | 2341.75     | 2260.5
| 20                | 2459.75     | 2418.25
| 30                | 2472        | 2397
| 40                | 2485        | 2384.5
| 50                | 2445        | 2382.25
| 60                | 2453.25     | 2390.75
| 70                | 2426.25     | 2347.25
| 80                | 2346.5      | 2227.5
| 90                | 2325.5      | 2211
| 100               | 2297.75     | 2318.25

性能测试方式的一些说明可能在附录中找到。

结论

此法可行。

虽然不建议在这个阶段使用 LibreSSL 来代替 OpenSSL,但我只想测试其可行性。结果证明这是可行的。 从我的测试来看,没有任何功能上或性能的问题,而且只要你找到方法,构建 nginx + libressl 就容易了。依我所见,长期使用 LibreSSL 的好处是:

  • 干净的代码

  • 更少的漏洞

  • 更多人参与

在我撰写本文的时候,我收到新的 LibreSSL 版本发布的消息,新版本解决了一些新的问题。所以,再回头使用 OpenSSL 就显得有点不理智了:

做得好,LibreSSL 团队,再次感谢

参考

  1. 第一个可移植的 LibreSSL 版本发布

  2. LibreSSL - 下载

  3. libreSSL 的兼容性如何?

  4. 在 Gentoo 上使用 LibreSSL 

  5. LibreSSL 的 github 仓库

  6. Nginx + SSL + SPDY 指南

  7. 解决 LibreSSL 在 Redhat 上使用的问题

  8. LibreSSL - 主页

  9. SSL 报告: mare-system.de

  10. 第二个可移植的 LibreSSL 版本发布

  11. reddit-discussion

  12. Nginx + BoringSSL


附录

SSL 配置和使用的加密算法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
server {
 
  listen 443 ssl spdy;
  server_name www.mare-system.de;
 
  ...
 
  # ssl
  ssl_session_cache shared:SSL:10m;
  ssl_session_timeout 10m;
 
  # older protos for browsercompatibility
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;
 
  # suggestion from sslabs / including PFS
  ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+RC4:EECDH:EDH+aRSA:RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;
 
  # excluding subDomain on purpose
  add_header Strict-Transport-Security "max-age=31536000"
 
  ...
 
  }

Nginx 用于动态链接到 LibreSSL 的 Configure 选项

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  nginx_libressl_opts = """    --conf-path=/etc/nginx/nginx.conf 
    --sbin-path=/usr/sbin/nginx
    --prefix=
    --error-log-path=/var/log/nginx/error.log
    --http-log-path=/var/log/nginx/access.log
    --http-client-body-temp-path=/var/run/nginx/client_temp
    --http-proxy-temp-path=/var/run/nginx/proxy_temp
    --http-fastcgi-temp-path=/var/run/nginx/fastcgi_temp
    --with-file-aio
    --with-http_gzip_static_module
    --with-http_ssl_module
    --with-http_spdy_module
    --with-http_stub_status_module
    --with-debug
    --without-mail_pop3_module
    --without-mail_smtp_module
    --without-mail_imap_module
    --without-http_uwsgi_module
    --without-http_scgi_module
    --without-http_ssi_module    
    --add-module=$nmd/nginx-openssl-version
    --add-module=$nmd/naxsi
    --add-module=$nmd/lua-nginx-module
    --add-module=$nmd/ngx_devel_kit
    --add-module=$nmd/echo-nginx-module
    --add-module=$nmd/nginx-accesskey
    --add-module=$nmd/ngx_http_log_request_speed
    --add-module=$nmd/set-misc-nginx-module
    --add-module=$nmd/nginx-sticky-module-ng
    --add-module=$nmd/ngx_cache_purge
    --add-module=$nmd/memc-nginx-module
    --add-module=$nmd/nginx-upstream-fair
    --add-module=$nmd/headers-more-nginx-module
    --add-module=$nmd/encrypted-session-nginx-module

LibreSSL - 构建时间和输出

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# libressl
make check 
 
real  1m58.610s
user  1m24.517s
sys 0m11.477s
 
 
make check -j4 
 
real  0m34.231s
user  1m28.626s
sys 0m11.357s
 
 
# make check output 
 
make check 
 
============================================================================
Testsuite summary for libressl 2.0.0
============================================================================
# TOTAL: 41
# PASS:  41
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================

性能测试方法

  • 小服务器,双核,2GB内存,没有特别的调整

  • 从另一台服务器发起性能测试,使用 automake ab(abmeter)脚本

  • 打开 keepalive

  • url: / (由 nginx 缓存)

  • 测试了  10,20,30...100 个并发连接, 每次100.000 个请求

  • 每个配置测试 4 轮

  • 累积结果 / 4 -> 每次运行的值

  • OpenSSL Valhalla Rampage

  • https://www.ssllabs.com/ssltest/analyze.html?d=mare-system.de


酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部