This is an install of OpenSSH from source on CentOS 4.5. It is not so much of an upgrade as it is a seperate install. SSH is your gateway into your machine. It is the access point for your machine over the network. Therefore it needs one of the most secure parts of your system. When a vulnerability comes out for it you have to update it ASAP. Problem is most distros don't make haste in getting packages out that update it. So your stuck with updating it yourself. So that rpm or deb package you installed is useless now that is vulnerable.
So what we are going to do is compile and install our own OpenSSH in the /opt tree (or wherever you want). Then whenever OpenSSL, OpenSSH, or Zlib have a security problem we can just quickly patch, recompile, and install a new version of any of them. No dependence on the distro's packages and their slower response times. The install below is what versions of the packages where avaliable at the time so change those accordingly.
First we download and install zlib. It does not seem to change version much so you might not need to do this each time.
cd /tmp
mkdir -p /opt/zlib
mkdir zlib1.23
cd zlib1.23/
wget http://www.zlib.net/zlib123.zip
unzip zlib123.zip
make
make install prefix=/opt/zlib/
Next we download and install OpenSSL.
cd /tmp
mkdir -p /opt/openssl
wget http://www.openssl.org/source/openssl-0.9.8e.tar.gz
tar xvzf openssl-0.9.8e.tar.gz
cd openssl-0.9.8e
./config --prefix=/opt/openssl --openssldir=/opt/openssl
make
make test
make install
Now we download and install OpenSSH. This version is for linux so it will come from the portable code base. In the configure section we are pointing to the OpenSSL and zlib installs we did above. You also want to check to see where your xauth file is and put that path in accordingly. I just did the command "which xauth" and got the path but you might need to do a "find / -name xauth" to find it.
cd /tmp
mkdir -p /opt/openssh
wget ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-4.7p1.tar.gz
tar xvzf openssh-4.7p1.tar.gz
cd openssh-4.7p1
./configure --prefix=/opt/openssh --with-ssl-dir=/opt/openssl --with-xauth=/usr/X11R6/bin/xauth --with-zlib=/opt/zlib
make
make install
We are going to use the SSHD init.d script to start and stop our version of SSH. This script comes with CentOS 4.5. To use it we need to change some paths. Check /etc/init.d/sshd make sure these point to /opt/openssh.
# Some functions to make the below more readable KEYGEN=/opt/openssh/bin/ssh-keygen SSHD=/opt/openssh/sbin/sshd RSA1_KEY=/opt/openssh/etc/ssh_host_key RSA_KEY=/opt/openssh/etc/ssh_host_rsa_key DSA_KEY=/opt/openssh/etc/ssh_host_dsa_key
Then restart SSH.
/etc/init.d/sshd restart
Check with telnet that your SSH is giving out the right version number of the one you just installed. You can do this by telnetting to your OpenSSH server.telnet localhost 22
We should get a response with "OpenSSH_4.7" in the title. The same version that was just installed.
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
SSH-2.0-OpenSSH_4.7