使用OpenSSH源码包作为例子,并升级OpenSSH:
1.收集信息:
# rpm -qa |grep ssh
openssh-5.3p1-94.el6.x86_64
openssh-server-5.3p1-94.el6.x86_64
openssh-clients-5.3p1-94.el6.x86_64
libssh2-1.4.2-1.el6.x86_64
# ssh -V
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
2.环境准备:
# cd /usr/src/
# wget http://mirrors.evowise.com/pub/OpenBSD/OpenSSH/portable/openssh-7.4p1.tar.gz –下载比较新的OpenSSL安装包
wget http://ftp.riken.jp/Linux/momonga/6/Everything/SOURCES/x11-ssh-askpass-1.2.4.1.tar.gz –下载askpass包
# tar zxvf openssh-7.4p1.tar.gz
# yum install -y rpm-build gcc make wget openssl-devel krb5-devel pam-devel libX11-devel xmkmf libXt-devel –OpenSSL依赖环境
# yum install -y rpm-build krb5-devel zlib-devel gcc –安装askpass依赖环境
# mkdir -p /root/rpmbuild/{SOURCES,SPECS}
# cp ./openssh-7.4p1/contrib/redhat/openssh.spec /root/rpmbuild/SPECS/
# cp openssh-7.4p1.tar.gz /root/rpmbuild/SOURCES/
# cp x11-ssh-askpass-1.2.4.1.tar.gz /root/rpmbuild/SOURCES/
# cd /root/rpmbuild/SPECS/
修改制作包信息:
# sed -i -e “s/%define no_gnome_askpass 0/%define no_gnome_askpass 1/g” openssh.spec –修改一下源配置被rpmbuild的制作
# rpmbuild -bb openssh.spec –制作安装包
3.升级安装包
# cd /root/rpmbuild/RPMS/x86_64/
]# rpm –checksig openssh-server-7.4p1-1.x86_64.rpm –检查rpm包的完整性,每一个需要检查,OK为正确
openssh-server-7.4p1-1.x86_64.rpm: sha1 md5 OK
# ls
openssh-7.4p1-1.x86_64.rpm
openssh-clients-7.4p1-1.x86_64.rpm
openssh-server-7.4p1-1.x86_64.rpm
openssh-askpass-7.4p1-1.x86_64.rpm
# rpm -Uvh *.rpm
# ssh -V –版本是目的版本,即升级成功
OpenSSH_7.4p1, OpenSSL 1.0.1e-fips 11 Feb 2013
4.修改ssh配置文件
下面配置是使得root比较方便登录,而不被太多限制,但是不推荐这么设置
# vim /etc/ssh/sshd_config
#GSSAPIAuthentication yes –注释掉
#GSSAPICleanupCredentials yes –注释掉
PasswordAuthentication no –改为no
UsePAM no –改为no
PermitRootLogin yes –改为yes
# service sshd restart –重启sshd即可登录连接了
5.其他
可以做成镜像,并签上证书,挂载之后,然后使用yum来安装,雷同系统ISO挂载yum安装。