summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xetc/rc.initial8
-rw-r--r--etc/rc.initial.toggle_sshd1
2 files changed, 8 insertions, 1 deletions
diff --git a/etc/rc.initial b/etc/rc.initial
index 1c92821..fafa70c 100755
--- a/etc/rc.initial
+++ b/etc/rc.initial
@@ -73,7 +73,13 @@ echo "10) Filter Logs"
echo "11) Restart webConfigurator"
echo "12) pfSense PHP shell"
echo "13) Upgrade from console"
-echo "14) Enable/Disable SSHD"
+SSHD=`netstat -an | grep "*.22" | wc -l`
+if [ "$SSHD" -gt 0 ]; then
+ echo "14) Disable Secure Sheel (sshd)";
+else
+ echo "14) Enable Secure Sheel (sshd)";
+fi
+
for i in /var/db/pfi/capable_*; do
if [ -f $i -a ! -L /cf/conf ]; then
echo "98) Move configuration file to removable device"
diff --git a/etc/rc.initial.toggle_sshd b/etc/rc.initial.toggle_sshd
index c086d94..f8a318c 100644
--- a/etc/rc.initial.toggle_sshd
+++ b/etc/rc.initial.toggle_sshd
@@ -44,6 +44,7 @@ if (isset($config['system']['enablesshd'])) {
echo "\n\nDisabling SSHD...";
exec("/etc/sshd");
echo "\n";
+ exec("ps awux | grep '/usr/sbin/sshd' | grep -v grep | awk '{print $2}' | xargs kill")
}
} else {
OpenPOWER on IntegriCloud