查看openssl版本
/usr/bin/openssl version
OpenSSL 1.0.2k-fips 26 Jan 2017
OpenSSL升级脚本脚本
update_openssl.sh
#!/bin/bash
#auth:chenl
#version:v1.0
#func:openssl 升级
# 定义安装目录、及日志信息
. /etc/init.d/functions
[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1
log_dir=/root/log/
log_file=openssl.log
VERSION=1.1.1l
openssl_url=https://www.openssl.org/source/openssl-${VERSION}.tar.gz
#openssl_url=https://www.openssl.org/source/openssl-1.1.1i.tar.gz
openssl_name=$(echo $openssl_url|awk -F'/' '{print $NF}')
clear
cat <<EOF
+++++++++ openssl updata +++++++++
EOF
# 传入内容,格式化内容输出,可以传入多个参数,用空格隔开
output_msg() {
for msg in $*;do
action $msg /bin/true
done
}
#判断软件依赖报
check_yum_command() {
output_msg "命令检查:$1"
hash $1
if [ $? -eq 0 ];then
echo "`date +%F' '%H:%M:%S` check command $1 ">>${log_dir}${log_file} && return 0
else
yum -y install $1 >/dev/null 2>&1
fi
}
#判断并创建目录
create_dir() {
output_msg "工作目录创建"
mkdir ${log_dir}
}
#软件包拉取
get_openssl() {
output_msg "软件包拉取"
wget ${openssl_url} --no-check-certificate
}
#openssl部署安装
install_openssl() {
output_msg "install openssl"
tar -xf ${openssl_name}
cd $(VERSION)
./config
make && make install
mv /usr/bin/openssl /usr/bin/openssl.bak
ln -sf /usr/local/bin/openssl /usr/bin/openssl
echo "/usr/local/lib64" >> /etc/ld.so.conf
ldconfig -v
rm -rf /usr/bin/openssl.bak
}
#openssl旧版本删除
delete_openssl() {
output_msg "软件卸载"
openssl_bag=`rpm -qa | grep openssl-1.`
rpm -e --nodeps ${openssl_bag}
}
main() {
create_dir
check_yum_command gcc
delete_openssl
get_openssl
install_openssl
}
main
再次查看openssl版本
/usr/bin/openssl version
OpenSSL 1.1.1l 24 Aug 2021