VDSPlanet.ru Making the difference in VDS Hosting
Обновляем OpenSSH

Материал из Wiki.VDSPlanet.ru.

Перейти к: навигация, поиск

Скрипт обновления OpenSSH до последней версии.

  • Запускать из-под суперпользователя (root)
  • Не запускать на CentOS (тариф ниже Фобос, Марс). Приведет к полному зависанию сервера из-за нехватки памяти.

Запуск скрипта.

  • vim update.sh (INSERT - Вставляем, ESC :wq - Сохраняем)
  • chmod +x update.sh
  • sh update.sh

Сам скрипт:

#!/bin/bash
echo "OpenSSH update"
echo ""
echo "Upgrading your box SSH to 5.2"
echo "Resting for 10 seconds.. CTRL+C to exit"
sleep 10
if [ -e /etc/redhat-release ]; then
wget http://mirror.mcs.anl.gov/openssh/portable/openssh-5.2p1.tar.gz
tar xf openssh-5.2p1.tar.gz
cd openssh-5.2p1
yum install pam pam-devel openssl openssl-devel tar gcc gcc-c++ make automake zlib-devel -y
sh configure --with-tcp-wrappers --sysconfdir=/etc/ssh --prefix=/usr --with-pam --with-kerberos5
make
make install
/etc/init.d/sshd restart
fi
if [ -e /etc/debian_version ]; then
apt-get install build-essential gcc make zlib1g zlib1g-dev libwrap0 libwrap0-dev libssl-dev libpam-dev zlib-bin openssl
wget http://mirror.mcs.anl.gov/openssh/portable/openssh-5.2p1.tar.gz 
tar zxvf openssh-5.2p1.tar.gz
cd openssh-5.2p1 
sh configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-tcp-wrappers
make
make install
/etc/init.d/ssh restart
fi
echo ""
echo ""
echo "SSHd has been upgraded to version 5.2"

После применения скрипта увидим:

[root@perun ~]# ssh -v
OpenSSH_5.2p1, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008