美文网首页
CentOS6升级OpenSSH

CentOS6升级OpenSSH

作者: __For丶dream | 来源:发表于2018-08-22 17:11 被阅读0次

概要

CentOS6OpenSSH5.x很多漏洞,现直接打包rpm文件升级

升级后发现无法登录,原因是升级了OpenSSH但是PAM的配置文件/etc/pam.d/sshd没有跟着升级,所以拷贝了一份CentOS7的配置文件,重启sshd后可以登录

安装依赖包

yum install pam-devel rpm-build zlib zlib-devel openssl openssl-devel -y

打包OpenSSH

mkdir -p ~/rpmbuild/SOURCES/
cd  ~/rpmbuild/SOURCES/
wget http://ftp.riken.jp/Linux/momonga/6/Everything/SOURCES/x11-ssh-askpass-1.2.4.1.tar.gz
wget http://ftp.jaist.ac.jp/pub/OpenBSD/OpenSSH/portable/openssh-7.7p1.tar.gz
tar xf openssh-7.7p1.tar.gz
cp openssh-7.7p1/contrib/redhat/openssh.spec ~/rpmbuild/SOURCES/
sed -i 's@%define no_gnome_askpass 0@%define no_gnome_askpass 1@g' ~/rpmbuild/SOURCES/openssh.spec
sed -i 's@%define no_x11_askpass 0@%define no_x11_askpass 1@g' ~/rpmbuild/SOURCES/openssh.spec
rpmbuild -ba openssh.spec

升级OpenSSH

cd ~/rpmbuild/RPMS/x86_64/
rpm -Uvh *

修改pam的配置文件

/etc/pam.d/sshd

#%PAM-1.0
auth       required     pam_sepermit.so
auth       substack     password-auth
auth       include      postlogin
# Used with polkit to reauthorize users in remote sessions
-auth      optional     pam_reauthorize.so prepare
account    required     pam_nologin.so
account    include      password-auth
password   include      password-auth
# pam_selinux.so close should be the first session rule
session    required     pam_selinux.so close
session    required     pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session    required     pam_selinux.so open env_params
session    required     pam_namespace.so
session    optional     pam_keyinit.so force revoke
session    include      password-auth
session    include      postlogin
# Used with polkit to reauthorize users in remote sessions
-session   optional     pam_reauthorize.so prepare

/etc/pam.d/postlogin

#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.


session     [success=1 default=ignore] pam_succeed_if.so service !~ gdm* service !~ su* quiet
session     [default=1]   pam_lastlog.so nowtmp showfailed
session     optional      pam_lastlog.so silent noupdate showfailed

重启sshd

service sshd restart

相关文章

  • CentOS6升级OpenSSH

    概要 CentOS6的OpenSSH5.x很多漏洞,现直接打包rpm文件升级 升级后发现无法登录,原因是升级了Op...

  • centos6升级openssh7.2p2

    centos6自带openssh5.3p1,存在漏洞,升级一下。以下记录了升级的过程: 一.备用远程方案(teln...

  • centos6和centos7修复openssh漏洞脚本

    使用介绍:脚本可以判断centos6,和centos7系统版本来对openssh进行升级centos7升级open...

  • centos6系列升级openssh爬坑记录

    Centos6系列升级openssh教程 零、虚机建议更新前做个快照,本文档基于centos6.9制作,请根据实际...

  • Ubuntu 16.04 升级OpenSSH至7.9p1

    一、openssh 升级 因网安漏洞扫描扫出OpenSSH漏洞,需要对OpenSSH进行升级操作 1、下载zlib...

  • centos7 openssh 版本升级

    centos7 openssh 版本升级 1. 准备备用远程登录 用户反馈 openssh 存在漏洞,需要升级,升...

  • centos(redhat)yum配置本地源

    本次以升级centos6.9的openssh为例,介绍升级openssh的方法。 0、准备材料 centos镜像C...

  • 升级OpsnSSH

    升级OpsnSSH 官网:http://www.openssh.com/[http://www.openssh.c...

  • 升级OPenSSH

    安装包下载 依赖包 安装zlib 安装openssl 安装openssh 环境变量恢复 启动sshd 重启验证 检验版本

  • 一键升级最新OpenSSH

    CentOS7.1 升级OpenSSH 7.8 安装包及一键升级脚本 openssh 7.8下载地址 openss...

网友评论

      本文标题:CentOS6升级OpenSSH

      本文链接:https://www.haomeiwen.com/subject/idmyiftx.html