1. 程式人生 > >Centos自動安裝openssh及openssl腳本並隱藏版本號

Centos自動安裝openssh及openssl腳本並隱藏版本號

rec tar -xvf prefix pub entos log gcc host dep

#!/bin/bash
#
install_ssh()
{
NOW=`date +%Y%m%d`
setenforce 0
cd /usr/local/
tar -xvf /usr/local/openssh-7.5p1.tar.gz
tar -xvf /usr/local/openssl-1.0.1t.tar.gz
mv /usr/local/openssh-7.5p1/ /usr/local/openssh/
mv /etc/init.d/sshd /etc/init.d/sshd_$NOW
mv /etc/ssh /etc/ssh_$NOW
mv /etc/ssl /etc/ssl_$NOW
mv /usr/bin/openssl /usr/local/openssl_$NOW
mv /usr/include/openssl /usr/include/openssl_$NOW
mv /usr/lib/openssl /usr/lib/openssl_$NOW
cd /usr/local/openssl-1.0.1t/
./config --prefix=/usr --openssldir=/etc/ssl --libdir=lib64 shared zlib-dynamic
make depend
make
make MANDIR=/usr/share/man MANSUFFIX=ssl install
ldconfig -v
sed -i ‘s/OpenSSH_7.5/OpenSSH/‘ /usr/local/openssh/version.h
cd /usr/local/openssh/
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-zlib --with-ssl-dir=/usr/ssl --with-md5-passwords --mandir=/usr/share/man --without-openssl-header-check
make
make install
cp /usr/local/openssh/contrib/redhat/sshd.init /etc/init.d/sshd
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
sed -i ‘[email protected]/sbin/restorecon /etc/ssh/[email protected]@‘ /etc/init.d/sshd
chkconfig sshd on
service sshd restart
}
check_depend_pack()
{
     NUM=`rpm -qa gcc zlib-devel | wc -l`
     if [[ $NUM -lt 2 ]];then

           echo "Sorry Sir. You need to install package gcc and zlib-devel."
     else
           install_ssh
     fi
}

check_depend_pack

  

Centos自動安裝openssh及openssl腳本並隱藏版本號