欢迎光临
我们一直在努力

升级openssl和openssh的shell脚本是怎样的

升级openssl和openssh的shell脚本是怎样的,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

#!/bin/bash

# 关闭SELinux

sed -i 's/enforcing$/disabled/g' /etc/selinux/config

setenforce 0

#安装关联应用

yum install  -y gcc gcc-c++ glibc make autoconf openssl openssl-devel pcre-devel  pam-devel

# back openssl

mv /usr/bin/openssl /usr/bin/openssl_bak && mv /usr/include/openssl /usr/include/openssl_bak

# install openssl

tar xf openssl-*.tar.* && cd openssl-*

./config shared && make && make install

ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl && ln -s /usr/local/ssl/include/openssl /usr/include/openssl

echo "/usr/local/ssl/lib" >> /etc/ld.so.conf

/sbin/ldconfig

cd ..

# install openssh

tar xf openssh-*.tar.* && cd openssh-*

rm -rf /etc/ssh/*

./configure –prefix=/usr/ –sysconfdir=/etc/ssh –with-openssl-includes=/usr/local/ssl/include –with-ssl-dir=/usr/local/ssl   \

–with-zlib –with-md5-passwords –with-pam  && make && make install

sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config && sed -i 's/#UserPAM no/User PAM no/' /etc/ssh/sshd_config

cp -a contrib/redhat/sshd.init /etc/init.d/sshd && cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam

chmod +x /etc/init.d/sshd && chkconfig –add sshd

systemctl enable sshd

mv  /usr/lib/systemd/system/sshd.service /root/

num=`awk -F'.' '{print $1}' /etc/redhat-release | awk -F' ' '{print $NF}'`

if [ $num -ge 6 ]; then

/etc/init.d/sshd restart

eles

systemctl daemon-reload && systemctl restart sshd

fi

ssh -V && cd .. && rm -rf ./openss*

关于升级openssl和openssh的shell脚本是怎样的问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注云行业资讯频道了解更多相关知识。

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。