Commit f10cedbe authored by Franco Fichtner's avatar Franco Fichtner

rc: prune shell menu some more

parent b3f9d883
...@@ -23,13 +23,6 @@ fi ...@@ -23,13 +23,6 @@ fi
# endless loop # endless loop
while : ; do 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 we are on the LiveCD advertise the installer
if _tmpdir=$(mktemp -d -q /.diskless.XXXXXX); then if _tmpdir=$(mktemp -d -q /.diskless.XXXXXX); then
rmdir ${_tmpdir} rmdir ${_tmpdir}
...@@ -37,14 +30,13 @@ else ...@@ -37,14 +30,13 @@ else
option99="99) Launch the installer" option99="99) Launch the installer"
fi fi
echo " 0) Logout 8) Shell" echo " 0) Logout 7) Ping host"
echo " 1) Assign Interfaces 9) pfTop" echo " 1) Assign Interfaces 8) Shell"
echo " 2) Set interface(s) IP address 10) Filter Logs" echo " 2) Set interface(s) IP address 9) pfTop"
echo " 3) Reset the root password 11) Restart web interface" echo " 3) Reset the root password 10) Filter Logs"
echo " 4) Reset to factory defaults 12) Developer Shell" echo " 4) Reset to factory defaults 11) Restart web interface"
echo " 5) Reboot system 13) Upgrade from console" echo " 5) Reboot system 12) Upgrade from console"
echo " 6) Halt system ${sshd_option}" echo " 6) Halt system 13) Restore a configuration"
echo " 7) Ping host 15) Restore a configuration"
if [ -n "${option99}" ]; then if [ -n "${option99}" ]; then
# flat for alignment... # flat for alignment...
echo " ${option99}" echo " ${option99}"
...@@ -93,15 +85,9 @@ case ${opmode} in ...@@ -93,15 +85,9 @@ case ${opmode} in
/usr/local/etc/rc.restart_webgui /usr/local/etc/rc.restart_webgui
;; ;;
12) 12)
/usr/local/sbin/pfSsh.php
;;
13)
/usr/local/etc/rc.initial.firmware_update /usr/local/etc/rc.initial.firmware_update
;; ;;
14) 13)
/usr/local/etc/rc.initial.toggle_sshd
;;
15)
/usr/local/etc/rc.restore_config_backup /usr/local/etc/rc.restore_config_backup
;; ;;
99) 99)
......
#!/usr/local/bin/php -f
<?php
/*
sshd - Modified to work on disk based system
Copyright 2004 Scott K Ullrich
Original Copyright (C) 2004 Fred Mol <fredmol@xs4all.nl>.
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();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment