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.
mkdir -p /opt/zlib
make install prefix=/opt/zlib/
Next we download and install OpenSSL.
mkdir -p /opt/openssl
tar xvzf openssl-0.9.8e.tar.gz
./config --prefix=/opt/openssl --openssldir=/opt/openssl
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.
mkdir -p /opt/openssh
tar xvzf openssh-4.7p1.tar.gz
./configure --prefix=/opt/openssh --with-ssl-dir=/opt/openssl --with-xauth=/usr/X11R6/bin/xauth --with-zlib=/opt/zlib
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 restartCheck 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.
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.