RHEL5 Root SSH from Single IP

I had a specific scenario in which I needed to allow root login over SSH from only one host, and require that root use key-based authentication from that one host. This setup is only for Red Hat Enterprise Linux 5 - there are better methods of accomplishing this on later versions, such as the Match Address option in sshd_config. The key was pulled over HTTPS via a website on the Satellite server that was to administer it. If you have a proper SSL certificate installed on your Satellite server, or have properly configured, PKI, you can remove the -k flag from curl. Run the following script as root:

#!/bin/bash -

pub=$(curl -k https://satellite.local/pub/id_rsa_foreman_proxy.pub)
echo $pub >> ~/.ssh/authorized_keys
sed -i -e 's/PermitRootLogin no/PermitRootLogin without-password/g' /etc/ssh/sshd_config
service sshd restart

The output should look like this:

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 413 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 413 100 413 0 0 3676 0 --:--:-- --:--:-- --:--:-- 403k
Stopping sshd: [ OK ]
Starting sshd: [ OK ]