diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-07-08 21:16:59 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-07-08 21:16:59 +0000 |
commit | 9e3fc88e91ddf6f27c0842ccacc79d52b68aa942 (patch) | |
tree | f7a0d2acf74845431a378bc2861d2c2e2d67decd /etc/sshd | |
parent | 5563a2c0043b2b90820f4155ab8553ef1390da6b (diff) | |
download | pfsense-9e3fc88e91ddf6f27c0842ccacc79d52b68aa942.zip pfsense-9e3fc88e91ddf6f27c0842ccacc79d52b68aa942.tar.gz |
* Store SSH keys in config.xml.
* Restore on bootup
Diffstat (limited to 'etc/sshd')
-rwxr-xr-x | etc/sshd | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -51,10 +51,17 @@ pclose($fd); $sshConfigDir = "/etc/ssh"; - if (!file_exists("$sshConfigDir/ssh_host_key")) { + if (!file_exists("$sshConfigDir/ssh_host_key") and $config['ssh']['dsa'] <> "") { system("/usr/bin/ssh-keygen -t rsa1 -N '' -f $sshConfigDir/ssh_host_key"); system("/usr/bin/ssh-keygen -t rsa -N '' -f $sshConfigDir/ssh_host_rsa_key"); system("/usr/bin/ssh-keygen -t dsa -N '' -f $sshConfigDir/ssh_host_dsa_key"); + $config['ssh']['dsa'] = return_file_as_string("{$sshConfigDir}/ssh_host_dsa_key"); + $config['ssh']['rsa'] = return_file_as_string("{$sshConfigDir}/ssh_host_rsa_key"); + $config['ssh']['rsa1']= return_file_as_string("{$sshConfigDir}/ssh_host_key"); + } else { + file_put_contents("{$sshConfigDir}/ssh_host_key", $config['ssh']['rsa1']); + file_put_contents("{$sshConfigDir}/ssh_host_rsa_key", $config['ssh']['rsa']); + file_put_contents("{$sshConfigDir}/ssh_host_dsa_key", $config['ssh']['dsa']); } // And finally ... |