summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/inc/config.inc2
-rwxr-xr-xetc/sshd14
2 files changed, 6 insertions, 10 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc
index 9fc50f4..2f8c8a2 100644
--- a/etc/inc/config.inc
+++ b/etc/inc/config.inc
@@ -487,7 +487,7 @@ function conf_mount_ro() {
return;
/* do not umount if generating ssh keys */
- if(file_exists("/tmp/keys_generating"))
+ if (is_subsystem_dirty('sshdkeys'))
return;
/* do not umount on cdrom or pfSense platforms */
diff --git a/etc/sshd b/etc/sshd
index 7c708f6..5904530 100755
--- a/etc/sshd
+++ b/etc/sshd
@@ -28,9 +28,7 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
- require_once("globals.inc");
require_once("config.inc");
- require_once("notices.inc");
if(isset($config['system']['enablesshd'])) {
/* do nothing, we're enabled */
@@ -145,23 +143,21 @@
}
/* are we already running? if so exit */
- if(file_exists("/tmp/keys_generating")) {
+ if(is_subsystem_dirty('sshdkeys')) {
conf_mount_ro();
exit;
}
- if (!file_exists("$sshConfigDir/ssh_host_key") or file_exists("/etc/keys_generating")) {
+ if (!file_exists("$sshConfigDir/ssh_host_key")) {
/* remove previous keys and regen later */
file_notice("SSH", "{$g['product_name']} has started creating your SSH keys. SSH Startup will be delayed. Please note that reloading the filter rules and changes will be delayed until this operation is completed.", "SSH KeyGen", "");
mwexec("rm /etc/ssh/ssh_host_*");
- touch("/etc/keys_generating");
- touch("/tmp/keys_generating");
+ mark_subsystem_dirty('sshdkeys');
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");
+ clear_subsystem_dirty('sshdkeys');
file_notice("SSH", "{$g['product_name']} has completed creating your SSH keys. SSH is now started.", "SSH Startup", "");
echo "Starting SSH... ";
}
@@ -189,4 +185,4 @@
}
conf_mount_ro();
-?> \ No newline at end of file
+?>
OpenPOWER on IntegriCloud