写这边文章的原因是上线环境被扫描出两个漏洞
- 1.SSL/TLS协议信息泄漏漏洞(CVE-2016-2183)原理扫描
-
- 1.1.需要修改算法:ssl_ciphers HIGH:!aNULL:!MD5:!3DES;
- 2.Nginx安全漏洞(CVE-2021-23017)
-
- 2.1.需要升级OpenSSL版本,openssl-1.1.1v-1.el7.x86_64.rpm
线上服务器是内网环境,nginx 使用 rpm -ivh nginx-1.22.1-1.el7.ngx.x86_64.rpm安装的(因无法联网很多依赖不能通过yum命令安装),出现上面的漏洞后,发现使用 rpm 安装的nginx 无法指定 OpenSSL版本,只能通过 ./configure --prefix=/usr/local/nginx --with-openssl=/usr/openssl/ 编译方式安装来指定openss
下面给出具体的安装步骤
1.找一台能访问外网的linux服务器,安装依赖下载工具,执行如下命令,下载安装nginx需要的所有依赖,然后把 rpm_0922 文件夹上传到内网服务器
mkdir /root/rpm_0922
cd /root/rpm_0922
yum -y install yum-utils
repotrack gcc gcc-c++ automake autoconf libtool make pcre-devel openssl openssl-devel zlib zlib-devel
2.在内网服务器上,cd 到 rpm_0922目录,安装该目录中所有依赖
rpm -ivh *.rpm --force --nodeps
3.查看OpenSSL安装目录,查看OpenSSL版本以及获取 OPENSSLDIR: “/usr/openssl”
openssl version -a
4.编译安装nginx
tar -xvzf nginx-1.22.1.tar.gz
cd nginx-1.22.1
./configure --prefix=/usr/local/nginx --with-openssl=/usr/openssl/ --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_v2_module
make && make install
5.配置nginx
upstream hapi-ard{server 127.0.0.1:8083;
}server {listen 443 ssl;server_name localhost;access_log /var/log/nginx/host.access.log main;location / {root /usr/share/nginx/html;index index.html index.htm;}location ^~/hapi-ard/{rewrite ^/hapi-ecard-front/(.*)$ /$1 break;proxy_pass http://hapi-ard;proxy_set_header Host $host;proxy_set_header X-Forwarded-Proto https;proxy_set_header X-Forwarded-For $remote_addr;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-DOCUMENT-URI $request_uri;}ssl_certificate /usr/local/nginx/cert/busined.caizyf.com.pem;ssl_certificate_key /usr/local/nginx/cert/busined.caizyf.com.key;ssl_session_timeout 5m;ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!3DES;ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_prefer_server_ciphers on;
}
离线安装nginx的所有依赖我打包好了,下载地址:https://download.csdn.net/download/zhuyu19911016520/88365431?spm=1001.2014.3001.5501