centeros 6 远程升级ssl ssh 的shell脚本
变量说明
SSL_N=openssl-1.0.2p #ssl 版本
SSH_N=openssh-7.9p1 #ssh 版本
ZLIB_N=zlib-1.2.11 # zlib 版本
脚本分为两个,因为升级ssh ssh存在断开问题,需要临时启用telnet继续执行
yum配置采用了ftp yum源,具体配置见我的博客:
https://www.cnblogs.com/levi-w/p/9675157.html
执行步骤:
1 首先在服务器执行openssh-update.telnet.sh
2 telnet 登录服务器,执行openssh-update.sh
脚本详情:
1 openssh-update.telnet.sh
#!/bin/bash
#config yum
export SSL_N=openssl-1.0.2p
export SSH_N=openssh-7.9p1
export ZLIB_N=zlib-1.2.11
cp -r /etc/yum.repos.d /etc/yum.repos.d_bak
rm -rf /etc/yum.repos.d/*
echo "[CenterOS-source]
name=Linux "'$releasever'" - "'$basearch'" - Source
baseurl=ftp://10.1.1.1/pub/cos6
enabled=1
gpgcheck=0" > /etc/yum.repos.d/rhel-source.repo
yum makecache
yum -y install gcc* telnet* pam-devel openssl-devel
##config telnet#一定要测试!
yum -y install telnet*
# disable字段改为no
sed -i '12c disable = no' /etc/xinetd.d/telnet
service xinetd restart
mv /etc/securetty /etc/securetty.bak
read -p "test telnet[y/n]: " number
if [ $number != 'y' ]
then
echo "Error"
exit
fi
echo "please use telnet to countinue"
2 openssh-update.sh
#!/bin/bash
#config yum
export SSL_N=openssl-1.0.2p
export SSH_N=openssh-7.9p1
export ZLIB_N=zlib-1.2.11
##config zlib
cd /opt
tar zxvf /opt/$ZLIB_N.tar.gz
cd /opt/$ZLIB_N/
./configure --prefix=/usr/local/$ZLIB_N -share
cd /opt/$ZLIB_N/
make -j4
make -j4 test
read -p "test $ZLIB_N [y/n]: " number
if [ $number != 'y' ]
then
echo "Error"
exit
fi
make -j4 install
mv /usr/local/$ZLIB_N/lib/libz.a /usr/local/$ZLIB_N/lib/libz.a.bak`date +%y%m%d`
/bin/cp -r /opt/$ZLIB_N/libz.a /usr/local/$ZLIB_N/lib
chmod 644 /usr/local/$ZLIB_N/lib/libz.a
/bin/cp -r /opt/$ZLIB_N/ libz.so.1.2.11 /usr/local/$ZLIB_N/lib
chmod 755 /usr/local/$ZLIB_N/lib/libz.so.1.2.11
mv /usr/local/$ZLIB_N/share/man/man3/zlib.3 /usr/local/$ZLIB_N/share/man/man3/zlib.3.bak`date +%y%m%d`
/bin/cp -r /opt/$ZLIB_N/zlib.3 /usr/local/$ZLIB_N/share/man/man3
mv /usr/local/$ZLIB_N/lib/pkgconfig/zlib.pc /usr/local/$ZLIB_N/lib/pkgconfig/zlib.pc.bak`date +%y%m%d`
cp -r /opt/$ZLIB_N/zlib.pc /usr/local/$ZLIB_N/lib/pkgconfig
chmod 644 /usr/local/$ZLIB_N/lib/pkgconfig/zlib.pc
mv /usr/local/$ZLIB_N/include/zlib.h /usr/local/$ZLIB_N/include/zlib.h.bak`date +%y%m%d`
mv /usr/local/$ZLIB_N/include/zconf.h /usr/local/$ZLIB_N/include/zconf.h.bak`date +%y%m%d`
/bin/cp -r /opt/$ZLIB_N/zlib.h zconf.h /usr/local/$ZLIB_N/include
chmod 644 /usr/local/$ZLIB_N/include/zlib.h /usr/local/$ZLIB_N/include/zconf.h
echo "include ld.so.conf.d/*.conf
## add for update ssh
/usr/local/$ZLIB_N/lib
##add end">>/etc/ld.so.conf
ldconfig -v
ln -s /usr/local/$ZLIB_N /usr/local/zlib
##install openssl
cp -r /usr/lib64/openssl /usr/lib64/openssl_old
cp -r /usr/bin/openssl /usr/bin/openssl_old
cd /opt
tar zxvf /opt/$SSL_N.tar.gz
cd /opt/$SSL_N/
./config zlib-dynamic --prefix=/usr/local/$SSL_N --with-zlib-lib=/usr/local/$ZLIB_N/lib --with-zlib-include=/usr/local/$ZLIB_N/include --shared
make
make test
read -p "test $SSL_N [y/n]: " number
if [ $number != 'y' ]
then
echo "Error"
exit
fi
make install
echo "## add below line to ld.so.conf
/usr/local/$SSL_N/lib
###">>/etc/ld.so.conf
ldconfig -v
ln -s /usr/local/$SSL_N /usr/local/openssl
echo "##config for ssl
export PATH=/usr/local/openssl/bin:"'$PATH'"
###">>/etc/profile
source /etc/profile
openssl version -a
##install openssh
service sshd stop
cp -r /etc/ssh /etc/ssh_old`date +%F`
rpm -qa | grep openssh | xargs rpm -e
cd /opt
tar zxvf /opt/$SSH_N.tar.gz
cd /opt/$SSH_N
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-ssl-dir=/usr/local/$SSL_N --with-md5-passwords --mandir=/usr/share/man --with-zlib=/usr/local/zlib
make && make install
/bin/cp -r ./contrib/redhat/sshd.init /etc/init.d/sshd
chmod +x /etc/init.d/sshd
chkconfig --add sshd
service sshd restart
ssh -V
##PermitRootLogin prohibit-password
#PermitRootLogin yes
cp /etc/ssh/sshd_config /etc/ssh/sshd_config_old`date +%F`
sed -i '33i PermitRootLogin yes' /etc/ssh/sshd_config
service sshd restart
read -p "test SSH [y/n]: " number
if [ $number != 'y' ]
then
echo "Error"
exit
fi
## config telnet close
sed -i '12c disable = yes' /etc/xinetd.d/telnet
#/etc/xinetd.d/telnet
mv /etc/securetty.bak /etc/securetty
service xinetd restart
echo "test telnet"
centeros 6 远程升级ssl ssh 的shell脚本的更多相关文章
- 通过java程序(JSch)运行远程linux主机上的shell脚本
如果您看完文章之后,觉得对您有帮助,请帮我点个赞,您的支持是我不竭的创作动力! 如果您看完文章之后,觉得对您有帮助,请帮我点个赞,您的支持是我不竭的创作动力! 如果您看完文章之后,觉得对您有帮助,请帮 ...
- java连接ssh执行shell脚本
在liunx上写了一个shell脚本,想通过java去调用这个shell脚本,不知道怎么去调用,在网上说使用process这个进程方式,但是我执行机和我shell脚本都不在同一台电脑,老大说java中 ...
- ssh 执行 shell脚本执行jps时:-bash: jps: command not found
转至: https://www.codeleading.com/article/67592908468/ 我构建了hadoop集群.我们一定会写一个shell脚本去每一个节点上去jps,查看每个节点的 ...
- java ssh执行shell脚本
1.添加依赖 com.jcraft:jsch ch.ethz.ganymed:ganymed-ssh2:262 2.获取连接 conn = new Connection(ip, port); conn ...
- 【原】Java程序调用远程Shell脚本
此程序的目的是执行远程机器上的Shell脚本. [环境参数]远程机器IP:192.168.234.123用户名:root密码:rootShell脚本的路径:/home/IFileGenTool/Bak ...
- Java实践 — SSH远程执行Shell脚本(转)
原文地址:http://www.open-open.com/lib/view/open1384351384024.html 1. SSH简介 SSH是Secure Shell的缩写,一 ...
- Java实践 — SSH远程执行Shell脚本
1. SSH简介 SSH是Secure Shell的缩写,一种建立在应用层和传输层基础上的安全协议.SSH在连接和传送过程中会加密所有数据,可以用来在不同系统或者服务器之间进行安全连接 ...
- ssh远程调用之shell脚本远程调用应用程序
1.引子 前几天有一个需求是这样的:本机的shell脚本,通过远程调用另一台机子上的shell脚本,来完成对远程机子上分发的Java程序的执行和其他操作.看上去挺容易,实际上也不难. 第一步:用scp ...
- Java SSH远程执行Shell脚本实现(转)
前言 此程序需要ganymed-ssh2-build210.jar包(下载地址:http://www.ganymed.ethz.ch/ssh2/) 为了调试方便,可以将\ganymed-ssh2-bu ...
随机推荐
- bzoj 2331: [SCOI2011]地板【插头dp】
一开始设计了四种状态,多了一种已经拐弯但是长度为0的情况,后来发现不用,设012表示没插头,没拐弯的插头,拐了弯的插头,然后转移的话12,21,22都不合法,剩下的转移脑补一下即可,ans只能在11, ...
- c++继承汇总(单继承、多继承、虚继承、菱形继承)
多重继承中,一个基类可以在派生层次中出现多次,如果一个派生类有多个直接基类,而这些直接基类又有一个共同的基类,则在最终的派生类中会保留该间接共同基类数据成员的多分同名成员.C++提供虚基类的方法使得在 ...
- Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)
考场上只做出了ABDE C都挂了... 题解: A 题解: 模拟 判断前面一段是否相同,后面一段是否相同,长度是否够(不能有重叠) Code: #include<stdio.h> #inc ...
- 洛谷1387(基础二维dp)
题目很简单,数据也很小,但是思路不妨借鉴:dp[i][j]代表以(i,j)为右下角的最长正方形边长. 类比一维里面设“以XX为结尾的最XXX(所求)”. 另外define不要乱用!尤其这种min套mi ...
- PopupWindow(3)back,home 键无法关闭popupwindow的解决方案
private PopupWindow mPopupWindow; //popup window 一般popuowindow 要都个显示view,本例子中view模拟菜单. private View ...
- jmeter(二十二)jmeter测试Java请求
目的:对Java程序进行测试 目录 一.核心步骤 二.实例 三.JMeter Java Sampler介绍 四.自带Java Request Sampler 一.核心步骤 1.创建一个Java工程: ...
- 基于python的request库,模拟登录csdn博客
以前爬虫用urllib2来实现,也用过scrapy的爬虫框架,这次试试requests,刚开始用,用起来确实比urllib2好,封装的更好一些,使用起来简单方便很多. 安装requests库 ...
- Spark MLlib编程API入门系列之特征提取之主成分分析(PCA)
不多说,直接上干货! 主成分分析(Principal Component Analysis,PCA), 将多个变量通过线性变换以选出较少个数重要变量的一种多元统计分析方法. 参考 http://blo ...
- KMS算法
解题:http://hihocoder.com/problemset/problem/1015 KMP算法是一种改进的字符串匹配算法,由D.E.Knuth,J.H.Morris和V.R.Pratt同时 ...
- html5 input 标签
<!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content ...