升级OpenSSL修复高危漏洞Heartbleed
背景:
OpenSSL全称为Secure Socket Layer,是Netscape所研发,利用数据加密(Encryption)作技术保障在Internet上数据传输的安全。可确保数据在网络上的传输不会被窃听及截取。
当然,OpenSSL是一个强大的密码库,我们在使用SSL协议的时候不一定非得采用OpenSSL,不过目前基本上都是用的OpenSSL,因为它更安全,使用起来也更简单。
在近期互联网安全协议OpenSSL v1.0.1到1.0.1f的密码算法库中发现了一个非常严重bug(CVE-2014-0160),该bug允许攻击者读取存在bug的系统的64k处理内存,暴露加密流量的密钥,用户的名字和密码,以及访问的内容。这个漏洞被称之为heartbleed,心脏流血。
据solidot 在April 7报道,OpenSSL已经发布了1.0.1g修复bug,Debian发行版也在半小时修复bug,Fedora发布了一个权宜的修正方案。该bug在2011年引入OpenSSL中,使用OpenSSL 0.9.8的发现版本不受影响,但Debian Wheezy、Ubuntu 12.04.4、CentOS 6.5、Fedora 18、SUSE 12.2、OpenBSD 5.4、FreeBSD 8.4和NetBSD 5.0.2之后的版本都收到影响。如果你的允许的系统有如上集中,建议将补丁修复到1.0.1g或以上版本。
修复建议:
1、 如果有使用OpenSSL 1.0.1 到OpenSSL1.0.1f的版本建议升级到OpenSSL1.0.1g或最新的OpenSSL1.0.1h。
2、 使用DEPENSSL_NO_HEARTBEATS参数重新编译低版本的OpenSSL以禁用Heartbleed模块。
3、 删除OpenSSL组件。
升级OpenSSL修复Heartbleed漏洞
由于我们现在用的基本上都是RHEL 5.8或OEL5.8,其OpenSSL的版本为OpenSSL
0.9.8e,是不存在该漏洞的,不过有些新上的项目可能会涉及到,当然他们对于修复这个漏洞的方法都是一样。
详细步骤如下:
1、 查看操作系统版本及OpenSSL版本
-
[root@pru1 ~]# uname -a
-
Linux pru1 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
-
-
[root@pru1 ~]# openssl version
-
OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
2、 下载最新的openssl-1.0.1h.tar.gz源码包
3、 解压缩编译安装
-
[root@pru1 openssl]# ls
-
openssl-1.0.1h.tar.gz
-
[root@pru1 openssl]# tar -zxf openssl-1.0.1h.tar.gz
-
[root@pru1 openssl]# ls
-
openssl-1.0.1h openssl-1.0.1h.tar.gz
-
[root@pru1 openssl]# cd openssl-1.0.1h
-
[root@pru1 openssl-1.0.1h]# ls
-
ACKNOWLEDGMENTS config e_os2.h INSTALL.DJGPP INSTALL.W64 Makefile.org openssl.doxy README.ASN1 tools
-
apps Configure e_os.h INSTALL.MacOS INSTALL.WCE Makefile.shared openssl.spec README.ENGINE util
-
bugs crypto FAQ INSTALL.NW LICENSE makevms.com os2 shlib VMS
-
certs demos include INSTALL.OS2 MacOS ms perl ssl
-
CHANGES doc INSTALL INSTALL.VMS Makefile Netware PROBLEMS test
-
CHANGES.SSLeay engines install.com INSTALL.W32 Makefile.bak NEWS README times
-
[root@pru1 openssl-1.0.1h]# ./config shared zlib
-
Operating system: x86_64-whatever-linux2
-
Configuring for linux-x86_64
-
Configuring for linux-x86_64
-
no-ec_nistp_64_gcc_128 [default] OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir)
-
no-gmp [default] OPENSSL_NO_GMP (skip dir)
-
no-jpake [experimental] OPENSSL_NO_JPAKE (skip dir)
-
no-krb5 [krb5-flavor not specified] OPENSSL_NO_KRB5
-
no-md2 [default] OPENSSL_NO_MD2 (skip dir)
-
no-rc5 [default] OPENSSL_NO_RC5 (skip dir)
-
no-rfc3779 [default] OPENSSL_NO_RFC3779 (skip dir)
-
no-sctp [default] OPENSSL_NO_SCTP (skip dir)
-
no-store [experimental] OPENSSL_NO_STORE (skip dir)
-
no-zlib-dynamic [default]
-
IsMK1MF=0
-
CC =gcc
-
CFLAG =-fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
-
EX_LIBS =-ldl -lz
-
CPUID_OBJ =x86_64cpuid.o
-
BN_ASM =x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o modexp512-x86_64.o
-
DES_ENC =des_enc.o fcrypt_b.o
-
AES_ENC =aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o
-
BF_ENC =bf_enc.o
-
CAST_ENC =c_enc.o
-
RC4_ENC =rc4-x86_64.o rc4-md5-x86_64.o
-
RC5_ENC =rc5_enc.o
-
MD5_OBJ_ASM =md5-x86_64.o
-
SHA1_OBJ_ASM =sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o
-
RMD160_OBJ_ASM=
-
CMLL_ENC =cmll-x86_64.o cmll_misc.o
-
MODES_OBJ =ghash-x86_64.o
-
ENGINES_OBJ =
-
PROCESSOR =
-
RANLIB =/usr/bin/ranlib
-
ARFLAGS =
-
PERL =/usr/bin/perl
-
SIXTY_FOUR_BIT_LONG mode
-
DES_UNROLL used
-
DES_INT used
-
RC4_CHUNK is unsigned long
-
e_os2.h => include/openssl/e_os2.h
-
making links in crypto...
-
make[1]: Entering directory `/root/openssl/openssl-1.0.1h/crypto\
4、 将新编译的openssl替换系统老版本的
-
[root@pru1 openssl-1.0.1h]# rm -rf /usr/bin/openssl
-
[root@pru1 openssl-1.0.1h]# rm -rf /usr/include/openssl/
-
[root@pru1 openssl-1.0.1h]# ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
-
[root@pru1 openssl-1.0.1h]# ln -s /usr/local/ssl/include/openssl/ /usr/include/openssl
5、 配置文件搜索路径
-
[root@pru1 openssl-1.0.1h]# echo "/usr/local/ssl/lib/" >> /etc/ld.so.conf
-
[root@pru1 openssl-1.0.1h]# ldconfig -v |grep openssl
-
libgnutls-openssl.so.13 -> libgnutls-openssl.so.13.0.6
-
libgnutls-openssl.so.13 -> libgnutls-openssl.so.13.0.6
6、 查看安装完成后的最新版本
-
[root@pru1 openssl-1.0.1h]# openssl version
-
OpenSSL 1.0.1h 5 Jun 2014
-
[root@pru1 openssl-1.0.1h]# openssl version -a
-
OpenSSL 1.0.1h 5 Jun 2014
-
built on: Sun Jun 8 09:05:39 CST 2014
-
platform: linux-x86_64
-
options: bn(64,64) rc4(16x,int) des(idx,cisc,16,int) idea(int) blowfish(idx)
-
compiler: gcc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
-
OPENSSLDIR: \"/usr/local/ssl\"
-
[root@pru1 openssl-1.0.1h]#
7、 至此已全部完成OpenSSL的升级工作
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/20674423/viewspace-1177997/
,如需转载,请注明出处,否则将追究法律责任。