Goal: Preserve SSH host keys when re-building a Linux host. Handy when you’re in a dev environment.
I’ve had both Spacewalk and RHSat5 running for years here, and one of the very useful snippets has been the keep_ssh_host_keys snippet. Unfortunately, taken as-is from Spacewalk, the installs would hang at the final close of the pre-install section of the kickstart.
The solution (found at https://fedoraproject.org/wiki/Anaconda/Kickstart/es#Chapter_4._Pre-installation_Script) was to make sure that the final while loop that would populate the new SSH directory needs to have stdin, stdout and stderr either closed or redirected from the main bash execution.
done < /dev/null > /tmp/keep_ssh_host_keys.txt 2>&1 &
This has allowed the pre install section to close, yet leave the while loop in the background to complete processing.
This certainly could be a useful technique for other purposes.
I should point out that this also covers some heartburn cases with remote execution from the Foreman master to clients, especially those over SSH connections, after re-implementation. This will eliminate the need to remove the old SSH keys from foreman and foreman_proxy .ssh directories.
thanks for heads up. Feel free to contribute the snippet to our community-templates repo. I assume the license is GNU GPL:
That’s the snippet, and it’s a 1 line change to make it work gracefully in Foreman/Katello. I trigger it here with a master snippet called by “Kickstart default custom pre”. (detecting a pattern here? )
I’ll look up the license and/or contact the original developer to see about submitting to this project.
Thanks. If the license is open-source (and it very likely is) then you don’t need to contact the author and just go ahead and create a PR at https://github.com/theforeman/community-templates
While I agree that the license probably isn’t an issue, it’d be awfully nice to let him know that I’m submitting it to this project.