Nginx平滑升级到最新版本

(一)简述:    

    早上收到nginx最新漏洞的通知,Nginx官方发布最新的安全公告,在Nginx范围过滤器中发现了一个安全问题(CVE-2017-7529),通过精心构造的恶意请求可能会导致整数溢出并且不正确处理范围,从而导致敏感信息泄漏。

当使用Nginx标准模块时,如果文件头从缓存返回响应,允许攻击者获取缓存文件头。在某些配置中,缓存文件头可能包含后端服务器IP地址或其他敏感信息。此外,如果使用第三方模块有潜在的可能导致拒绝服务。

影响版本

Nginx 0.5.6-1.13.2

漏洞等级

中危

Nginx 在官方公告中称发现了一个范围过滤器中的安全问题。通过精心构造的恶意请

求能造成整数溢出,对范围的不当处理会导致敏感信息泄漏。

No.        漏洞名称           漏洞危害

CVE-2017-7529  Nginx range 过滤器整形溢出漏洞  高危


针对 CVE–2017–7529 修复建议

针对 Nginx range 过滤器整形溢出漏洞的修复建议

1) 下面的配置可以作为暂时的解决办法:

max_ranges 1;

2) 建议受影响用户尽快升级至 1.13.3, 1.12.1

3) 及时安装官方补丁。


虽然临时可以解决,不过还是建议升级到最新的版本,官方建议升级到1.12.1。

(二)具体的升级步骤:

 (1)升级和安装nginx第三方模块一样,需要查看原来安装nginx的版本以及编译的参数:

[root@ittestserver1 opt]# /usr/local/nginx2/sbin/nginx -V
nginx version: nginx/1.10.3
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) 
built with OpenSSL 1.1.0e  16 Feb 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx2 --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_stub_status_module --with-http_v2_module --with-openssl=/tmp/install/openssl-1.1.0e --with-http_v2_module

 (2)下载要升级的nginx版本

[root@ittestserver1 soft]# wget http://nginx.org/download/nginx-1.12.1.tar.gz
--2017-07-17 15:41:24--  http://nginx.org/download/nginx-1.12.1.tar.gz
正在解析主机 nginx.org... 206.251.255.63, 95.211.80.227, 2001:1af8:4060:a004:21::e3, ...
正在连接 nginx.org|206.251.255.63|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:981093 (958K) [application/octet-stream]
正在保存至: “nginx-1.12.1.tar.gz”
90% [=================================================>     ] 892,302      265K/s eta(英国中部时100%[======================================================>] 981,093      291K/s   in 3.3s    
2017-07-17 15:41:28 (291 KB/s) - 已保存 “nginx-1.12.1.tar.gz” [981093/981093])

(3)解压ningx下载的压缩包编译make,切记不要make install。

[root@ittestserver1 soft]# tar xf nginx-1.12.1.tar.gz 
[root@ittestserver1 soft]# cd nginx-1.12.1
[root@ittestserver1 nginx-1.12.1]# ls
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src
[root@ittestserver1 nginx-1.12.1]# ./configure  --prefix=/usr/local/nginx2 \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_stub_status_module \
--with-http_v2_module \
--with-openssl=/tmp/install/openssl-1.1.0e \
--with-http_v2_module
checking for OS+ Linux 2.6.32-358.el6.x86_64 x86_64
checking for C compiler ... found+ using GNU C compiler+ gcc version: 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) 
checking for gcc -pipe switch ... found
checking for -Wl,-E switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for gcc builtin 64 bit byteswap ... found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for sys/param.h ... found
checking for openat(), fstatat() ... found
checking for getaddrinfo() ... found
checking for PCRE library ... found
checking for PCRE JIT support ... found
checking for zlib library ... found
creating objs/Makefile
Configuration summary+ using system PCRE library+ using OpenSSL library: /tmp/install/openssl-1.1.0e+ using system zlib librarynginx path prefix: "/usr/local/nginx2"nginx binary file: "/usr/local/nginx2/sbin/nginx"nginx modules path: "/usr/local/nginx2/modules"nginx configuration prefix: "/usr/local/nginx2/conf"nginx configuration file: "/usr/local/nginx2/conf/nginx.conf"nginx pid file: "/usr/local/nginx2/logs/nginx.pid"nginx error log file: "/usr/local/nginx2/logs/error.log"nginx http access log file: "/usr/local/nginx2/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"
[root@ittestserver1 nginx-1.12.1]# make

由于make的时间比较长,需要稍等下。

(4)make编译完后会在安装目录下生成一个objs目录且在该目录下有一个nginx执行文件。

[root@ittestserver1 nginx-1.12.1]# ls
auto     CHANGES.ru  configure  html     Makefile  objs    src
CHANGES  conf        contrib    LICENSE  man       README
[root@ittestserver1 nginx-1.12.1]# ll objs/
总用量 7124
-rw-r--r-- 1 root root   17459 7月  17 15:48 autoconf.err
-rw-r--r-- 1 root root   43530 7月  17 15:48 Makefile
-rwxr-xr-x 1 root root 7152312 7月  17 15:51 nginx
-rw-r--r-- 1 root root    5345 7月  17 15:51 nginx.8
-rw-r--r-- 1 root root    7066 7月  17 15:48 ngx_auto_config.h
-rw-r--r-- 1 root root     657 7月  17 15:48 ngx_auto_headers.h
-rw-r--r-- 1 root root    6242 7月  17 15:48 ngx_modules.c
-rw-r--r-- 1 root root   38232 7月  17 15:51 ngx_modules.o
drwxr-xr-x 9 root root    4096 7月  17 15:48 src

(5)备份原来老的nginx文件

[root@ittestserver1 nginx-1.12.1]# mv /usr/local/nginx2/sbin/nginx /usr/local/nginx2/sbin/nginx.bak
[root@ittestserver1 nginx-1.12.1]# cp objs/nginx
nginx    nginx.8  
[root@ittestserver1 nginx-1.12.1]# cp objs/nginx  /usr/local/nginx2/sbin/[root@ittestserver1 nginx-1.12.1]# /usr/local/nginx2/sbin/nginx -t
nginx: the configuration file /usr/local/nginx2/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx2/conf/nginx.conf test is successful

(6)使用make upgrade替换老的nginx进程

[root@ittestserver1 nginx-1.12.1]# make upgrade

/usr/local/nginx2/sbin/nginx -t

nginx: the configuration file /usr/local/nginx2/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx2/conf/nginx.conf test is successful

kill -USR2 `cat /usr/local/nginx2/logs/nginx.pid`

sleep 1

test -f /usr/local/nginx2/logs/nginx.pid.oldbin

kill -QUIT `cat /usr/local/nginx2/logs/nginx.pid.oldbin`

(7)执行/usr/local/nginx2/sbin/nginx -V查看nginx最新的版本及编译的参数

[root@ittestserver1 nginx-1.12.1]# /usr/local/nginx2/sbin/nginx -V
nginx version: nginx/1.12.1
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) 
built with OpenSSL 1.1.0e  16 Feb 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx2 --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_stub_status_module --with-http_v2_module --with-openssl=/tmp/install/openssl-1.1.0e --with-http_v2_module

至此升级完成。



本文转自 lqbyz 51CTO博客,原文链接:http://blog.51cto.com/liqingbiao/1948430

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/393204.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

如何使用TypeScript从Microsoft Word生成GitHub markdown文件

by Manish Bansal通过Manish Bansal What? Why would one want to generate an MD file from a Microsoft word document? If that’s the first thought you had after reading this title, then let me give you a strong use case.什么? 为什么要从Microsoft …

Android Studio 导入 Android 系统模块并编译和调试

FAQ: AS导入系统模块源码,并且能够编译调试,正常查看java doc ???? Android AOSP基础(五)Android Studio调试系统源码的三种方式http://liuwangshu.cn/framework/aosp/5-debug-aosp.html Android AOSP基础(四&…

2014年ENVI/IDL遥感应用与开发培训班-11月重庆站 開始报名了

主办单位: 中国遥感应用协会 Esri中国信息技术有限公司 内容简单介绍: 依据中国遥感应用协会栾恩杰理事长推动国内遥感技术和应用的指示精神,2014年中国遥感应用协会组织培训交流部与Esri中国信息技术有限公司将共同在多个城市举办以"传…

Python自动化运维:Django之View视图和Template

views详解 http请求中产生两个核心对象: http请求:HttpRequest对象 http响应:HttpResponse对象 (1) HttpRequest对象 当请求一个页面时,Django 创建一个 HttpRequest对象包含原数据的请求。然后 Django 加载…

leetcode491. 递增子序列(回溯算法)

给定一个整型数组, 你的任务是找到所有该数组的递增子序列&#xff0c;递增子序列的长度至少是2。 示例: 输入: [4, 6, 7, 7] 输出: [[4, 6], [4, 7], [4, 6, 7], [4, 6, 7, 7], [6, 7], [6, 7, 7], [7,7], [4,7,7]] 代码 class Solution {List<List<Integer>>…

java重入锁,再探JAVA重入锁

之前的文章中简单的为大家介绍了重入锁JAVA并发之多线程基础(2)。这里面也是简单的为大家介绍了重入锁的几种性质&#xff0c;这里我们就去探索下里面是如何实现的。我们知道在使用的时候&#xff0c;必须锁先有定义&#xff0c;然后我们再拿着当前的锁进行加锁操作&#xff0c…

azure服务器_如何使用Azure Functions和SendGrid构建无服务器报表服务器

azure服务器It’s 2018 and I just wrote a title that contains the words “Serverless server”. Life has no meaning.那是2018年&#xff0c;我刚刚写了一个标题&#xff0c;其中包含“无服务器服务器”一词。 生活没有意义。 Despite that utterly contradictory headli…

【GoWeb开发实战】Cookie

cookie Web开发中一个很重要的议题就是如何做好用户的整个浏览过程的控制&#xff0c;因为HTTP协议是无状态的&#xff0c;所以用户的每一次请求都是无状态的&#xff0c;我们不知道在整个Web操作过程中哪些连接与该用户有关&#xff0c;我们应该如何来解决这个问题呢&#xff…

PhotoKit 照片库的管理-获取图像

PHAsset部分属性解析 1、HDR 和全景照片 mediaSubtypes 属性验证资源库中的图像在捕捉时是否开启了 HDR&#xff0c;拍摄时是否使用了相机应用的全景模式。 2、收藏和隐藏资源 要验证一个资源是否被用户标记为收藏或被隐藏&#xff0c;只要检查 PHAsset 实例的 favorite 和 hid…

cmail服务器安装后无法登录的解决办法

安装cmailserver 5.4.6软件安装、注册都非常顺利&#xff0c;webmail页面也都正常打开&#xff0c;但是一点“登录”就提示错误&#xff1a; Microsoft VBScript 运行时错误 错误 800a01ad ActiveX 部件不能创建对象: CMailCOM.POP3.1 /mail/login.asp&#xff0c;行 42 点“…

matlab对人工智能,MATLAB与人工智能深度学习和机器学习.PDF

MATLAB与人工智能深度学习和机器学习MATLAB 与人工智能&#xff1a;深度学习有多远&#xff1f;© 2017 The MathWorks, Inc.1机器学习8机器学习无处不在▪ 图像识别 [TBD]▪ 语音识别▪ 股票预测▪ 医疗诊断▪ 数据分析▪ 机器人▪ 更多……9什么是机器学习&#xff1f;机…

leetcode1471. 数组中的 k 个最强值(排序)

给你一个整数数组 arr 和一个整数 k 。 设 m 为数组的中位数&#xff0c;只要满足下述两个前提之一&#xff0c;就可以判定 arr[i] 的值比 arr[j] 的值更强&#xff1a; |arr[i] - m| > |arr[j] - m| |arr[i] - m| |arr[j] - m|&#xff0c;且 arr[i] > arr[j] 请返回…

Spring中WebApplicationInitializer的理解

现在JavaConfig配置方式在逐步取代xml配置方式。而WebApplicationInitializer可以看做是Web.xml的替代&#xff0c;它是一个接口。通过实现WebApplicationInitializer&#xff0c;在其中可以添加servlet&#xff0c;listener等&#xff0c;在加载Web项目的时候会加载这个接口实…

使用fetch封装请求_关于如何使用Fetch API执行HTTP请求的实用ES6指南

使用fetch封装请求In this guide, I’ll show you how to use the Fetch API (ES6) to perform HTTP requests to an REST API with some practical examples you’ll most likely encounter.在本指南中&#xff0c;我将向您展示如何使用Fetch API(ES6 )来执行对REST API的 HTT…

hadoop集群中客户端修改、删除文件失败

这是因为hadoop集群在启动时自动进入安全模式 查看安全模式状态&#xff1a;hadoop fs –safemode get 进入安全模式状态&#xff1a;hadoop fs –safemode enter 退出安全模式状态&#xff1a;hadoop fs –safemode leave转载于:https://www.cnblogs.com/lishengnan/p/a123.ht…

OpenStack nova-network 支持多vlan技术实现片段代码

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748

Rest API

什么是接口测试 接口测试又称 API 测试 Application Programming Interface 接口测试是测试系统组件间接口的一种测试。重点关注数据传递。 接口测试一般会用于多系统间交互开发&#xff0c;或者拥有多个子系统的应用系统开发的测试。 为什么要做接口测试 很多系统关联都是基于…

php循环checkbox,php循环删除checkbox | 学步园

一、首先要了解sql语句$SQLdelete from user where id in (1,2,4);表单大概是&#xff1a;form action methodpost input nameID_Dele[] typecheckbox idID_Dele[] value1input nameID_Dele[] typecheckbox idID_Dele[] value2input nameID_Dele[] type首先要了解sql语句$SQL&q…

leetcode1451. 重新排列句子中的单词(排序)

「句子」是一个用空格分隔单词的字符串。给你一个满足下述格式的句子 text : 句子的首字母大写 text 中的每个单词都用单个空格分隔。 请你重新排列 text 中的单词&#xff0c;使所有单词按其长度的升序排列。如果两个单词的长度相同&#xff0c;则保留其在原句子中的相对顺序…

Java+Oracle实现事务——JDBC事务

J2EE支持JDBC事务、JTA事务和容器事务事务&#xff0c;这里说一下怎样实现JDBC事务。 JDBC事务是由Connection对象所控制的&#xff0c;它提供了两种事务模式&#xff1a;自己主动提交和手动提交&#xff0c;默认是自己主动提交。 自己主动提交就是&#xff1a;在JDBC中。在一个…