From f10cedbea3e6d989dedd5f9e66a914dd26e47ebb Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 11 Dec 2014 12:34:10 +0100 Subject: [PATCH] rc: prune shell menu some more --- src/etc/rc.initial | 30 ++++---------- src/etc/rc.initial.toggle_sshd | 74 ---------------------------------- 2 files changed, 8 insertions(+), 96 deletions(-) delete mode 100755 src/etc/rc.initial.toggle_sshd diff --git a/src/etc/rc.initial b/src/etc/rc.initial index 2c09e4dd3..e2a338f92 100755 --- a/src/etc/rc.initial +++ b/src/etc/rc.initial @@ -23,13 +23,6 @@ fi # endless loop while : ; do -# Check to see if SSH is running. -if pgrep -q -a -F /var/run/sshd.pid sshd >/dev/null 2>&1; then - sshd_option="14) Disable Secure Shell (sshd)"; -else - sshd_option="14) Enable Secure Shell (sshd)"; -fi - # If we are on the LiveCD advertise the installer if _tmpdir=$(mktemp -d -q /.diskless.XXXXXX); then rmdir ${_tmpdir} @@ -37,14 +30,13 @@ else option99="99) Launch the installer" fi -echo " 0) Logout 8) Shell" -echo " 1) Assign Interfaces 9) pfTop" -echo " 2) Set interface(s) IP address 10) Filter Logs" -echo " 3) Reset the root password 11) Restart web interface" -echo " 4) Reset to factory defaults 12) Developer Shell" -echo " 5) Reboot system 13) Upgrade from console" -echo " 6) Halt system ${sshd_option}" -echo " 7) Ping host 15) Restore a configuration" +echo " 0) Logout 7) Ping host" +echo " 1) Assign Interfaces 8) Shell" +echo " 2) Set interface(s) IP address 9) pfTop" +echo " 3) Reset the root password 10) Filter Logs" +echo " 4) Reset to factory defaults 11) Restart web interface" +echo " 5) Reboot system 12) Upgrade from console" +echo " 6) Halt system 13) Restore a configuration" if [ -n "${option99}" ]; then # flat for alignment... echo " ${option99}" @@ -93,15 +85,9 @@ case ${opmode} in /usr/local/etc/rc.restart_webgui ;; 12) - /usr/local/sbin/pfSsh.php - ;; -13) /usr/local/etc/rc.initial.firmware_update ;; -14) - /usr/local/etc/rc.initial.toggle_sshd - ;; -15) +13) /usr/local/etc/rc.restore_config_backup ;; 99) diff --git a/src/etc/rc.initial.toggle_sshd b/src/etc/rc.initial.toggle_sshd deleted file mode 100755 index 30bda2feb..000000000 --- a/src/etc/rc.initial.toggle_sshd +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/local/bin/php -f -. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ - -require_once("config.inc"); -require_once("functions.inc"); -require_once("filter.inc"); - -conf_mount_rw(); - -$fp = fopen('php://stdin', 'r'); - -if (isset($config['system']['enablesshd'])) { - echo "SSHD is currently enabled. Would you like to disable? [y/n]? "; - $yn = chop(fgets($fp)); - if ($yn[0] == "y") { - unset($config['system']['enablesshd']); - echo "\nWriting configuration..."; - write_config(); - echo " done.\n"; - echo "\nDisabling SSHD..."; - send_event("service reload sshd"); - echo "\nReloading firewall rules."; - filter_configure(); - echo " done.\n"; - exec("ps awux | grep '/usr/sbin/sshd' | grep -v grep | awk '{print $2}' | xargs kill"); - } - -} else { - echo "SSHD is currently disabled. Would you like to enable? [y/n]? "; - $yn = chop(fgets($fp)); - if ($yn[0] == "y") { - $config['system']['enablesshd'] = true; - echo "\nWriting configuration..."; - write_config(); - echo " done.\n"; - echo "\nEnabling SSHD..."; - send_event("service reload sshd"); - echo "\nReloading firewall rules."; - filter_configure(); - echo " done.\n\n"; - } -} - -fclose($fp); - -conf_mount_ro();