summaryrefslogtreecommitdiffstats
path: root/etc/sshd
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-09-22 20:14:46 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-09-22 20:14:46 +0000
commitdcb6476880371a5b1ae3b9e74f53c35786902082 (patch)
treef1f0e575f8e54e404dc2db6ca7d5c47f8fb0577d /etc/sshd
parent2d195c3ff620f91ce05ce0e7a3a3f1c4db04b24e (diff)
downloadpfsense-dcb6476880371a5b1ae3b9e74f53c35786902082.zip
pfsense-dcb6476880371a5b1ae3b9e74f53c35786902082.tar.gz
Do not allow sshd script to run multiple times concurrently.
Diffstat (limited to 'etc/sshd')
-rwxr-xr-xetc/sshd6
1 files changed, 6 insertions, 0 deletions
diff --git a/etc/sshd b/etc/sshd
index 9f2f3b8..e1a709c 100755
--- a/etc/sshd
+++ b/etc/sshd
@@ -87,16 +87,22 @@
write_config("Clearing SSH keys from config.xml");
}
+ /* are we already running? if so exit */
+ if(file_exists("/tmp/keys_generating"))
+ exit;
+
if (!file_exists("$sshConfigDir/ssh_host_key") or file_exists("/etc/keys_generating")) {
/* remove previous keys and regen later */
conf_mount_rw();
mwexec("rm /etc/ssh/ssh_host_*");
touch("/etc/keys_generating");
+ touch("/tmp/keys_generating");
echo " Generating Keys:\n";
system("/usr/bin/nice -n20 /usr/bin/ssh-keygen -t rsa1 -N '' -f $sshConfigDir/ssh_host_key");
system("/usr/bin/nice -n20 /usr/bin/ssh-keygen -t rsa -N '' -f $sshConfigDir/ssh_host_rsa_key");
system("/usr/bin/nice -n20 /usr/bin/ssh-keygen -t dsa -N '' -f $sshConfigDir/ssh_host_dsa_key");
unlink("/etc/keys_generating");
+ unlink("/tmp/keys_generating");
echo "Starting SSH... ";
}
OpenPOWER on IntegriCloud