diff --git a/plugins/shellinabox-plugin.plg b/plugins/shellinabox-plugin.plg index 66bdccc0..e832fb0c 100755 --- a/plugins/shellinabox-plugin.plg +++ b/plugins/shellinabox-plugin.plg @@ -3,13 +3,13 @@ - + - - + + ]> @@ -20,6 +20,13 @@ This Plugin installs and controls shellinabox for unRaid 6.1 All dependencies a --> +###2016.02.10 +- remove array event scripts and move to rc script +- start and stop with system not array +- add: choice for command line screenshot +- add: choice to backup settings in root directory on shutdown +- add: backup restore on reboot e.g. mc settings, bash history +- add: selection of all users of group users for runas ###2016.01.07c - add option to disable SSL ###2016.01.07b @@ -33,7 +40,9 @@ This Plugin installs and controls shellinabox for unRaid 6.1 All dependencies a - default config file ###2016.01.06 - change package path to plugin directory -- fix Tool/Command Line page misspelled cfg file and defaulting to port 8088 instead of 4200 +- fix Tool/Command Line page +- fix misspelled cfg file +- fix default port 8088 to 4200 ###2015.12.30 - remove old plugin directory on install ###2015.12.21 @@ -64,19 +73,21 @@ This Plugin installs and controls shellinabox for unRaid 6.1 All dependencies a - + &pkgURL;/shellinabox-2.19-x86_64-1sl.txz 96f21406d18181f469e732795d2965e8 - + &pkgURL;/linux-pam-1.1.8-x86_64-1gds.txz f5d4e99dc0b65f4d6b3bacf479c9c6e2 - + - -&gitURL;/archive/&plgname;.txz + +&gitURL;/archive/&plgNAME;.txz - -&gitURL;/archive/&plgname;.md5 + +&gitURL;/archive/&plgNAME;.md5 -/usr/local/emhttp/plugins/&name;/scripts/stop -removepkg &plgpath;/*.txz + +/etc/rc.d/rc.shellinaboxd shutdown + +removepkg &plgPATH;/*.txz rm -rf &emhttp; -rm -f &plgpath;/*.txz -rm -f &plgpath;/*.md5 +rm -f &plgPATH;/*.txz \ + &plgPATH;/*.md5 \ + /etc/rc.d/rc.shellinaboxd echo "" echo "-----------------------------------------------------------" @@ -173,6 +190,8 @@ echo "" # This will check each entry in the config so nothing is missing, and if missing, sets to default CFGFILE=/boot/config/plugins/shellinabox-plugin/shellinabox-plugin.cfg [ ! `cat "$CFGFILE" | grep SERVICE` ] && echo "SERVICE=\"disable\"" >> "$CFGFILE" +[ ! `cat "$CFGFILE" | grep SCREEN` ] && echo "SCREEN=\"disable\"" >> "$CFGFILE" +[ ! `cat "$CFGFILE" | grep SSL` ] && echo "SSL=\"disable\"" >> "$CFGFILE" [ ! `cat "$CFGFILE" | grep IPADDR` ] && echo "IPADDR=\"disable\"" >> "$CFGFILE" [ ! `cat "$CFGFILE" | grep ^PORT` ] && echo "PORT=\"4200\"" >> "$CFGFILE" [ ! `cat "$CFGFILE" | grep RUNAS` ] && echo "RUNAS=\"nobody\"" >> "$CFGFILE" diff --git a/plugins/shellinabox-plugin.xml b/plugins/shellinabox-plugin.xml index ec8bc736..295303c4 100644 --- a/plugins/shellinabox-plugin.xml +++ b/plugins/shellinabox-plugin.xml @@ -11,8 +11,15 @@ Shell In A Box implements a web server that can export arbitrary command line to http://lime-technology.com/forum/index.php?topic=42683.0 https://raw.githubusercontent.com/dmacias72/unRAID-plugins/master/plugins/shellinabox-plugin.png -2016-01-07 +2016-02-10 +###2016.02.10 +- remove array event scripts and move to rc script +- start and stop with system not array +- add: choice for command line screenshot +- add: choice to backup settings in root directory on shutdown +- add: backup restore on reboot e.g. mc settings, bash history +- add: selection of all users of group users for runas ###2016.01.07c - add option to disable SSL ###2016.01.07b diff --git a/source/shellinabox-plugin/usr/local/emhttp/plugins/shellinabox-plugin/Shellinabox.page b/source/shellinabox-plugin/usr/local/emhttp/plugins/shellinabox-plugin/Shellinabox.page index c4e37dfc..409bbbd4 100644 --- a/source/shellinabox-plugin/usr/local/emhttp/plugins/shellinabox-plugin/Shellinabox.page +++ b/source/shellinabox-plugin/usr/local/emhttp/plugins/shellinabox-plugin/Shellinabox.page @@ -5,17 +5,21 @@ Title="Command Line" 0 && $shellinabox_cfg['PORT'] < 65535 ) ? $shellinabox_cfg['PORT'] : "4200"; -$shellinabox_cert = isset($shellinabox_cfg['CERT']) ? $shellinabox_cfg['CERT'] : "certificate.pem"; -$shellinabox_running = trim(shell_exec( "[ -f /proc/`cat /var/run/shellinaboxd.pid 2> /dev/null`/exe ] && echo 'yes' || echo 'no' 2> /dev/null" )); -$shellinabox_version = shell_exec( "/usr/sbin/shellinaboxd --version 2>&1 | grep ShellInABox | sed -e 's/^ShellInABox version //'" ); -$shellinabox_version = ($shellinabox_running == "yes") ? - "$shellinabox_version": - "$shellinabox_version"; +$shellinabox_running = trim(shell_exec( "[ -f /proc/`cat /var/run/shellinaboxd.pid 2> /dev/null`/exe ] && echo 1 || echo 0 2> /dev/null" )); +$shellinabox_version = shell_exec( "/usr/sbin/shellinaboxd --version 2>&1 | grep ShellInABox | sed -e 's/^ShellInABox version //;s/(.*//'" ); +$shellinabox_port_status = ($shellinabox_running) ? + "$shellinabox_port": + "$shellinabox_port"; +exec("awk -F':' '{ if ( $3 >= 1000 ) print $1}' /etc/passwd", $shellinabox_users); // get array of group users ?>
@@ -28,29 +32,43 @@ Enable Shellinabox Server : +Port (): +: + +Run as User: +: + > + Connect by IP Address: -: Enable SSL connection: -: -Port: -: - -Run as User: -: + + - > - +Enable Home Directory Backup: +: + + :
@@ -64,19 +82,21 @@ $(function(){ function resetDATA(form) { form.IPADDR.value = "disable"; form.SSL.value = "disable"; + form.SCREEN.value = "disable"; + form.BACKUP.value = "disable"; form.PORT.value = "4200"; form.RUNAS.value = "nobody"; form.USERS.value = "nobody"; } function checkRUNNING(form) { - if ("" == "yes") + if ("" == true) { - $(".stopped").prop("disabled", true); + $(".shellinabox-run").prop("disabled", true); form.btnApply.disabled = true; //form.btnCert.disabled = false; }else{ - $(".stopped").prop("disabled", false); + $(".shellinabox-run").prop("disabled", false); //form.btnCert.disabled = true; } @@ -89,7 +109,7 @@ function checkRUNNING(form) { } function checkUSER(form, currentUSER) { - if (form.USERS.selectedIndex < 1 ) { + if (form.USERS.value != "other" ) { form.RUNAS.value = form.USERS.options[form.USERS.selectedIndex].value; form.RUNAS.type = "hidden"; } @@ -104,20 +124,17 @@ function checkUSER(form, currentUSER) { } function verifyDATA(form) { - if (isNumber(form.PORT.value)){ - if (form.PORT.value < 0 || form.PORT.value > 65535){ + if (!isNumber(form.PORT.value) || form.PORT.value < 0 || form.PORT.value > 65535){ form.PORT.value = "4200"; - } - } else { - form.PORT.value = "4200"; } - if (form.RUNAS.value == null || form.RUNAS.value == "" || form.RUNAS.value == "root" ){ + if (form.RUNAS.value == null || form.RUNAS.value == ""){ form.RUNAS.value = "nobody"; $shellinabox_runas = "nobody"; } form.SERVICE.value = form.SERVICE.value.replace(/ /g,"_"); form.IPADDR.value = form.IPADDR.value.replace(/ /g,"_"); form.SSL.value = form.SSL.value.replace(/ /g,"_"); + form.SCREEN.value = form.SCREEN.value.replace(/ /g,"_"); form.PORT.value = form.PORT.value.replace(/ /g,"_"); form.RUNAS.value = form.RUNAS.value.replace(/ /g,"_"); } diff --git a/source/shellinabox-plugin/usr/local/emhttp/plugins/shellinabox-plugin/scripts/start b/source/shellinabox-plugin/usr/local/emhttp/plugins/shellinabox-plugin/scripts/start index ef2ecbed..c7299a78 100755 --- a/source/shellinabox-plugin/usr/local/emhttp/plugins/shellinabox-plugin/scripts/start +++ b/source/shellinabox-plugin/usr/local/emhttp/plugins/shellinabox-plugin/scripts/start @@ -1,33 +1,2 @@ #!/bin/sh -# read our configuration -source /boot/config/plugins/shellinabox-plugin/shellinabox-plugin.cfg - -prog="shellinaboxd" -SHELLINABOXD="/usr/sbin/$prog" -LOCKFILE="/var/lock/$prog" -PIDFILE="/var/run/$prog.pid" -STYLES="/usr/local/emhttp/plugins/shellinabox-plugin/styles" -CONFIG="/boot/config/plugins/shellinabox-plugin" -USER_CSS="Color:+$STYLES/color.css,Monochrome:-$STYLES/monochrome.css;White:+$STYLES/white-on-black.css,Black:-$STYLES/black-on-white.css,Blue:-$STYLES/blue-on-black.css,Green:-$STYLES/green-on-black.css,Pink:-$STYLES/pink-on-black.css,Purple:-$STYLES/purple-on-black.css,Red:-$STYLES/red-on-black.css,Yellow:-$STYLES/yellow-on-black.css" - -# no-op if already running -if [ ! -r $PIDFILE ]; then - - SSL_CONFIG="" - if [ $SSL == "disable" ]; then - SSL_CONFIG="--disable-ssl" - fi - - sleep 1 - nohup /usr/sbin/$prog --user=$RUNAS --background=$PIDFILE --port=$PORT --cert=$CONFIG --user-css=$USER_CSS $SSL_CONFIG > /dev/null 2>&1 | logger -tshellinaboxd & - touch $LOCKFILE - TIMER=0 - while [ ! -e $PIDFILE ]; do - sleep 1 - let TIMER=$TIMER+1 - if [ $TIMER -gt 5 ]; then - echo -n "$PIDFILE not created" - break - fi - done -fi +/etc/rc.d/rc.shellinaboxd start diff --git a/source/shellinabox-plugin/usr/local/emhttp/plugins/shellinabox-plugin/scripts/stop b/source/shellinabox-plugin/usr/local/emhttp/plugins/shellinabox-plugin/scripts/stop index 3abb73aa..27b35b70 100755 --- a/source/shellinabox-plugin/usr/local/emhttp/plugins/shellinabox-plugin/scripts/stop +++ b/source/shellinabox-plugin/usr/local/emhttp/plugins/shellinabox-plugin/scripts/stop @@ -1,20 +1,2 @@ #!/bin/sh -prog="shellinaboxd" -SHELLINABOXD="/usr/sbin/$prog" -LOCKFILE="/var/lock/$prog" -PIDFILE="/var/run/$prog.pid" - -# no-op if not running -if [ -r $PIDFILE ]; then -TIMER=0 -while `killall $prog 2>/dev/null`; do - sleep 1 - TIMER=$((TIMER+1)) - if [ $TIMER -ge 30 ]; then - killall -9 $prog - sleep 1 - break - fi -done -rm -f $LOCKFILE && rm -f $PIDFILE -fi +/etc/rc.d/rc.shellinaboxd stop