升级之前需要注意几点:

1 必须要有自己的镜像,必须自己做好本地yum源(可以连接外网,能够有网络yum源也可以)

2 配置好基本的升级环境。在升级openssh时需要依赖openssl和zlib。一般系统自带的版本都比较低,而要升级到较高版本的openssh,就对依赖软件的版本有要求

一般试用源码编译的方式进行升级。需要编译则必须要有编译环境

3 依次按顺序升级zlib,openssl和openssh

4 在安装zlib之前,需要试用telnet连接到服务器,并且需要验证ftp是否可以正常上传文件(使用的匿名方式)。这两种途径是解决openssh升级失败的唯一方法。

5 待所有软件升级完毕之后,需要在telnet连接的服务端哪里启动sshd服务,注意不要直接试用restart。需要先试用start,然后在次试用restart。否则服务器会断开。

6 环境及依赖版本:openssh-7.7p1.tar.gz    openssl-1.0.2o.tar.gz          zlib-1.2.11.tar.gz

对应软件下载地址:

zlib下载地址:链接:https://pan.baidu.com/s/1Ez10B_16pOytBZMQ9JueKQ  提取码:yr98

openssl下载地址:链接:https://pan.baidu.com/s/1oJKL77ZB1n6kzQQYMDOsaQ  提取码:9x0a

openssh下载地址:链接:https://pan.baidu.com/s/1Lr4Ww_2NDBLwaQAvSB-7jw  提取码:fpg5

7 下面是不成熟的脚本,没有逻辑判断,假设的是所有的命令执行成功的情况下进行的,如果要试用下面的脚本,需要谨慎试用。

#!/bin/bash
#Describle:update openssh to 7.7p1 on linux6.7
#Tue Oct 9 17:15:19 CST 2018
#Mail:Michael92@126.com #Before updating openssh,you need to be ready for some environments.
#In order to avoid downloading too many rpm packages,the best way is downloading the right iso images and make a local yum repository.
#After that,you can use the yum install some local servers,such as perl,vsftpd,telnet,telnet-server,pam-devel,gcc,gcc-c++.
#Then,you have to update the zlib to 1.2.11 and update openssl to 1.0.2o(This is the lowest version that openssh7.7p1 have dependence)
#The last but not the least,update openssh to 7.7p1 and clean up your environment. #1 Now,the next is building a local repository
mkdir /iso
#$1 is the directory of your iso images
mount -o loop $1 /iso
cat >>/etc/yum.repos.d/local.repo<<EOF
[localrepo]
name = localrepo
baseurl = file:///iso
enabled = 1
gpgcheck = 0
EOF yum clean all
yum repolist # 2 Try to use yum install some basical environment
yum -y install perl vsftpd telnet telnet-server pam-devel gcc gcc-c++
#Check whether install successfully
gcc -v
perl -v # 3 install telnet and vsftpd. telnet is the last way to link you server and vsftp is the last way to transfer files
echo "anon_upload_enable=YES" >> /etc/vsftpd/vsftpd.conf
echo "anon_other_write_enable=YES" >> /etc/vsftpd/vsftpd.conf
echo "anon_mkdir_write_enable=YES" >> /etc/vsftpd/vsftpd.conf
echo "anonymous_enable=YES" >> /etc/vsftpd/vsftpd.conf
echo "anon_umask=022" >> /etc/vsftpd/vsftpd.conf
echo "no_anon_password=YES" >> /etc/vsftpd/vsftpd.conf
chown ftp /var/ftp -R
/etc/init.d/vsftpd restart
echo "You have 60 seconds to check whether you can use telnet"
for ((i=30;i>0;i--));do
echo -e "\033[31m$i\033[0m"
sleep 1
done
# Modify telnet configure file and check it
sed -i 's/yes/no/g' /etc/xinetd.d/telnet
mv /etc/securetty /etc/securetty.old
chkconfig xinetd on
echo "You have 30 seconds to check whether you can use telnet"
for ((i=30;i>0;i--));do
echo -e "\033[31m$i\033[0m"
sleep 1
done #4 Update zlib to use resource way
tar -zxvf ./zlib-1.2.11.tar.gz || exit 6
cd zlib-1.2.11
./configure --prefix=/usr
make || exit 6
rpm -e --nodeps zlib
make install
echo '/usr/lib' >> /etc/ld.so.conf
ldconfig
cd .. ZlibDirectory=`find /usr/ -name zlib.pc`
cat $ZlibDirectory #5 Update openssl
tar -zxvf ./openssl-1.0.2o.tar.gz || exit 7
mv /usr/lib64/openssl /usr/lib64/openssl.old
mv /usr/bin/openssl /usr/bin/openssl.old
mv /etc/pki/ca-trust/extracted/openssl /etc/pki/ca-trust/extracted/openssl.old
cp /usr/lib64/libcrypto.so.10 /usr/lib64/libcrypto.so.10.old
cp /usr/lib64/libssl.so.10 /usr/lib64/libssl.so.10.old
rpm -qa |grep openssl|xargs -i rpm -e --nodeps {} cd openssl-1.0.2o
./config --prefix=/usr --openssldir=/etc/ssl --shared zlib #必须加上--shared,否则编译时会找不到新安装的openssl的库而报错
make
make test #必须执行这一步结果为pass才能继续,否则即使安装完成,ssh也无法使用
make install
openssl version -a
cd ..
sleep 10
mv /usr/lib64/libcrypto.so.10.old /usr/lib64/libcrypto.so.10
mv /usr/lib64/libssl.so.10.old /usr/lib64/libssl.so.10 #6 Update openssh
tar -zxvf ./openssh-7.7p1.tar.gz || exit 8
mv /etc/ssh /etc/ssh.old
rpm -qa |grep openssh|xargs -i rpm -e --nodeps {}
install -v -m700 -d /var/lib/sshd
chown -v root:sys /var/lib/sshd
groupadd -g 50 sshd
useradd -c 'sshd PrivSep' -d /var/lib/sshd -g sshd -s /bin/false -u 50 sshd
cd openssh-7.7p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-md5-passwords --with-zlib --with-openssl-includes=/usr --with-privsep-path=/var/lib/sshd --with-tcp-wrappers
make
make install install -v -m755 contrib/ssh-copy-id /usr/bin
install -v -m644 contrib/ssh-copy-id.1 /usr/share/man/man1
install -v -m755 -d /usr/share/doc/openssh-7.7p1
install -v -m644 INSTALL LICENCE OVERVIEW README* /usr/share/doc/openssh-7.7p1
ssh -V
for ((i=10;i>0;i--));do
echo -e "\033[31m$i\033[0m"
sleep 1
done
echo 'X11Forwarding yes' >> /etc/ssh/sshd_config
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config #允许root用户通过ssh登录
cp -p contrib/redhat/sshd.init /etc/init.d/sshd
chmod +x /etc/init.d/sshd
chkconfig --add sshd
chkconfig sshd on # The last you have to use telnet to link the server and reboot the sshd
/etc/init.d/sshd start
/etc/init.d/sshd restart
tar -zxvf ./openssl-1.0.2o.tar.gz

linx6.7 update openssh to 7.7p1的更多相关文章

  1. Centos 6.x Openssh 升级 7.7p1 版本

    OpenSSH 升级 目前在一家金融公司上班,正好赶上金融公司各种暴雷,本人心里慌慌的. 然后就是金融公司要进行的最低的三级等保评测,各种修改系统安全,密码强度.WAF.防火墙等各种. 评测公司对我司 ...

  2. centos7 升级openssh到openssh-8.0p1版本

    环境介绍 centos7.3和centos7.6升级完毕测试登录ssh以及重启后登录ssh均无问题. 前期请自行配置好yum源(如果不会请百度) 整个过程不需要卸载原先的openssl包和openss ...

  3. ubuntu下openssh升级

    因客户漏扫扫描出来openssh及openssl存在漏洞,现升级为官方最新版 这里选择编译安装 去官网下载: openssl-1.0.2o.tar.gz openssh7.7.1 zlib-1.2.1 ...

  4. Openssh版本升级(Centos6.7)

    实现前提公司服务器需要进行安全测评,扫描漏洞的设备扫出了关于 openssh 漏洞,主要是因为 openssh的当前版本为5.3,版本低了,而yum最新的openssh也只是5.3,没办法只能到 rp ...

  5. ubuntu-14.04.5 升级sshd到指定版本openssh-7.7p1,openssl-1.1.0h。

    升级步骤 wget https://wps-oss.oss-cn-shenzhen.aliyuncs.com/openssh_update.tar.gz tar xvf openssh_update. ...

  6. CentOS 6.4下OpenSSH升级到6.7操作

    一.升级前准备 1.下载openssh-6.7p1.tar.gz: cd /usr/local/src/wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/ ...

  7. Centos6.5升级安装openssh7.7p1

    Centos6.5升级安装openssh7.7p1  关于OpenSSH漏洞   2016年1月14日OpenSSH发布官方公告称, OpenSSH Client 5.4~7.1 版本中未公开说明的功 ...

  8. 升级openssh编译报错“configure: error: *** working libcrypto not found, check config.log”的解决办法

    问题描述 在linux上,欲将OpenSSH_6.4p1编译升级到OpenSSH_8.0p1时,执行了./configure --prefix=/usr --sysconfdir=/etc/ssh - ...

  9. openssh一键升级脚本(只升级openssh,其它已有环境不变,解决root登录问题)

    #!/bin/bash ################################################################# ###### update openssl ...

随机推荐

  1. sed 命令总结

    sed是Stream Editor的缩写,是操作.过滤.转换文本内容的强大工具,对文件实现增删改查 主要参数 -n 取消默认输出 -i 修改保存文件 内置命令字符 a,append追加 d,delet ...

  2. Altium Designer 使用小技巧2

    (a)在没画原理图,直接在PCB上绘制时需要将Tools/Preferences/PCB Editor/Interactiver Routing 中的Current Mode 中的选项选择为 Igno ...

  3. R语言最优化(一维)

    最优化问题是普遍存在的,以前上运筹学课的时候也接触过最优化相关的问题,当时主要是理论课,并且关注的重点是单纯形法.运输问题以及图论等,这里指的最优化是指函数的最优化,即函数的极值,由于寻找一个局部最优 ...

  4. chrome插件学习笔记

    manifest.json { "name": "test1", "description": "test1", &qu ...

  5. Problem B: 一切皆对象

    Description 一切都是对象 —— Everything is an object. 所以,现在定义一个类Thing,来描述世界上所有有名字的事物.该类只有构造函数.拷贝构造函数和析构函数,并 ...

  6. 同一脚本sh 脚本名 报Syntax error: "(" unexpected而./脚本名不报错,求解!!

    同一脚本sh 脚本名 执行时报Syntax error: "(" unexpected:而./脚本名执行不报错,为什么呢 脚本内容如下: function usage(){ ech ...

  7. cafee编译错误几个总结

    1.CXX/LD -o .build_release/examples/siamese/convert_mnist_siamese_data.bin .build_release/lib/libcaf ...

  8. 纯js星级评分

    @{ Layout = null;} <!DOCTYPE html> <html><head> <meta name="viewport" ...

  9. Jira7.10.1在Windows环境下的安装和配置

    jira安装的环境准备   1.   jira7.10的运行是依赖java环境的,也就是说需要安装jdk并且要是1.8以上版本: Java -version   2.  还需要为jira创建对应的数据 ...

  10. JavaScript中的各种宽高总结

    window和document首先我们来高清两个概念:    window和document的区别是什么?    window.location和document.location是一样吗?第一个问题 ...