当前位置: 首页 > news >正文

CentOS7 升级OpenSSH9.0全过程和坑

在这里插入图片描述
近日,漏洞肆虐,需要升级新版本,才能解决漏洞。故有此文:

0 查看当前版本

[root@host-testsvc openssh-9.0p1]# ssh -V
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017

1、在data下新建一个独立目录openssh目录,用来存放软件

[root@host-testsvc data]# mkdir openssh

2、安装依赖

[root@host-testsvc data]# yum install -y wget gcc pam-devel libselinux-devel zlib-devel openssl-devel

如果有时候没有联网的话,可以本地安装依赖:
去国内阿里镜像里找到对应的rpm包下载上传到服务器即可:阿里镜像https://developer.aliyun.com/packageSearch

[root@host-testsvc openssh]# rpm -qa pam-1.1.8-23.el7.x86_64
[root@host-testsvc openssh]# rpm -qa pam-devel
[root@host-testsvc openssh]# ls
pam-1.1.8-23.el7.x86_64.rpm        pam-devel-1.1.8-23.el7.x86_64.rpm  
[root@host-testsvc openssh]# rpm -ivh pam-1.1.8-23.el7.x86_64.rpm 
准备中...                          ################################# [100%]软件包 pam-1.1.8-23.el7.x86_64 已经安装
[root@host-testsvc openssh]# rpm -ivh pam-devel-1.1.8-23.el7.x86_64.rpm 
准备中...                          ################################# [100%]
正在升级/安装...1:pam-devel-1.1.8-23.el7           ################################# [100%]
[root@host-testsvc openssh]# rpm -qa pam-devel
pam-devel-1.1.8-23.el7.x86_64
[root@host-testsvc openssh]# rpm -qa pam
pam-1.1.8-23.el7.x86_64

最后再检查一下依赖:

rpm -qa  wget gcc pam-devel libselinux-devel zlib-devel openssl-devel
[root@host-testsvc openssh]# rpm -qa  wget gcc pam-devel libselinux-devel zlib-devel openssl-devel
libselinux-devel-2.5-15.el7.x86_64
openssl-devel-1.0.2k-25.el7_9.x86_64
wget-1.14-18.el7_6.1.x86_64
pam-devel-1.1.8-23.el7.x86_64
zlib-devel-1.2.7-20.el7_9.x86_64
gcc-4.8.5-44.el7.x86_64

3、下载 openssh 9

去openssh官网下载:pub-OpenBSD-OpenSSH-portable安装包下载_开源镜像站-阿里云

[root@host-testsvc data]# wget https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.0p1.tar.gz
[root@host-testsvc openssh]# ls
openssh-9.0p1.tar.gz

4、解压

[root@host-testsvc openssh]# tar -zxvf openssh-9.0p1.tar.gz 
openssh-9.0p1
openssh-9.0p1/.depend
openssh-9.0p1/.github
openssh-9.0p1/.github/ci-status.md
openssh-9.0p1/.github/configs
openssh-9.0p1/.github/configure.sh
openssh-9.0p1/.github/run_test.sh
openssh-9.0p1/.github/setup_ci.sh
openssh-9.0p1/.github/workflows
openssh-9.0p1/.github/workflows/c-cpp.yml
openssh-9.0p1/.github/workflows/selfhosted.yml
openssh-9.0p1/.github/workflows/upstream.yml
openssh-9.0p1/.gitignore
……中间省略一堆
openssh-9.0p1/ChangeLog
openssh-9.0p1/moduli.0
openssh-9.0p1/scp.0
openssh-9.0p1/ssh-add.0
openssh-9.0p1/ssh-agent.0
openssh-9.0p1/ssh-keygen.0
openssh-9.0p1/ssh-keyscan.0
openssh-9.0p1/ssh.0
openssh-9.0p1/sshd.0
openssh-9.0p1/sftp-server.0
openssh-9.0p1/sftp.0
openssh-9.0p1/ssh-keysign.0
openssh-9.0p1/ssh-pkcs11-helper.0
openssh-9.0p1/ssh-sk-helper.0
openssh-9.0p1/sshd_config.0
openssh-9.0p1/ssh_config.0
openssh-9.0p1/aclocal.m4
openssh-9.0p1/configure
openssh-9.0p1/config.h.in

5、备份原来的配置文件:

[root@host-testsvc openssh]# cp /etc/ssh/sshd_config sshd_config.backup
[root@host-testsvc openssh]# cp /etc/pam.d/sshd sshd.backup
[root@host-testsvc openssh]# ls
openssh-9.0p1  openssh-9.0p1.tar.gz  pam-1.1.8-23.el7.x86_64.rpm  pam-devel-1.1.8-23.el7.x86_64.rpm  sshd.backup  sshd_config.backup

6、卸载原来的openssh

[root@host-testsvc openssh]# rpm -e --nodeps `rpm -qa | grep openssh`
警告:/etc/ssh/sshd_config 已另存为 /etc/ssh/sshd_config.rpmsave
[root@host-testsvc openssh]# rpm -qa  openssh
[root@host-testsvc openssh]# 

7、编译配置 openssh-9.0p1

./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-zlib --with-tcp-wrappers --with-ssl-dir=/usr/local/ssl --without-hardening

OpenSSH as been configured with the following options:
User binaries: /usr/bin
System binaries: /usr/sbin
Configuration files: /etc/ssh
Askpass program: /usr/libexec/ssh-askpass
Manual pages: /usr/share/man/manX
PID file: /var/run
Privilege separation chroot path: /var/empty
sshd default user PATH: /usr/bin:/bin:/usr/sbin:/sbin
Manpage format: doc
PAM support: yes
OSF SIA support: no
KerberosV support: no
SELinux support: no
libedit support: no
libldns support: no
Solaris process contract support: no
Solaris project support: no
Solaris privilege support: no
IP address in $DISPLAY hack: no
Translate v4 in v6 hack: yes
BSD Auth support: no
Random number sou

http://www.lryc.cn/news/484807.html

相关文章:

  • RSTP的配置
  • 力扣257:二叉树的所有路径
  • Tcl 和 Python 在二次开发研究
  • 【NLP优化】Ubuntu 20.04 下 源码安装 CasADi + Ipopt / acados
  • [241110] 微软发布多智能体系统Magentic-One | 社区讨论:Ubuntu 26.04 LTS 发布前移除 Qt 5
  • AI风向标|算力与通信的完美融合,SRM6690解锁端侧AI的智能密码
  • MySQL查询执行(六):join查询
  • python习题练习
  • MySQL高级(二):一条更新语句是如何执行的
  • 在 Ubuntu 18.04 中搭建和测试 DNS 服务器
  • 算法学习第一弹——C++基础
  • javaWeb小白项目--学生宿舍管理系统
  • 如何优化Elasticsearch的查询性能?
  • 蓝桥杯每日真题 - 第12天
  • 从H264视频中获取宽、高、帧率、比特率等属性信息
  • Cyberchef配合Wireshark提取并解析TCP/FTP流量数据包中的文件
  • Nginx中使用keepalive实现保持上游长连接实现提高吞吐量示例与测试
  • 深度学习-卷积神经网络CNN
  • 241114.学习日志——[CSDIY] [Cpp]零基础速成 [03]
  • 大模型研究报告 | 2024年中国金融大模型产业发展洞察报告|附34页PDF文件下载
  • 数据库SQL——什么是实体-联系模型(E-R模型)?
  • 在 MySQL 8.0 中,SSL 解密失败,在使用 SSL 加密连接时出现了问题
  • React Native 全栈开发实战班 - 第四部分:用户界面进阶之动画效果实现
  • 【CICD】GitLab Runner 和执行器(Executor
  • 实用教程:如何无损修改MP4视频时长
  • mysqldump命令搭配source命令完成数据库迁移备份
  • 生信:TCGA学习(R、RStudio安装与下载、常用语法与常用快捷键)
  • 十三、注解配置SpringMVC
  • 为什么海外服务器IP会被封
  • 图像处理技术椒盐噪声