When you visit the OpenSSH website you want to get the portable source. I downloaded that onto the box and extracted it to /usr/local to create the openssh-5.1p1 sub. Normally the README file explains the compile sequence but in this case I had to get the instructions from the FAQ.
The first few attempts failed until I installed zlib-devel and openssl-devel. Then it was a simple case of the standard:
./configureThis placed the binary in /usr/local/sbin, but messed up the etc structure.
make; make install
All the config files were in etc and not a sub, so I created /usr/local/etc/openssh and moved all the files into the sub. This required an update to the sshd_config, however. I had to edit he HostKey parameters to include the sub in the path.
To test, we execute:
/usr/local/sbin/sshd -Dd \Connect from remote. Test the keys. Bug gone. All good.
-f /usr/local/etc/openssh/sshd_config
Now to symlink everything
cd /etc/This gives us a SysV startup script that points to the correct config files, but the wrong binaries. We need to change all the /usr/ entries to /usr/local/:
mv ssh ssh-redhat
ln -s /usr/local/etc/openssh ssh-openssh
ln-s ssh-openssh ssh
ls -ld ssh*
cd /etc/init.d
cp sshd sshd-openssh
mv sshd sshd-redhat
ln -s sshd-openssh sshd
sed -i "s~/usr/~/usr/local/~" sshd-openssh(There's actually only two lines, and the first shouldn't count.)
Oddly, on first try, it fails. The reason is that RedHat built the SysV script to check for the path of the config, but didn't provide the path. This means it fails and uses the default. Since we moved the config... it fails. The solution, which makes everything portable is the put the config path where RedHat expects it:
echo 'OPTIONS="-f /etc/ssh/sshd_config" ' > /etc/sysconfig/sshdOptionally, recompile with the --sysconfdir=/etc/ssh such that both binaries point to the same sub.
One downside is that the binary is running unconfined by SELinux. If you're really ambitious:
chcon -t sshd_exec_t /usr/local/sbin/sshdRestart the service to confine.
chcon -u system_u /etc/init.d/sshd*
chcon -t initrc_exec_t /etc/init.d/sshd*
No comments:
Post a Comment