一 需求
在 SUSE11sp3 系统中,希望将openssh的版本从6升级到8,通过软件的更新从而漏洞修复,但系统中没有gcc编译器。
二 系统环境
查看原系统的系统版本与SSH版本。
linux-e9r4:~ # cat /etc/SuSE-release
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 3
linux-e9r4:~ # ssh -V
OpenSSH_6.2p2, OpenSSL 0.9.8j-fips 07 Jan 2009
三 部署流程
1.上传编译安装的软件包
将安装所需的安装包放入/opt/中,由root用户执行
在 /opt 目录下包含如下包:
openssh-8.5p1.tar.gz openssl-1.1.1b.tar.gz zlib-1.2.1.1.tar.gz
2.安装 gcc编译软件
在SUSE系统使用 zypper 安装的方式(类似于centos系统的yum安装),解决gcc-c++的软件依赖问题。
zypper install gcc-c++
执行命令后,会安装相关依赖软件包,包括gcc gcc43 gcc43-c++ gcc-c++ glibc-devel libstdc++43-devel linux-kernel-headers
执行命令 gcc --version
可以查看gcc的版本
3.安装依赖zlib
先解压软件包,进行软件的配置
linux-e9r4:/opt # tar xf zlib-1.2.1.1.tar.gz
linux-e9r4:/opt # cd zlib-1.2.1.1/
linux-e9r4:/opt/zlib-1.2.1.1 # ./configure --shared
然后进行软件的编译
linux-e9r4:/opt/zlib-1.2.1.1 # make
最后进行软件的安装
linux-e9r4:/opt/zlib-1.2.1.1 # make install
4.安装依赖openssl
首先查看openssl软件版本
linux-e9r4:/opt # openssl version -a
接着解压软件包,进行软件的配置
linux-e9r4:/opt # tar xf openssl-1.1.1b.tar.gz
linux-e9r4:/opt # cd openssl-1.1.1b/
linux-e9r4:/opt/openssl-1.1.1b # ./config shared
然后进行软件的编译
linux-e9r4:/opt/openssl-1.1.1b # make
接着进行软件的安装
linux-e9r4:/opt/openssl-1.1.1b # make install
再备份旧的openssl二进制文件,并创建软链接
linux-e9r4:/opt/openssl-1.1.1b # mv /usr/bin/openssl /usr/bin/openssl.old
linux-e9r4:/opt/openssl-1.1.1b # ln -s /usr/local/bin/openssl /usr/bin/openssl
linux-e9r4:/opt/openssl-1.1.1b # ln -s /usr/local/include/openssl /usr/include/openssl
linux-e9r4:/opt/openssl-1.1.1b # echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
linux-e9r4:/opt/openssl-1.1.1b # /sbin/ldconfig -v
查看openssl软件版本
linux-e9r4:/opt/openssl-1.1.1b # openssl version -a
5.安装openssh
先解压软件包,然后进行配置。
在进行软件配置的过程中,由于当前zlib的版本较低,所以使用参数 --without-zlib-version-check
跳过该项配置检查,继续向下完成其他配置部署。
linux-e9r4:/opt # tar xf openssh-8.5p1.tar.gz
linux-e9r4:/opt # ls
openssh-8.5p1 openssh-8.5p1.tar.gz openssl-1.1.1b openssl-1.1.1b.tar.gz zlib-1.2.1.1 zlib-1.2.1.1.tar.gz
linux-e9r4:/opt # cd openssh-8.5p1/
linux-e9r4:/opt/openssh-8.5p1 # ./configure --prefix=/usr/ --sysconfdir=/etc/ssh -with-zlib -with-ssl-dir=/usr/local/ssl -with-md5-passwords mandir=/usr/share/man --without-zlib-version-check
接着进行软件的编译和安装
linux-e9r4:/opt/openssh-8.5p1 # make
linux-e9r4:/opt/openssh-8.5p1 # make install
然后备份旧的sshd文件,用新的文件覆盖
linux-e9r4:/opt/openssh-8.5p1 # cp sshd_config /etc/ssh/
linux-e9r4:/opt/openssh-8.5p1 # mv /usr/sbin/sshd{,.old}
linux-e9r4:/opt/openssh-8.5p1 # mv /usr/bin/ssh{,.old}
linux-e9r4:/opt/openssh-8.5p1 # cp sshd /usr/sbin/sshd
linux-e9r4:/opt/openssh-8.5p1 # cp ssh /usr/bin/ssh
允许root用户远程登录
linux-e9r4:/opt/openssh-8.5p1 # echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
重启sshd服务,并查看ssh版本
linux-e9r4:/opt/openssh-8.5p1 # service sshd restart
linux-e9r4:/opt/openssh-8.5p1 # ssh -V