场景:公司使用的大数据集群云服务器,安全扫描出严重漏洞,扫描漏洞如下:
安全漏洞扫描报告

端口 协议 服务 严重等级 漏洞
ICMP ICMP timestamp请求响应漏洞
UDP 允许Traceroute探测
80 TCP http 严重
严重
严重
严重
严重
OpenSSL 安全漏洞(CVE-2022-0778)
Apache HTTP Server 环境问题漏洞(CVE-2022-22720)
Apache HTTP Server 输入验证错误漏洞(CVE-2022-22719)
Apache HTTP Server 缓冲区错误漏洞(CVE-2022-23943)
Apache HTTP Server 输入验证错误漏洞(CVE-2022-22721)
可通过HTTP获取远端WWW服务信息
9010 TCP rmiregistry 检测到 Java RmiRegistry服务

当前服务版本号

软件名称 版本号
Apache 2.4.52
OpenSSL 1.1.1m

按照漏洞报告描述此次安全漏洞影响范围涉及Apache Http Server 2.4.52及之前版本,解决此漏洞需要进行http版本升级,Apache官网查看有最新版本2.4.53。
尝试了两种解决方法:
第一种是通过下载源码包编译安装替换新版本,编译安装成功,但是老版本的httpd服务包.rpm存在且不好删除(被cloudera-scm-agent所依赖),后续yum安装的库如果需要依赖httpd服务也是依赖的老版本。
第二种是通过配置codeIT库源,通过yum来更新httpd服务,推荐此方法实现。

方法一:源码编译安装

下载httpd、apr、pcre源码包

window上下载最新安装包 httpd-2.4.53.tar.gz,上传服务器,解压到/opt/httpd-2.4.53。

官网下载arp ,下载得到apr-util-1.6.1.tar.gz和apr-1.7.0.tar.gz ,上传服务器,解压放到/opt目录中,更名为apr 和 apr-util。

pcre下载,本文选用当时最新的10.37。

安装

安装参考官网安装教程。
编译安装apr

# 解压APR
tar -zxf /opt/apr-1.7.0.tar.gz
mv apr-1.7.0 apr
# 进入apr目录,配置、编译、安装
cd /opt/apr
./configure --prefix=/usr/local/apr
make && make install

编译安装apr-util

# 解压APR-Util
tar -zxf /opt/apr-util-1.6.1.tar.gz
mv apr-util-1.6.1 apr-util
# 进入apr-util目录,配置、编译、安装
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install

报错解决

#报错:apr-util make时出错, [xml/apr_xml.lo] Error 1
#解决:原因是缺少expat库,yum install expat-devel即可```**编译安装pcre2**```powershell
# 解压pcre
tar -zxf pcre2-10.37.tar.gz
mv pcre2-10.37 pcre2
# 进入pcre2目录,配置、编译、安装
cd /opt/pcre2
./configure --prefix=/usr/local/pcre2
make && make install# 创建连接将pcre2-config放到/usr/bin目录。
ln -s /usr/local/pcre2/bin/pcre2-config /usr/bin/pcre2-config

报错解决

#报错:http config时出错,error:Did not find script script at pcre2-config。
#解决:将pcre2编译安装目录/usr/local/pcre2/bin/pcre2-config文件链接到/usr/bin/pcre2-config。
ln -s /usr/local/pcre2/bin/pcre2-config /usr/bin/pcre2-config

编译安装httpd

# 解压httpd
tar -zxf /opt/httpd-2.4.53.tar.gz
mv httpd-2.4.53 httpd#进入安装目录,配置文件,指定安装目录/usr/local/apache-http ,指定openssl安装目录,指定apr安装目录,指定apr-util安装目录,指定pcre安装目录
cd /opt/httpd
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre2 --enable-so --enable-rewrite --enable-module=so
#参数说明
#—prefix 代表服务安装目录
#—with 代表依赖的工具包的目录
#—enable-so 代表静态安装# 编译安装
make && make install# 修改编译安装目录/usr/local/apache2/conf/httpd.conf文件
#设置监听端口80
ServerName localhost:80
#注释掉如下内容
#<Directory />
#    AllowOverride none
#    Require all denied
#</Directory>#修改DocumentRoot
DocumentRoot "/var/www/html"
<Directory "/var/www/html">#httpd 停止命令:
httpd stop
#httpd 启动命令
httpd start
#检查httpd 服务是否已停止
ps -ef|grep httpd# 检查httpd版本命令,如果是全局的,也可以直接使用 httpd -v
httpd -v

报错解决

#报错 1:http make时出错,提示如下
······························
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_GetErrorCode'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetEntityDeclHandler'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ParserCreate'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetCharacterDataHandler'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ParserFree'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetUserData'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_StopParser'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_Parse'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ErrorString'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetElementHandler'
collect2: error: ld returned 1 exit status# 解决:缺少了xml相关的库,需要安装libxml2-devel包。步骤如下:
# 直接安装并不能解决问题,因为httpd调用的apr-util已经安装好了,但是apr-util并没有libxml2-devel包支持,要在删除已安装的apr-util并清空缓存重编译安装。
yum install -y libxml2-devel
rm -rf /usr/local/apr-util
cd /opt/apr-util
make clean
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install# 报错2:apachectl -k start启动报错
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1.185. Set the 'ServerName' directive globally to suppress this message
修改httpd安装目录下/usr/local/apache2/conf/httpd.conf文件,修改如下:
ServerName localhost:80# 报错3:systemctl start httpd 失败并提示Unit httpd.service could not be found.
#解决:需要将编译安装的httpd服务添加到linux系统自动服务。
#(1)将/usr/local/apache2/bin/apachectl文件拷贝到 /etc/rc.d/init.d 更名为httpd
cp /usr/local/apache2/bin/apachectl  /etc/rc.d/init.d/httpd
#(2)编辑脚本httpd,在#!/bin/sh第二行添加如下注释。
# chkconfig: 35 61 61
# description: Apache

方法二:httpd服务升级 codeit库

此方法需要服务器能访问公网。测试 ping www.baidu.com。

#下载yum repo,为安装epel-release做源。
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo# 清除所有yum缓存元数据
yum clean all
# 重新建立元数据
yum makecache# 开启EPEL EPEL提供了CodeIT库需要的依赖
sudo yum install -y epel-release# 安装codeIT库 这个库提供了最新版本的服务器软件(Apache & Nginx),在/etc/yum.repos.d目录下生成codeit.el7.repo
cd /etc/yum.repos.d
wget https://repo.codeit.guru/codeit.el`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo# 再次查看apache包版本,可以看到新版本的信息。
yum info httpd# 更新httpd
yum update httpd# 查看版本
httpd -v# 重启httpd
systemctl restart httpd# 查看安装版本,此时rpm包都为最新版本,可被yum安装的其他服务所依赖
rpm -qa | grep httpd

如果服务器网络受限,需要通过跳板机来进行联网。
跳板机安装使用CCProxy
下载免费版:http://www.ccproxy.com/download.htm
设置跳板机IP:在“设置”里,勾选自动检测,此IP为跳板机内网IP。然后“启动”即可。云主机进行相关配置。
云服务器主机进行配置:

/etc/yum.conf 文件末尾添加 porxy=http://跳板机内网ip:808
/etc/wgetrc 文件末尾添加 http_proxy=http://跳板机内网ip:808


Apache Http Server安全漏洞解决相关推荐

  1. Apache HTTP Server拒绝服务漏洞

    CNNVD编号:CNNVD-201108-440 CVE编号: CVE-2011-3192 漏洞 Apache HTTP Server是一款开源的流行的HTTPD服务程序. 当处理包含大量Ranges ...

  2. Apache Shiro Java 反序列化漏洞解决修复记录

    收到了阿里的警告 阿里漏洞扫描系统 解决办法 借鉴了 https://blog.csdn.net/Fly_hps/article/details/106112692 下载windows 扫描工具 ht ...

  3. Apache Log4j Server 反序列化漏洞(CVE-2017-5645)

    文章目录 一.漏洞介绍 1.1 漏洞介绍 1.2 影响版本 二.漏洞复现 三.防御措施 一.漏洞介绍 1.1 漏洞介绍   Apache的一个开源的日志记录库,通过使用Log4j语言接口,可以在C.C ...

  4. 解决zookeeper启动失败Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain报错

    zookeeper的默认日志在:xxxxx/apache-zookeeper-3.5.9/logs目录下,完整报错名称为:Error: Could not find or load main clas ...

  5. org.apache.hadoop.ipc.Client: Retrying connect to server异常的解决

    org.apache.hadoop.ipc.Client: Retrying connect to server异常的解决 参考文章: (1)org.apache.hadoop.ipc.Client: ...

  6. apache AH01630: client denied by server configuration错误解决方法

    apache AH01630: client denied by server configuration错误解决方法 出现这个错误的原因是,apache2.4 与 apache2.2 的虚拟主机配置 ...

  7. CVE-2021-42013:Apache HTTP Server目录遍历漏洞

    前言 漏洞原理 该漏洞是由于在Apache HTTP Server 2.4.50版本中对CVE-2021-41773修复不够完善,攻击者可利用该漏洞绕过修复补丁,并利用目录穿越攻击访问服务器中一些文件 ...

  8. Apache HTTP Server 路径穿越漏洞复现(CVE-2021-41773 )

    高危 1.漏洞简介 Apache HTTPd 是Apache基金会开源的一款HTTP服务器.2021年10月8日Apache HTTPd官方发布安全更新,披露CVE-2021-41773 Apache ...

  9. Apache Http Server 解决不同域名共用服务器80端口问题

    今天部署网站时,用户突然说他们只有一台服务器,一个公网IP,而且现在服务器上已经有一个发布中的网站(显然80端口已被占用),让我们想想办法怎么样才能部署我们的项目到他们服务器上,而且使用同一台服务器, ...

  10. Apache HTTP Server 2.4.49 路径穿越漏洞复现及利用

    漏洞介绍 Apache HTTP Server是Apache基金会开源的一款流行的HTTP服务器.在其2.4.49版本中,引入了一个路径穿越漏洞,满足下面两个条件的Apache服务器将会受到影响: 版 ...

最新文章

  1. 为什么汉字不能当密码,假如用汉字做密码,又会怎样?
  2. nb移动udp_hwasy-geomagnetism-nbiot
  3. EditText 自动保留两位小数
  4. 中间表增加额外字段_如何定制分表中间件
  5. java基础—方法重载(overload)
  6. 从濒临解散到浴火重生,OceanBase 这十年经历了什么?
  7. 心理学博士vs计算机博士,零基础跨专业考心理学博士,可以给我一些建议吗?...
  8. 1、MapReduce理论简介
  9. 开源开发工具_3个开源行为驱动的开发工具
  10. 真正支配整个世界的十种算法
  11. c# 类属性和方法
  12. 移动端和PC端弹出遮罩层后,页面禁止滚动的解决方法及探究
  13. 计算机网络之验证性实验(tracert+ARP)
  14. java 批量下载ftp文件_JAVA实现FTP文件批量下载文件到本地文件夹
  15. 测试手机功耗软件,借助软件测试手机基本峰值功耗
  16. Java面试智力题逻辑题汇总2021
  17. yml文件读取方式_1
  18. VUE启动报错:Error: The project seems to require yarn but it‘s not installed
  19. python3读文件中文_详解Python3解决读取中文文件txt编码的问题
  20. linux 2.6内核镜像,Linux2.6内核镜像的构建过程

热门文章

  1. 当棋牌遇到Web3,Immortal Games能让国际象棋流行起来么
  2. android_5.0简介
  3. easyar android 开发,【EasyAR学习】安装Android SDK
  4. android 设置ios 字体大小设置,iPhone11字体大小怎么调?苹果手机调节字体大小的三种方法...
  5. DASH.js使用demo(配合ffmpeg和mp4box)
  6. C#调用WPS转换WORD,EXCEL,PPT文件为PDF
  7. keil4找不到c语言头文件路径,keil4中头文件路径设置的方法汇总
  8. hello.java_helloworld怎么写java
  9. odb对象关系映射系统
  10. 逻辑学是计算机科学的一个重要分支,逻辑学在计算机科学中应用.doc