add screenshot and backup
This commit is contained in:
parent
ef80ad1a12
commit
121d89e076
|
@ -3,13 +3,13 @@
|
||||||
<!DOCTYPE PLUGIN [
|
<!DOCTYPE PLUGIN [
|
||||||
<!ENTITY name "shellinabox-plugin">
|
<!ENTITY name "shellinabox-plugin">
|
||||||
<!ENTITY author "dmacias72">
|
<!ENTITY author "dmacias72">
|
||||||
<!ENTITY version "2016.01.07c">
|
<!ENTITY version "2016.02.10">
|
||||||
<!ENTITY launch "Settings/Shellinabox">
|
<!ENTITY launch "Settings/Shellinabox">
|
||||||
<!ENTITY gitURL "https://raw.githubusercontent.com/&author;/unRAID-plugins/master">
|
<!ENTITY gitURL "https://raw.githubusercontent.com/&author;/unRAID-plugins/master">
|
||||||
<!ENTITY pluginURL "&gitURL;/plugins/&name;.plg">
|
<!ENTITY pluginURL "&gitURL;/plugins/&name;.plg">
|
||||||
<!ENTITY pkgURL "&gitURL;/source/packages">
|
<!ENTITY pkgURL "&gitURL;/source/packages">
|
||||||
<!ENTITY plgpath "/boot/config/plugins/&name;">
|
<!ENTITY plgPATH "/boot/config/plugins/&name;">
|
||||||
<!ENTITY plgname "&name;-&version;-x86_64-1">
|
<!ENTITY plgNAME "&name;-&version;-x86_64-1">
|
||||||
<!ENTITY emhttp "/usr/local/emhttp/plugins/&name;">
|
<!ENTITY emhttp "/usr/local/emhttp/plugins/&name;">
|
||||||
]>
|
]>
|
||||||
|
|
||||||
|
@ -20,6 +20,13 @@ This Plugin installs and controls shellinabox for unRaid 6.1 All dependencies a
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<CHANGES>
|
<CHANGES>
|
||||||
|
###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
|
###2016.01.07c
|
||||||
- add option to disable SSL
|
- add option to disable SSL
|
||||||
###2016.01.07b
|
###2016.01.07b
|
||||||
|
@ -33,7 +40,9 @@ This Plugin installs and controls shellinabox for unRaid 6.1 All dependencies a
|
||||||
- default config file
|
- default config file
|
||||||
###2016.01.06
|
###2016.01.06
|
||||||
- change package path to plugin directory
|
- 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
|
###2015.12.30
|
||||||
- remove old plugin directory on install
|
- remove old plugin directory on install
|
||||||
###2015.12.21
|
###2015.12.21
|
||||||
|
@ -64,19 +73,21 @@ This Plugin installs and controls shellinabox for unRaid 6.1 All dependencies a
|
||||||
</CHANGES>
|
</CHANGES>
|
||||||
|
|
||||||
|
|
||||||
<FILE Name="&plgpath;/shellinabox-2.19-x86_64-1sl.txz" Run="upgradepkg --install-new">
|
<FILE Name="&plgPATH;/shellinabox-2.19-x86_64-1sl.txz" Run="upgradepkg --install-new">
|
||||||
<URL>&pkgURL;/shellinabox-2.19-x86_64-1sl.txz</URL>
|
<URL>&pkgURL;/shellinabox-2.19-x86_64-1sl.txz</URL>
|
||||||
<MD5>96f21406d18181f469e732795d2965e8</MD5>
|
<MD5>96f21406d18181f469e732795d2965e8</MD5>
|
||||||
</FILE>
|
</FILE>
|
||||||
<FILE Name="&plgpath;/linux-pam-1.1.8-x86_64-1gds.txz" Run="upgradepkg --install-new">
|
<FILE Name="&plgPATH;/linux-pam-1.1.8-x86_64-1gds.txz" Run="upgradepkg --install-new">
|
||||||
<URL>&pkgURL;/linux-pam-1.1.8-x86_64-1gds.txz</URL>
|
<URL>&pkgURL;/linux-pam-1.1.8-x86_64-1gds.txz</URL>
|
||||||
<MD5>f5d4e99dc0b65f4d6b3bacf479c9c6e2</MD5>
|
<MD5>f5d4e99dc0b65f4d6b3bacf479c9c6e2</MD5>
|
||||||
</FILE>
|
</FILE>
|
||||||
|
|
||||||
<FILE Name="&plgpath;/&name;.cfg">
|
<FILE Name="&plgPATH;/&name;.cfg">
|
||||||
<INLINE>
|
<INLINE>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
SERVICE="disable"
|
SERVICE="disable"
|
||||||
|
SSL="disable"
|
||||||
|
SCREEN="disable"
|
||||||
IPADDR="disable"
|
IPADDR="disable"
|
||||||
PORT="4200"
|
PORT="4200"
|
||||||
RUNAS="nobody"
|
RUNAS="nobody"
|
||||||
|
@ -88,15 +99,15 @@ CERT="certificate.pem"
|
||||||
<!--
|
<!--
|
||||||
The 'plugin' package file.
|
The 'plugin' package file.
|
||||||
-->
|
-->
|
||||||
<FILE Name="&plgpath;/&plgname;.txz">
|
<FILE Name="&plgPATH;/&plgNAME;.txz">
|
||||||
<URL>&gitURL;/archive/&plgname;.txz</URL>
|
<URL>&gitURL;/archive/&plgNAME;.txz</URL>
|
||||||
</FILE>
|
</FILE>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
The 'plugin' package MD5 hash.
|
The 'plugin' package MD5 hash.
|
||||||
-->
|
-->
|
||||||
<FILE Name="&plgpath;/&plgname;.md5">
|
<FILE Name="&plgPATH;/&plgNAME;.md5">
|
||||||
<URL>&gitURL;/archive/&plgname;.md5</URL>
|
<URL>&gitURL;/archive/&plgNAME;.md5</URL>
|
||||||
</FILE>
|
</FILE>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
@ -112,27 +123,28 @@ if [[ ${version:0:3} == 6.0 ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Verify and install plugin package
|
# Verify and install plugin package
|
||||||
sum1=$(/usr/bin/md5sum &plgpath;/&plgname;.txz)
|
sum1=$(/usr/bin/md5sum &plgPATH;/&plgNAME;.txz)
|
||||||
sum2=$(/usr/bin/cat &plgpath;/&plgname;.md5)
|
sum2=$(/usr/bin/cat &plgPATH;/&plgNAME;.md5)
|
||||||
if [ "${sum1:0:32}" != "${sum2:0:32}" ]; then
|
if [ "${sum1:0:32}" != "${sum2:0:32}" ]; then
|
||||||
echo "Wrong 'plugin' package md5 hash."
|
echo "Wrong 'plugin' package md5 hash."
|
||||||
rm &plgpath;/&plgname;.txz
|
rm &plgPATH;/&plgNAME;.txz
|
||||||
rm &plgpath;/&plgname;.md5
|
rm &plgPATH;/&plgNAME;.md5
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
#remove old plugin name directory
|
#remove old plugin name directory
|
||||||
if [ -d /usr/local/emhttp/plugins/shellinabox ]; then
|
if [ -d /usr/local/emhttp/plugins/shellinabox ]; then
|
||||||
rm -rf /usr/local/emhttp/plugins/shellinabox
|
rm -rf /usr/local/emhttp/plugins/shellinabox
|
||||||
fi
|
fi
|
||||||
upgradepkg --install-new &plgpath;/&plgname;.txz
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Update file permissions of scripts
|
# upgrade package
|
||||||
chmod +0755 &emhttp;/scripts/*
|
upgradepkg --install-new &plgPATH;/&plgNAME;.txz
|
||||||
|
|
||||||
|
# start shellinabox daemon
|
||||||
|
/etc/rc.d/rc.shellinaboxd restore
|
||||||
|
|
||||||
# Cleaning old source files
|
# Cleaning old source files
|
||||||
find &plgpath;/ -type f -iname "&name;*.txz" ! -iname "*&version;*" -delete
|
find &plgPATH;/ -type f -iname "&name;*.txz" ! -iname "*&version;*" -delete
|
||||||
find &plgpath;/ -type f -iname "&name;*.md5" ! -iname "*&version;*" -delete
|
find &plgPATH;/ -type f -iname "&name;*.md5" ! -iname "*&version;*" -delete
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "-----------------------------------------------------------"
|
echo "-----------------------------------------------------------"
|
||||||
|
@ -142,6 +154,8 @@ echo " Copyright 2016, &author;"
|
||||||
echo " Version: &version;"
|
echo " Version: &version;"
|
||||||
echo "-----------------------------------------------------------"
|
echo "-----------------------------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
fi
|
||||||
</INLINE>
|
</INLINE>
|
||||||
</FILE>
|
</FILE>
|
||||||
|
|
||||||
|
@ -150,11 +164,14 @@ The 'remove' script.
|
||||||
-->
|
-->
|
||||||
<FILE Run="/bin/bash" Method="remove">
|
<FILE Run="/bin/bash" Method="remove">
|
||||||
<INLINE>
|
<INLINE>
|
||||||
/usr/local/emhttp/plugins/&name;/scripts/stop
|
|
||||||
removepkg &plgpath;/*.txz
|
/etc/rc.d/rc.shellinaboxd shutdown
|
||||||
|
|
||||||
|
removepkg &plgPATH;/*.txz
|
||||||
rm -rf &emhttp;
|
rm -rf &emhttp;
|
||||||
rm -f &plgpath;/*.txz
|
rm -f &plgPATH;/*.txz \
|
||||||
rm -f &plgpath;/*.md5
|
&plgPATH;/*.md5 \
|
||||||
|
/etc/rc.d/rc.shellinaboxd
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
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
|
# 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
|
CFGFILE=/boot/config/plugins/shellinabox-plugin/shellinabox-plugin.cfg
|
||||||
[ ! `cat "$CFGFILE" | grep SERVICE` ] && echo "SERVICE=\"disable\"" >> "$CFGFILE"
|
[ ! `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 IPADDR` ] && echo "IPADDR=\"disable\"" >> "$CFGFILE"
|
||||||
[ ! `cat "$CFGFILE" | grep ^PORT` ] && echo "PORT=\"4200\"" >> "$CFGFILE"
|
[ ! `cat "$CFGFILE" | grep ^PORT` ] && echo "PORT=\"4200\"" >> "$CFGFILE"
|
||||||
[ ! `cat "$CFGFILE" | grep RUNAS` ] && echo "RUNAS=\"nobody\"" >> "$CFGFILE"
|
[ ! `cat "$CFGFILE" | grep RUNAS` ] && echo "RUNAS=\"nobody\"" >> "$CFGFILE"
|
||||||
|
|
|
@ -11,8 +11,15 @@ Shell In A Box implements a web server that can export arbitrary command line to
|
||||||
</Description>
|
</Description>
|
||||||
<Support>http://lime-technology.com/forum/index.php?topic=42683.0</Support>
|
<Support>http://lime-technology.com/forum/index.php?topic=42683.0</Support>
|
||||||
<Icon>https://raw.githubusercontent.com/dmacias72/unRAID-plugins/master/plugins/shellinabox-plugin.png</Icon>
|
<Icon>https://raw.githubusercontent.com/dmacias72/unRAID-plugins/master/plugins/shellinabox-plugin.png</Icon>
|
||||||
<Date>2016-01-07</Date>
|
<Date>2016-02-10</Date>
|
||||||
<Changes>
|
<Changes>
|
||||||
|
###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
|
###2016.01.07c
|
||||||
- add option to disable SSL
|
- add option to disable SSL
|
||||||
###2016.01.07b
|
###2016.01.07b
|
||||||
|
|
|
@ -6,16 +6,20 @@ Title="Command Line"
|
||||||
$sName = "shellinaboxd";
|
$sName = "shellinaboxd";
|
||||||
$shellinabox_cfg = parse_plugin_cfg("shellinabox-plugin");
|
$shellinabox_cfg = parse_plugin_cfg("shellinabox-plugin");
|
||||||
$shellinabox_service = isset($shellinabox_cfg['SERVICE']) ? $shellinabox_cfg['SERVICE'] : "disable";
|
$shellinabox_service = isset($shellinabox_cfg['SERVICE']) ? $shellinabox_cfg['SERVICE'] : "disable";
|
||||||
|
$shellinabox_screen = isset($shellinabox_cfg['SCREEN']) ? $shellinabox_cfg['SCREEN'] : "disable";
|
||||||
|
$shellinabox_backup = isset($shellinabox_cfg['BACKUP']) ? $shellinabox_cfg['BACKUP'] : "disable";
|
||||||
|
$shellinabox_ssl = isset($shellinabox_cfg['SSL']) ? $shellinabox_cfg['SSL'] : "disable";
|
||||||
$shellinabox_runas = isset($shellinabox_cfg['RUNAS']) ? $shellinabox_cfg['RUNAS'] : "nobody";
|
$shellinabox_runas = isset($shellinabox_cfg['RUNAS']) ? $shellinabox_cfg['RUNAS'] : "nobody";
|
||||||
$shellinabox_ipaddr = isset($shellinabox_cfg['IPADDR']) ? $shellinabox_cfg['IPADDR'] : "disable";
|
$shellinabox_ipaddr = isset($shellinabox_cfg['IPADDR']) ? $shellinabox_cfg['IPADDR'] : "disable";
|
||||||
$shellinabox_host = ($shellinabox_ipaddr == "disable") ? $var['NAME'] : $var['IPADDR'];
|
$shellinabox_host = ($shellinabox_ipaddr == "disable") ? $var['NAME'] : $var['IPADDR'];
|
||||||
$shellinabox_port = (isset($shellinabox_cfg['PORT']) && is_numeric($shellinabox_cfg['PORT']) && $shellinabox_cfg['PORT'] > 0 && $shellinabox_cfg['PORT'] < 65535 ) ? $shellinabox_cfg['PORT'] : "4200";
|
|
||||||
$shellinabox_cert = isset($shellinabox_cfg['CERT']) ? $shellinabox_cfg['CERT'] : "certificate.pem";
|
$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_port = (isset($shellinabox_cfg['PORT']) && is_numeric($shellinabox_cfg['PORT']) && $shellinabox_cfg['PORT'] > 0 && $shellinabox_cfg['PORT'] < 65535 ) ? $shellinabox_cfg['PORT'] : "4200";
|
||||||
$shellinabox_version = shell_exec( "/usr/sbin/shellinaboxd --version 2>&1 | grep ShellInABox | sed -e 's/^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 = ($shellinabox_running == "yes") ?
|
$shellinabox_version = shell_exec( "/usr/sbin/shellinaboxd --version 2>&1 | grep ShellInABox | sed -e 's/^ShellInABox version //;s/(.*//'" );
|
||||||
"<a style='color:green;' target='_blank' href='http://".$shellinabox_host.":".$shellinabox_port."' title='Click on link then accept security, then /Tools/CommandLine will work'><b>$shellinabox_version</b></a>":
|
$shellinabox_port_status = ($shellinabox_running) ?
|
||||||
"<b><font style='color:orange;'>$shellinabox_version</font></b>";
|
"<a style='color:green;' target='_blank' href='http://".$shellinabox_host.":".$shellinabox_port."' title='Click on link then accept security, then /Tools/CommandLine will work'><b>$shellinabox_port</b></a>":
|
||||||
|
"<b><font style='color:orange;'>$shellinabox_port</font></b>";
|
||||||
|
exec("awk -F':' '{ if ( $3 >= 1000 ) print $1}' /etc/passwd", $shellinabox_users); // get array of group users
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form markdown="1" name="shellinabox_settings" method="POST" action="/update.php" target="progressFrame">
|
<form markdown="1" name="shellinabox_settings" method="POST" action="/update.php" target="progressFrame">
|
||||||
|
@ -28,29 +32,43 @@ Enable Shellinabox Server <?=$shellinabox_version;?>:
|
||||||
<?=mk_option($shellinabox_service, "enable", "Yes");?>
|
<?=mk_option($shellinabox_service, "enable", "Yes");?>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
Port (<?=$shellinabox_port_status;?>):
|
||||||
|
: <input style="width:135px" id="PORT" type="text" class="shellinabox-run" name="PORT" maxlength="40" value="<?=$shellinabox_port;?>" title="port must be 0-65535" placeholder="Default Port is 8000" >
|
||||||
|
|
||||||
|
Run as User:
|
||||||
|
: <select id="USERS" class="shellinabox-run" title="select user, cannot be root" size="1" onChange="checkUSER(this.form, '<?=$shellinabox_runas;?>');">
|
||||||
|
<?=mk_option($aesir_runas, "nobody", "nobody");?>
|
||||||
|
<?php foreach($shellinabox_users as $shellinabox_user){echo mk_option($shellinabox_runas, trim($shellinabox_user), trim($shellinabox_user));};?>
|
||||||
|
<option value='other' <?=($shellinabox_runas != "root" && $shellinabox_runas != "nobody" && !in_array($shellinabox_runas, $shellinabox_users))?"selected=yes":"";?>>other</option>
|
||||||
|
<?=mk_option($shellinabox_runas, "root", "root");?>
|
||||||
|
</select>
|
||||||
|
<input type="hidden" name="RUNAS" style="width:222px" maxlength="40" value=<?=$shellinabox_runas;?> >
|
||||||
|
|
||||||
Connect by IP Address:
|
Connect by IP Address:
|
||||||
: <select id="IPADDR" name="IPADDR" size="1" class="stopped">
|
: <select id="IPADDR" name="IPADDR" size="1" class="shellinabox-run">
|
||||||
<?=mk_option($shellinabox_ipaddr, "disable", "No");?>
|
<?=mk_option($shellinabox_ipaddr, "disable", "No");?>
|
||||||
<?=mk_option($shellinabox_ipaddr, "enable", "Yes");?>
|
<?=mk_option($shellinabox_ipaddr, "enable", "Yes");?>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
Enable SSL connection:
|
Enable SSL connection:
|
||||||
: <select id="SSL" name="SSL" size="1" class="stopped">
|
: <select id="SSL" name="SSL" size="1" class="shellinabox-run">
|
||||||
<?=mk_option($shellinabox_ssl, "disable", "No");?>
|
<?=mk_option($shellinabox_ssl, "disable", "No");?>
|
||||||
<?=mk_option($shellinabox_ssl, "enable", "Yes");?>
|
<?=mk_option($shellinabox_ssl, "enable", "Yes");?>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
Port:
|
Enable Command Line Screenshot:
|
||||||
: <input style="width:135px" id="PORT" type="text" class="stopped" name="PORT" maxlength="40" value="<?=$shellinabox_port;?>" title="port must be 0-65535" placeholder="Default Port is 8000" >
|
: <select id="SCREEN" name="SCREEN" size="1" title="shows screenshot when you log in">
|
||||||
|
<?=mk_option($shellinabox_screen, "disable", "No");?>
|
||||||
Run as User:
|
<?=mk_option($shellinabox_screen, "enable", "Yes");?>
|
||||||
: <select id="USERS" class="stopped" title="select user, cannot be root" size="1" onChange="checkUSER(this.form, '<?=$shellinabox_runas;?>');">
|
|
||||||
<?=mk_option($shellinabox_runas, "nobody", "nobody");?>
|
|
||||||
<option value='other' <?=($shellinabox_runas != "root" && $shellinabox_runas != "nobody")?"selected=yes":"";?>>other</option>
|
|
||||||
</select>
|
</select>
|
||||||
<input type="hidden" name="RUNAS" style="width:222px" maxlength="40" value=<?=$shellinabox_runas;?> >
|
|
||||||
|
|
||||||
<input id="DEFAULT" class="stopped" type="submit" value="Default" onClick="resetDATA(this.form)">
|
Enable Home Directory Backup:
|
||||||
|
: <select id="BACKUP" name="BACKUP" size="1" title="shows screenshot when you log in">
|
||||||
|
<?=mk_option($shellinabox_backup, "disable", "No");?>
|
||||||
|
<?=mk_option($shellinabox_backup, "enable", "Yes");?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<input id="DEFAULT" class="shellinabox-run" type="submit" value="Default" onClick="resetDATA(this.form)">
|
||||||
: <input id="btnApply" type="submit" value="Apply" onClick="verifyDATA(this.form)"><input type="button" value="Done" onClick="done()"><!--<button id="btnCert" type="button" onclick="window.location.href='http://<?=$shellinabox_host;?>/boot/config/plugins/shellinabox-plugin/<?=$shellinabox_cert;?>'"> Download Cert </button>-->
|
: <input id="btnApply" type="submit" value="Apply" onClick="verifyDATA(this.form)"><input type="button" value="Done" onClick="done()"><!--<button id="btnCert" type="button" onclick="window.location.href='http://<?=$shellinabox_host;?>/boot/config/plugins/shellinabox-plugin/<?=$shellinabox_cert;?>'"> Download Cert </button>-->
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
@ -64,19 +82,21 @@ $(function(){
|
||||||
function resetDATA(form) {
|
function resetDATA(form) {
|
||||||
form.IPADDR.value = "disable";
|
form.IPADDR.value = "disable";
|
||||||
form.SSL.value = "disable";
|
form.SSL.value = "disable";
|
||||||
|
form.SCREEN.value = "disable";
|
||||||
|
form.BACKUP.value = "disable";
|
||||||
form.PORT.value = "4200";
|
form.PORT.value = "4200";
|
||||||
form.RUNAS.value = "nobody";
|
form.RUNAS.value = "nobody";
|
||||||
form.USERS.value = "nobody";
|
form.USERS.value = "nobody";
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkRUNNING(form) {
|
function checkRUNNING(form) {
|
||||||
if ("<?=$shellinabox_running;?>" == "yes")
|
if ("<?=$shellinabox_running;?>" == true)
|
||||||
{
|
{
|
||||||
$(".stopped").prop("disabled", true);
|
$(".shellinabox-run").prop("disabled", true);
|
||||||
form.btnApply.disabled = true;
|
form.btnApply.disabled = true;
|
||||||
//form.btnCert.disabled = false;
|
//form.btnCert.disabled = false;
|
||||||
}else{
|
}else{
|
||||||
$(".stopped").prop("disabled", false);
|
$(".shellinabox-run").prop("disabled", false);
|
||||||
//form.btnCert.disabled = true;
|
//form.btnCert.disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +109,7 @@ function checkRUNNING(form) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkUSER(form, currentUSER) {
|
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.value = form.USERS.options[form.USERS.selectedIndex].value;
|
||||||
form.RUNAS.type = "hidden";
|
form.RUNAS.type = "hidden";
|
||||||
}
|
}
|
||||||
|
@ -104,20 +124,17 @@ function checkUSER(form, currentUSER) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function verifyDATA(form) {
|
function verifyDATA(form) {
|
||||||
if (isNumber(form.PORT.value)){
|
if (!isNumber(form.PORT.value) || form.PORT.value < 0 || form.PORT.value > 65535){
|
||||||
if (form.PORT.value < 0 || form.PORT.value > 65535){
|
|
||||||
form.PORT.value = "4200";
|
form.PORT.value = "4200";
|
||||||
}
|
}
|
||||||
} else {
|
if (form.RUNAS.value == null || form.RUNAS.value == ""){
|
||||||
form.PORT.value = "4200";
|
|
||||||
}
|
|
||||||
if (form.RUNAS.value == null || form.RUNAS.value == "" || form.RUNAS.value == "root" ){
|
|
||||||
form.RUNAS.value = "nobody";
|
form.RUNAS.value = "nobody";
|
||||||
$shellinabox_runas = "nobody";
|
$shellinabox_runas = "nobody";
|
||||||
}
|
}
|
||||||
form.SERVICE.value = form.SERVICE.value.replace(/ /g,"_");
|
form.SERVICE.value = form.SERVICE.value.replace(/ /g,"_");
|
||||||
form.IPADDR.value = form.IPADDR.value.replace(/ /g,"_");
|
form.IPADDR.value = form.IPADDR.value.replace(/ /g,"_");
|
||||||
form.SSL.value = form.SSL.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.PORT.value = form.PORT.value.replace(/ /g,"_");
|
||||||
form.RUNAS.value = form.RUNAS.value.replace(/ /g,"_");
|
form.RUNAS.value = form.RUNAS.value.replace(/ /g,"_");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,33 +1,2 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# read our configuration
|
/etc/rc.d/rc.shellinaboxd start
|
||||||
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
|
|
||||||
|
|
|
@ -1,20 +1,2 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
prog="shellinaboxd"
|
/etc/rc.d/rc.shellinaboxd stop
|
||||||
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
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user