summaryrefslogtreecommitdiffstats
path: root/etc/sshd
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-07-08 21:16:59 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-07-08 21:16:59 +0000
commit9e3fc88e91ddf6f27c0842ccacc79d52b68aa942 (patch)
treef7a0d2acf74845431a378bc2861d2c2e2d67decd /etc/sshd
parent5563a2c0043b2b90820f4155ab8553ef1390da6b (diff)
downloadpfsense-9e3fc88e91ddf6f27c0842ccacc79d52b68aa942.zip
pfsense-9e3fc88e91ddf6f27c0842ccacc79d52b68aa942.tar.gz
* Store SSH keys in config.xml.
* Restore on bootup
Diffstat (limited to 'etc/sshd')
-rwxr-xr-xetc/sshd9
1 files changed, 8 insertions, 1 deletions
diff --git a/etc/sshd b/etc/sshd
index a9fb906..fbc1493 100755
--- a/etc/sshd
+++ b/etc/sshd
@@ -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 ...
OpenPOWER on IntegriCloud