#!/bin/bash
#################################################################
###### update openssl openssh scirpt #########
##### Author:Lixw #####
###### Date:2020/09/27 #####
###### LastModified:2020/09/27 #######
#### Warning:start telnet service before use the script #####
#################################################################
####################################################################################
# update openssh and openssl
#########
#####
##
####################################################################################
#Determine whether the current system installed gcc compiler tools
# Test list
# RedHat5,RedHat6,RedHat7,CentOS5,CentOS6,CentOS7
install_dir=`pwd`
zlib_version="zlib-1.2.11"
openssl_version="openssl-1.1.1h"
openssh_version="openssh-8.4p1"
#gcc_path=`which gcc`
#gcc_name=`basename $gcc_path`
DATE=$(date +%Y%m%d)
if ! rpm -qa|egrep 'which|util-linux' &> /dev/null || ! rpm -qa|grep util-linux &> /dev/null; then
echo "which is not installed" && exit
fi
#ADD USER
USER_COUNT=`cat /etc/passwd | grep '^lixw:' -c`
USER_NAME='lixw'
if [ $USER_COUNT -ne 1 ]
then
useradd $USER_NAME
echo "Wisedu@123" | passwd $USER_NAME --stdin
else
echo 'user exits'
exit
fi
# OS TYPE
#Distributor_ID=$(lsb_release -i)
# OS Version
OSVersion='cat /etc/redhat-release |cut -d'.' -f1'
if which lsb_release &> /dev/null; then
Distributor=`lsb_release -i|cut -c 17-`
else
echo "starting install redhat-lsb"
if [ "$OSVersion" != "CentOS Linux release 7" ];then
rpm -Uvh ${install_dir}/centos7_lsb/*.rpm --nodeps --force
Distributor=`lsb_release -i|cut -c 17-`
else
rpm -Uvh ${install_dir}/redhat7_lsb/*.rpm --nodeps --force
Distributor=`lsb_release -i|cut -c 17-`
fi
fi
Distributor_VE=$(lsb_release -a|grep Release|tr -cd '[0-9.]'|cut -d'.' -f1)
# Determine whether the root user
userid=`id -u`
if [ "$userid" -ne 0 ]; then
echo "sorry,only root can execute the script. "
exit
fi
# SET SELINUX=disabled
if [ "$Distributor" != "SUSE LINUX" ]; then
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
setenforce 0
# pam-devel,tcp_wrappers-devel need be installed, Otherwise, the software will install failure
# Support for tcpwrappers/libwrap has been removed in openssh6.7
if ! rpm -qa|grep pam-devel &>/dev/null; then
echo "pam-devel is not installed && starting install"
rpm -ivh ${install_dir}/other/pam-devel-1.1.1-24.el6.x86_64.rpm --nodeps
fi
fi
# Check whether to open the xinetd service
if ! rpm -qa|grep xinetd &>/dev/null; then
echo "xinetd is not running && starting install"
rpm -ivh ${install_dir}/other/xinetd-2.3.14-39.el6_4.x86_64.rpm
fi
# Check whether to open the telnet service
if ! rpm -qa|grep telnet-server &>/dev/null; then
echo "telnet service is not running && starting install"
rpm -ivh ${install_dir}/other/telnet-server-0.17-47.el6_3.1.x86_64.rpm
fi
# SET TELNET=ENABLE
sed -i '/disable/s/yes/no/' /etc/xinetd.d/telnet
service xinetd restart
chkconfig xinetd on
# Determine whether to install gcc package
if which gcc &> /dev/null; then
echo "gcc is installed----------------[yes]"
else
echo "gcc is not installed && starting install"
if (("$Distributor_VE" == "7")) ; then
rpm -Uvh ${install_dir}/gcc_os7/*.rpm --nodeps --force
else
rpm -Uvh ${install_dir}/gcc_os56/*.rpm --nodeps --force
fi
fi
# stop sshd service
netstat -tnlp | grep -w 22
RETVAL4=$?
if [ $RETVAL4 -eq 0 ]; then
service sshd stop
echo "stop sshd service --------------[yes]"
fi
if [ -e /etc/init.d/sshd ]; then
cp /etc/init.d/sshd /root
fi
# remove openssh*.rpm if exists
if rpm -qa | grep openssh &> /dev/null; then
rpm -qa | grep openssh > openssh_list.txt
while read line
do
rpm -e $line --nodeps
echo "remove $line success------------[yes]"
done < openssh_list.txt
fi
echo "###########install zlib ##################"
tar -zxvf "${install_dir}/zlib/${zlib_version}.tar.gz" > /dev/null
cd $zlib_version
./configure --prefix=/usr/local/zlib-1.2.11 --shared
RETVAL5=$?
if [ $RETVAL5 -ne 0 ]; then
echo "Configure zlib has encountered an error"
exit
fi
make
RETVAL6=$?
if [ $RETVAL6 -ne 0 ]; then
echo "make zlib has encountered an error"
exit
fi
make install
echo \/usr/local/zlib-1.2.11/lib\ >>/etc/ld.so.conf
ldconfig -v | grep zlib
echo "#########################################################"
echo "################ #################"
echo "################ zlib install success #################"
echo "################ #################"
echo "#########################################################"
sleep 2
echo "############### install openssl ###############"
tar -zxvf "${install_dir}/openssl/${openssl_version}.tar.gz" > /dev/null
cd $openssl_version
./config shared zlib-dynamic --prefix=/usr/local/openssl-1.1.1h --with-zlib-lib=/usr/local/zlib-1.2.11/lib --with-zlib-include=/usr/local/zlib-1.2.11/include
RETVAL7=$?
if [ $RETVAL7 -ne 0 ]; then
echo "Configure openssl has encountered an error"
exit
fi
make
RETVAL8=$?
if [ $RETVAL8 -ne 0 ]; then
echo "make openssl has encountered an error"
exit
fi
make install
if [ -e /usr/bin/openssl ]; then
mv /usr/bin/openssl /usr/bin/openssl.OFF && ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
else
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
fi
if [ -e /usr/include/openssl ]; then
mv /usr/include/openssl /usr/include/openssl.OFF && ln -s /usr/local/ssl/include/openssl /usr/include/openssl
else
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
fi
## Add "/usr/local/ssl/lib" to /etc/ld.so.conf
ssl_lib=`grep -w "/usr/local/openssl-1.1.1h/lib" /etc/ld.so.conf`
if [ ! -e "$ssl_lib" ]; then
echo \/usr/local/openssl-1.1.1h/lib\ >>/etc/ld.so.conf
fi
ldconfig -v |grep openssl
echo "#########################################################"
echo "################ #################"
echo "################ openssl install sucess ################"
echo "################ #################"
echo "#########################################################"
sleep 2
echo "############### install openssh ################"
if [ -e /etc/ssh ]; then
mv /etc/ssh /etc/ssh_$DATE
fi
tar -zxvf "${install_dir}/openssh/${openssh_version}.tar.gz" > /dev/null
cd $openssh_version
if [ "$Distributor" != "SUSE LINUX" ]; then
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-ssl-dir=/usr/local/openssl-1.1.1h --with-md5-passwords --mandir=/usr/share/man --with-zlib=/usr/local/zlib-1.2.11 --without-openssl-header-check
else
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/openssl-1.1.1h --with-md5-passwords --mandir=/usr/share/man --with-zlib=/usr/local/zlib-1.2.11 --without-openssl-header-check
fi
RETVAL9=$?
if [ $RETVAL9 -ne 0 ]; then
echo "Configure openssh has encountered an error"
exit
fi
make
RETVAL10=$?
if [ $RETVAL10 -ne 0 -a $RETVAL10 -ne 0 ]; then
echo "make openssh has encountered an error"
exit
fi
make install
if [ "$Distributor" == "SUSE LINUX" ]; then
cd contrib/suse
cp rc.sshd /etc/init.d/sshd
chmod +x /etc/init.d/sshd
chkconfig --add sshd
else
cd contrib/redhat
cp sshd.init /etc/init.d/sshd
chmod +x /etc/init.d/sshd
chkconfig --add sshd
fi
#A generic PAM configuration is included as "contrib/sshd.pam.generic",
#you may need to edit it before using it on your system.
cd ..
if [ "$Distributor" != "SUSE LINUX" ]; then
cp sshd.pam.generic /etc/pam.d/sshd
sed -i 's/\/lib\/security\///g' /etc/pam.d/sshd
fi
# Modify /etc/ssh/sshd_config
# Backup /etc/ssh/sshd_config
cp -p /etc/ssh/sshd_config
没有合适的资源?快使用搜索试试~ 我知道了~
update_openssh
共50个文件
rpm:43个
gz:6个
sh:1个
需积分: 13 0 下载量 22 浏览量
2022-04-08
21:08:11
上传
评论
收藏 101.87MB RAR 举报
温馨提示
openssh升级脚本,之前写了一个升级的经验分享,后来因为要升级的系统过多,就写了一个简单的脚本用来减轻自己的工作量,大家需要可以下载。备注:只用于RedHat5,RedHat6,RedHat7,CentOS5,CentOS6,CentOS7
资源详情
资源评论
资源推荐
收起资源包目录
update_openssh.rar (50个子文件)
update_openssh
gcc_os7
glibc-headers-2.17-307.el7.1.x86_64.rpm 689KB
libmpc-1.0.1-3.el7.x86_64.rpm 51KB
mpfr-3.1.1-4.el7.x86_64.rpm 203KB
kernel-headers-3.10.0-1127.el7.x86_64.rpm 8.94MB
glibc-static-2.17-307.el7.1.x86_64.rpm 1.56MB
gcc-4.8.5-39.el7.x86_64.rpm 16.18MB
glibc-utils-2.17-307.el7.1.x86_64.rpm 227KB
glibc-devel-2.17-307.el7.1.x86_64.rpm 1.07MB
glibc-common-2.17-307.el7.1.x86_64.rpm 11.5MB
glibc-2.17-307.el7.1.x86_64.rpm 3.64MB
cpp-4.8.5-39.el7.x86_64.rpm 5.95MB
openssh
openssh-5.3p1-94.el6.x86_64.rpm 258KB
openssh-askpass-5.3p1-94.el6.x86_64.rpm 54KB
openssh-8.4p1.tar.gz 1.66MB
openssh-server-5.3p1-94.el6.x86_64.rpm 311KB
openssh-clients-5.3p1-94.el6.x86_64.rpm 402KB
gcc_os56
5kernel-headers-2.6.32-431.el6.x86_64.rpm 2.83MB
7glibc-devel-2.12-1.132.el6.x86_64.rpm 978KB
3mpfr-2.4.1-6.el6.x86_64.rpm 156KB
10gcc-c++-4.4.7-4.el6.x86_64.rpm 4.73MB
6glibc-headers-2.12-1.132.el6.x86_64.rpm 608KB
8gcc-4.4.7-4.el6.x86_64.rpm 10.08MB
2cloog-ppl-0.15.7-1.2.el6.x86_64.rpm 93KB
1ppl-0.10.2-11.el6.x86_64.rpm 1.26MB
4cpp-4.4.7-4.el6.x86_64.rpm 3.74MB
9libstdc++-devel-4.4.7-4.el6.x86_64.rpm 1.6MB
new_script.sh 10KB
other
xinetd-2.3.14-39.el6_4.x86_64.rpm 121KB
pam-devel-1.1.8-23.el7.x86_64.rpm 185KB
pam-devel-1.1.1-24.el6.x86_64.rpm 205KB
perl-5.30.0.tar.gz 3.14MB
pam-devel-0.99.6.2-6.el5_5.2.x86_64.rpm 187KB
pam-devel-1.1.8-22.el7.x86_64.rpm 184KB
pam-1.1.8-22.el7.x86_64.rpm 720KB
telnet-server-0.17-47.el6_3.1.x86_64.rpm 37KB
pam-devel-1.1.1-20.el6.x86_64.rpm 206KB
pam-1.1.8-23.el7.x86_64.rpm 721KB
centos7_lsb
redhat-lsb-4.1-27.el7.centos.1.x86_64.rpm 25KB
redhat-lsb-printing-4.1-27.el7.centos.1.x86_64.rpm 16KB
redhat-lsb-desktop-4.1-27.el7.centos.1.x86_64.rpm 20KB
redhat-lsb-cxx-4.1-27.el7.centos.1.x86_64.rpm 16KB
redhat-lsb-core-4.1-27.el7.centos.1.x86_64.rpm 38KB
zlib
zlib-1.2.11.tar.gz 593KB
openssl
openssl-devel-1.0.1e-15.el6.i686.rpm 1.16MB
openssl-1.0.2u.tar.gz 5.11MB
openssl-1.1.1h.tar.gz 9.36MB
openssl-1.1.1g.tar.gz 9.35MB
openssl-devel-1.0.1e-15.el6.x86_64.rpm 1.16MB
openssl-1.0.1e-15.el6.i686.rpm 1.5MB
openssl-1.0.1e-15.el6.x86_64.rpm 1.5MB
共 50 条
- 1
努力搬砖的鱼
- 粉丝: 19
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 污水监控 环境监测 云平台
- JAVA实现捡金币闯关小游戏(附源码).zip
- FPGA滤波器设计教程,教你快速设计FIR滤波器并利用IP Core实现 清单: 教程文档一份,示例代码工程一份 文档性质产品
- 视频录制和实时流OBS-Studio-30.2.3-Windows
- 农业经济学名词解释.doc
- 汽车百年发展史.doc
- 浅析幼儿园利用乡土教育资源开发园本课程内容的尝试.doc
- 热电厂锅炉试题.doc
- 三年级数学[下册]脱式计算题300题.doc
- 生物圈是最大的生态系统教学案.doc
- 上学期期末考试七年级语文试卷.doc
- 摄影基础试题-学生版[多选].doc
- 税收不安全因素管理指标+解释.doc
- 水利工程概论复习试题及答案.doc
- 统编版二年级上册语文教学计划.doc
- 污染控制微生物学试题.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0