Description of problem: While it is possible to direct sshd to load its keys from a non-standard location using HostKey settings in /etc/ssh/sshd_config, the key generation process (via /usr/sbin/sshd-keygen) does not honor those same settings. Why relocate the keys? I make custom Live Fedora spins (for embedded systems) that are then transferred to Flash media so that for the most part Fedora is stateless. However, I don't wish it be entirely stateless. For example, I wish to keep the host's ssh encryption keys external to the Live image (and stored elsewhere on the Flash media). While it's easy to make sshd honor this wish, sshd-keygen will not. I'm willing to put a patch together for Fedora to make sshd-keygen create the keys where indicated by sshd_config, if I thought the effort might be accepted into Fedora. The patch would be troubled in only one way that I can envision in that the type of key to be generated would have to be inferred from the name of the key file since the "HostKey" setting name offers no such clues. Perhaps a more acceptable approach would be to simply allow RSA1_KEY, RSA_KEY and DSA_KEY (of the sshd-keygen script) to be overridden in /etc/sysconfig/sshd. Obviously this would mean that both config files would need to match in their settings, but I guess that's no worse than what's present now. Would it be possible to get such an improvement into Fedora?
Created attachment 716138 [details] Simple patch to allow specification of alternate host key location(s) via /etc/sysconfig/sshd I am presently using this patch. It merely sources the config **after** the *_KEY variables have been set (to a default value) in /usr/sbin/sshd-keygen. This makes it trivial to override the default values, if needed, otherwise has no change in behavior from present. Having this patch in Fedora would be nice for those of us who need such flexibility, but would prefer to not have to maintain such a patch on an on going basis.
Looks good, applied. Thanks. It will be in the next openssh update. http://pkgs.fedoraproject.org/cgit/openssh.git/commit/?id=811ec1dd368fff55a11fa6a1fcd6ee7c0f4ae466
Thanks so much Petr!
openssh-6.1p1-7.fc18 has been submitted as an update for Fedora 18. https://admin.fedoraproject.org/updates/openssh-6.1p1-7.fc18
Package openssh-6.1p1-7.fc18: * should fix your issue, * was pushed to the Fedora 18 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing openssh-6.1p1-7.fc18' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2013-5918/openssh-6.1p1-7.fc18 then log in and leave karma (feedback).
Package openssh-6.1p1-8.fc18: * should fix your issue, * was pushed to the Fedora 18 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing openssh-6.1p1-8.fc18' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2013-5918/openssh-6.1p1-8.fc18 then log in and leave karma (feedback).
openssh-6.1p1-8.fc18 has been pushed to the Fedora 18 stable repository. If problems still persist, please make note of it in this bug report.