suse 12 升级 OpenSSH-7.2p2 到 OpenSSH-8.4p1

简介: suse 12 升级 OpenSSH-7.2p2 到 OpenSSH-8.4p1

1、查看当前当前环境信息

1.1、查看openssh当前版本
linux-oz6w:~ # openssl version
OpenSSL 1.0.2j-fips  26 Sep 2016
linux-oz6w:~ # ssh -V
OpenSSH_7.2p2, OpenSSL 1.0.2j-fips  26 Sep 2016
1.2、查看当前linux发行版
linux-oz6w:~ # cat /etc/os-release
NAME="SLES"
VERSION="12-SP3"
VERSION_ID="12.3"
PRETTY_NAME="SUSE Linux Enterprise Server 12 SP3"
ID="sles"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:12:sp3"

2、部署telnet-server

2.1、下载telnet-server
linux-oz6w:~ # zypper in telnet-server xinetd
2.2、配置telnet-server
linux-oz6w:~ # ll /etc/xinetd.d/telnet
-rw-r--r-- 1 root root 408 Sep 21  2014 /etc/xinetd.d/telnet
linux-oz6w:~ # vim /etc/xinetd.d/telnet
# default: off
# description: Telnet is the old login server which is INSECURE and should \
#       therefore not be used. Use secure shell (openssh).
#       If you need telnetd not to "keep-alives" (e.g. if it runs over a ISDN \
#       uplink), add "-n".  See 'man telnetd' for more details.
service telnet
{
        socket_type     = stream
        protocol        = tcp
        wait            = no
        user            = root
        server          = /usr/sbin/in.telnetd
}
"去掉telnet文件里面的disable=yes,这样telnet就会随着xinetd的启动而启动"
2.3、配置telnet登录的终端类型
linux-oz6w:~ # cat >> /etc/securetty <<EOF
pts/0
pts/1
pts/2
pts/3
EOF
2.4、启动telnet服务
linux-oz6w:~ # systemctl enable xinetd.service
linux-oz6w:~ # systemctl restart xinetd.service
linux-oz6w:~ # ss -nltp | grep 23
LISTEN     0      64           *:23                       *:*                   users:(("xinetd",pid=2597,fd=5))
2.5、切换链接终端的方式
  • 后面的操作都是在telnet链接的方式下进行,避免ssh中断导致升级失败
  • 以telnet方式登录的时候,注意选择协议和端口,协议为telnet,端口为23

3、升级openssh

3.1、下载依赖包和openssh源码包
linux-oz6w:~ # zypper in gcc gcc-c++ glibc make autoconf openssl openssl-devel
linux-oz6w:~ # wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz
linux-oz6w:~ # wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.4p1.tar.gz
linux-oz6w:~ # tar xf openssl-1.1.1i.tar.gz
linux-oz6w:~ # tar xf openssh-8.4p1.tar.gz
3.2、编译安装openssl
"备份老版本的openssl"
linux-oz6w:~ # mv /usr/bin/openssl{,-1.0.2j-fips}
linux-oz6w:~ # mv /usr/include/openssl{,-1.0.2j-fips}
linux-oz6w:~ # cd openssl-1.1.1i/
linux-oz6w:~/openssl-1.1.1i # ./config shared && make && make install
"编译完成后,建立软连接,更新openssl版本"
linux-oz6w:~ # ln -s /usr/local/bin/openssl /usr/bin/openssl
linux-oz6w:~ # ln -s /usr/local/include/openssl/ /usr/include/openssl
linux-oz6w:~ # echo "/usr/local/lib64" >> /etc/ld.so.conf
linux-oz6w:~ # /sbin/ldconfig
linux-oz6w:~ # openssl version
OpenSSL 1.1.1i  8 Dec 2020
3.3、编译安装openssh
"备份老版本ssh"
linux-oz6w:~ # mv /etc/ssh{,-7.2p2}
linux-oz6w:~ # cd openssh-8.4p1/
linux-oz6w:~/openssh-8.4p1 # ./configure --prefix=/usr/local/openssh \
--sysconfdir=/etc/ssh \
--with-openssl-includes=/usr/local/include \
--with-ssl-dir=/usr/local/lib64 \
--with-zlib \
--with-md5-passwords && \
make && \
make install

3.3.1、配置sshd_config

linux-oz6w:~ # sed -i 's/^#UseDNS.*/UseDNS no/' /etc/ssh/sshd_config
linux-oz6w:~ # sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
linux-oz6w:~ # sed -i 's/^#PubkeyAuthentication.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config
linux-oz6w:~ # sed -i 's/^#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
"如果是图形化界面,需要x11,需要修改如下配置"
linux-oz6w:~ # sed -i 's/^#X11Forwarding.*/X11Forwarding yes/' /etc/ssh/sshd_config
linux-oz6w:~ # sed -i 's/^#X11UseLocalhost.*/X11UseLocalhost no/' /etc/ssh/sshd_config
linux-oz6w:~ # sed -i 's%^#XAuthLocation.*%XAuthLocation /usr/bin/xauth%' /etc/ssh/sshd_config
"建立软连接,更新ssh版本"
linux-oz6w:~ # mv /usr/sbin/sshd{,-7.2p2}
linux-oz6w:~ # mv /usr/bin/ssh{,-7.2p2}
linux-oz6w:~ # mv /usr/bin/ssh-keygen{,-7.2p2}
linux-oz6w:~ # ln -s /usr/local/openssh/bin/ssh /usr/bin/ssh
linux-oz6w:~ # ln -s /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
linux-oz6w:~ # ln -s /usr/local/openssh/sbin/sshd /usr/sbin/sshd

3.3.2、重新启动ssh服务

linux-oz6w:~ # mv /usr/lib/systemd/system/sshd.service{,-7.2p2}
linux-oz6w:~ # cp -a openssh-8.4p1/contrib/suse/rc.sshd /etc/init.d/sshd
linux-oz6w:~ # chmod +x /etc/init.d/sshd
linux-oz6w:~ # chkconfig --add sshd
linux-oz6w:~ # systemctl enable sshd --now

3.3.3、验证ssh

linux-oz6w:~ # ssh root@192.168.145.133
linux-oz6w:~ # ssh -V
OpenSSH_8.4p1, OpenSSL 1.1.1i  8 Dec 2020
linux-oz6w:~ # systemctl disable xinetd.service --now


目录
相关文章
|
Linux
生产环境Linux服务器磁盘分区、无损扩容根分区以及挂载磁盘到目录实战
生产环境Linux服务器磁盘分区、无损扩容根分区以及挂载磁盘到目录实战
1720 0
|
安全 Linux 数据安全/隐私保护
openssh有rpm包吗?
【4月更文挑战第14天】openssh有rpm包吗?
1601 0
|
安全 数据安全/隐私保护
openssh和openssl的版本关系
【4月更文挑战第14天】openssh和openssl的版本关系
3553 0
|
应用服务中间件 网络安全 nginx
./configure: error: SSL modules require the OpenSSL library.
CentOS 6.5 下 安装 Tengine 执行配置命令./configure  时提示以下错误: ./configure: error: SSL modules require the OpenSSL library.
2649 0
|
Linux 数据安全/隐私保护 Perl
CentOS7中升级OpenSSL详细教程
这篇文章提供了在CentOS 7系统中升级OpenSSL到3.2版本的详细步骤,包括备份现有配置、安装依赖、下载安装新版本以及验证安装结果。
4317 3
|
缓存 安全 Java
全面解读ConcurrentHashMap:Java中的高效并发数据结构
全面解读ConcurrentHashMap:Java中的高效并发数据结构
2904 2
|
网络协议 应用服务中间件 网络安全
阿里云环境中TLS/SSL握手失败的场景分析
TLS/SSL握手是一个相对复杂的过程,在阿里云环境中结合产品,安全等特性,可能会让TLS/SSL握手过程的不定性更多。本文来总结下各种握手失败的场景。
阿里云环境中TLS/SSL握手失败的场景分析
|
Android开发 开发者
Android中弹框如何设计成全屏的
本文介绍在Android中实现全屏对话框的方法,包括使用`Dialog`和`DialogFragment`两种方式。通过设置对话框无标题、调整布局参数及使用透明背景实现全屏效果。适用于希望提升应用交互体验的开发者。
938 0
|
存储 缓存 安全
ConcurrentHashMap的实现原理,非常详细,一文吃透!
本文详细解析了ConcurrentHashMap的实现原理,深入探讨了分段锁、CAS操作和红黑树等关键技术,帮助全面理解ConcurrentHashMap的并发机制。关注【mikechen的互联网架构】,10年+BAT架构经验倾囊相授。
ConcurrentHashMap的实现原理,非常详细,一文吃透!
|
SQL 网络协议 数据库连接
已解决:连接SqlServer出现 provider: Shared Memory Provider, error: 0 - 管道的另一端上无任何进程【C#连接SqlServer踩坑记录】
本文介绍了解决连接SqlServer时出现“provider: Shared Memory Provider, error: 0 - 管道的另一端上无任何进程”错误的步骤,包括更改服务器验证模式、修改sa用户设置、启用TCP/IP协议,以及检查数据库连接语句中的实例名是否正确。此外,还解释了实例名mssqlserver和sqlserver之间的区别,包括它们在默认设置、功能和用途上的差异。