关于TLS1.3
在OpenSSL的github开源项目中我们可以看到最新的tag为OpenSSL_1_1_1
,该版本为TLS1.3正式版。
更新:2018/09/12 昨天前OpenSSL_1_1_1发布了,已更新。
更多TLS v1.3内容看这里
nginx 更新到v1.15.8
从OpenSSL的博客中,我们知道TLS1.3与1TLS1.2的主要差异有以下几点:
- 有新的套件,旧的套件无法用在1.3连接中;
- 套件的定义与以往不一样,新的套件不指定证书类型(eg:RSA,DSA,ECDSA)以及秘钥交换机制(eg:DHE,ECDHE) ;
- 客户在
ClientHello
中提供key_share
。这对group
配置有影响;(这个group是什么,我还没去研究) - 会话直到主要握手完成后才建立;
- 不支持重协商;
- 更多的握手被加密;
- 更多类型的消息可以扩展;
- 弃用DSA证书。(DSA貌似现在也没怎么见)
编译Nginx
我的服务器:CentOS 7.4 64位
其实编译nginx很多人都写过,我这里主要参考ququ大神的博客配置的。
安装依赖
1 | # 安装开发工具 |
获取组件
这部分主要是按照曲曲的配置来的,我就不细说。
1 | # 启用CT功能的nginx-ct |
OpenSSL
下载GitHub上最新的pre6版本即可。
1 | wget https://codeload.github.com/openssl/openssl/tar.gz/OpenSSL_1_1_1 |
编译安装Nginx
获取 Nginx 源码:
1 | wget -c https://nginx.org/download/nginx-1.15.8.tar.gz |
编译以及安装
1 | ./configure --add-module=../ngx_brotli --add-module=../nginx-ct-1.3.2 --with-openssl=../openssl --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module |
这一步完成,会给你一些提示,其中一些路径它会打印出来,configure时没指定就会使用默认的,如下。
nginx path prefix: “/usr/local/nginx”
nginx binary file: “/usr/local/nginx/sbin/nginx”
nginx modules path: “/usr/local/nginx/modules”
nginx configuration prefix: “/usr/local/nginx/conf”
nginx configuration file: “/usr/local/nginx/conf/nginx.conf”
nginx pid file: “/usr/local/nginx/logs/nginx.pid”
nginx error log file: “/usr/local/nginx/logs/error.log”
nginx http access log file: “/usr/local/nginx/logs/access.log”
nginx http client request body temporary files: “client_body_temp”
nginx http proxy temporary files: “proxy_temp”
nginx http fastcgi temporary files: “fastcgi_temp”
nginx http uwsgi temporary files: “uwsgi_temp”
nginx http scgi temporary files: “scgi_temp”
完成后可以将nginx加入到path中,或软链进去的。
1 | ln /usr/local/nginx/sbin/nginx /usr/local/bin/nginx |
查看一下是否安装正确:
1 | $ nginx -V |
OpenSSL 1.1.1
与nginx/1.15.8
看来已经OK了。
管理脚本与自启
1 | sudo vim /etc/init.d/nginx |
输入以下内容:
1 |
|
增加执行权限:
1 | sudo chmod a+x /etc/init.d/nginx |
现在管理 Nginx 只需使用以下命令即可:
1 | sudo service nginx start|stop|restart|reload |
如果启动出现错误Starting nginx: /etc/init.d/nginx: line 32: start-stop-daemon: command not found
,那是start-stop-daemon
工具没有安装,可按照以下方式安装。
1 | wget http://developer.axis.com/download/distribution/apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz |
开机自动启动 Nginx,执行以下命令:
1 | sudo chkconfig nginx on |
Nginx配置
最后贴以下我的nginx全局配置以及博客配置。
全局配置vim /usr/local/nginx/conf/nginx.conf
1 |
|
博客配置 vim /www/blog/nginx.conf
1 | server { |
测试
MySSL.com检测A+,整体配置过关。
再用工具测一下了.
工具:testssl
安装与测试:
1 | git clone --depth 1 https://github.com/drwetter/testssl.sh.git |
结果:
嗯,到这里就我的博客就支持最新的TLS1.3拉~。