[Plugin] Command Line Tools (Shell in a Box) for 6.1+


dmacias

Recommended Posts

Command Line Tools (Shell in a Box 2.20) for 6.1+

Command Line Tools implements Shell In A Box. A web server that can export arbitrary command line tools to a web based terminal emulator. A Command Line tool is created under the Tools menu. Backup and restore user home directory on system shutdown and start. Includes screenfetch for command line screenshots.

Using unoffical Shell In A Box fork https://github.com/shellinabox/shellinabox

 

I renamed the plugin so you will need to uninstall the old then install the new from the link below.  All settings and root home directory backup will automatically be copied over to the new plugin and the old plugin folder removed

 

This plugin allows for a SSL connection to the command line through the webgui.

Added support for ssl in 6.4+ with the built in letsencrypt certificates

 

1. Copy the plugin url:

https://raw.githubusercontent.com/dmacias72/unRAID-cmdline/master/plugin/cmdline.plg
 

 

2. Paste url into install plugin text input and click install

 

If using SSL after enabling shellinabox server from the settings page, click on the green link to open a new tab or connect to the port you select for your server. i.e. https://tower:4200  Then add the security exception to your browser to accept the self-signed certificate.  After that you will be able to access the command line from the Tools menu.

 

By right clicking in the terminal you can access various settings. I added several style sheets for changing the terminal color. Your selection will be saved as a cookie. I'll add more on request or make your own and I'll add it.

 

Change Log:

###2018.02.18
- add support for built in letsencrypt certificates
- add support for command line button replacing built in terminal button
- remove runas user support
###2017.12.09
- fix reduce screenfetch cpu line to fit within 80 chars

###2017.10.12
- move to separate repo

- add workaround to start service

- update shellinabox package to latest 2.20
- fix: disable setting when running
###2017.05.21
- fix screenfetch not added to bash profile

###2017.02.05

- update some code to jquery

- add support link in readme

###2017.01.28

- update security for XSS and CSRF vulnerabilities

- strip down screenfetch for slackware/unRAID

- add unRAID version to screenshot

###2017.01.22

- update shellinabox unofficial to latest v2.20

- add: security patches

- fix: suppress var.ini parse error

###2016.10.22

- fix: ip connection for 6.2+

- add: tabs for terminal and settings

###2016.06.14

- add: dynamix plugin update api

- add: help content

###2016.03.24

- update shellinabox to unofficial 2.20

- fix: https when ssl is enabled

- remove linux-pam package

###2016.03.11

- add connect button on settings page

- add setting button on tools page

- rename plugin to cmdline since it is more than just shellinabox

- fix: conform screenfetch OS: to 80 columns (remove brackets)

- condense and restructure code

###2016.02.11

- fix: chmod error

- fix: shutdown not saving

###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

- remove install cert button for now

###2016.01.07a

- fix cert link

###2016.01.07

- add ip address connection option

- add install certificate button

- fix starting service with changed settings not saving

- 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

###2015.12.30

- remove old plugin directory on install

###2015.12.21

- move repo to unRAID-plugins

- change plugin name to shellinabox-plugin

- convert install and remove scripts

- add package md5 and unRAID version check

###2015.10.23

- fix "no version information" log errors

###2015.09.20

- update shellinabox packages to 2.19 (revision e30c33d)

- fix color styles

###2015.09.06

- use markdown syntax and parse_plugin_cfg

- change color styles

###2015.09.05

- fixed start event

- add more color styles

- fixed icon and image on black theme

###2015.09.04

- start and stop events

- update run as user

- update image

###2015.09.03

- initial commit

 

shellinabox_screenshot1.jpg

shellinabox_screenshot2.jpg

 

Edited by dmacias
  • Upvote 1
Link to comment

When you say "Click on the green link" for us semi-color blind people the link in question is inside the Plugin config itself with the line:

 

Enable Shellinabox Server 2.10 (revision 239) :

 

Hunted around wondering "Where is this green link?"

 

I was able to delete Mosh and use this, thanks again!

 

Can I request a Terminal Green on black stylesheet? NM: That's called Monochrome

Link to comment

 

 

When you say "Click on the green link" for us semi-color blind people the link in question is inside the Plugin config itself with the line:

 

Enable Shellinabox Server 2.10 (revision 239) :

 

Hunted around wondering "Where is this green link?"

 

I was able to delete Mosh and use this, thanks again!

 

Can I request a Terminal Green on black stylesheet? NM: That's called Monochrome

 

I know a more obvious link would be better. Glad you found the green.

Link to comment

Thanks for the new plugin!

For some reason the minus/underscore key on an US keyboard is not working, all the other keys are working OK.

I noticed that too. Does it work on the number pad? I believe it's a problem with Firefox and some browsers. I have been looking at a fork on github that should work. Since the original shellinabox development is dead.

 

Edit: The "+" key doesn't work also. I just doubled checked and it works under Firefox on the numberpad.  It works fine under chrome.  I'll try to see if I can compile the new fork under slackware which should fix this.

Link to comment

After a reboot I have to disable and re-enable on the setting page to get access to it again

Did it say it wasn't running on the settings page after reboot? I'll check it out, maybe I got the start event wrong.

 

Edit: Nevermind I used a start event from v5 that’s not in v6. fixed now.

Link to comment

Tip: you can include the file default.cfg in the 'shellinthebox' folder, which contains the default settings.

 

Use the command:

 

$shellinabox_cfg = parse_plugin_cfg("shellinabox");

 

This will ensure that all variables are loaded, either with their default value or the value stored on flash. It is recommended not to set default values in the PLG file itself anymore, furthermore it allows (if desired) to add a default button on the settings page, which can restore all settings to their default instantly.

 

Link to comment

Markdown syntax in v6.

 

V6 supports markdown syntax to create rich text and simplifies the overall text generation. The use of <table class="settings"> is discouraged.

 

To use markdwon in a form (e.g. when creating a settings page), do the following:

 

<form [color=red]markdown="1"[/color] name="shellinabox_settings" method="POST" action="/update.php" target="progressFrame">

 

This allows settings to be defined using name and field, as follows:

<form markdown="1" name="shellinabox_settings" method="POST" action="/update.php" target="progressFrame">
<input type="hidden" name="#file" value="<?=$shellinabox_cfgfile;?>" />
<input type="hidden" id="command" name="#command" value="" />

Enable Shellinabox Server <?=$shellinabox_version;?>:
: <select id="SERVICE" name="SERVICE" size="1" onChange="checkRUNNING(this.form);">
  <?=mk_option($shellinabox_service, "disable", "No");?>
  <?=mk_option($shellinabox_service, "enable", "Yes");?>
  </select>

Port:
: <input type="text" name="PORT" maxlength="40" value="<?=$shellinabox_port;?>" title="port must be 0-65535" placeholder="Default Port is 8000" >

Run as User:
: <select id="USERS" 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>
  <input type="hidden" name="RUNAS" style="width:222px" maxlength="40" value=<?=$shellinabox_runas;?> >

 
: <input type="submit" value="Apply" onClick="verifyDATA(this.form)"><input type="button" value="Done" onClick="done()">
</form>

 

Link to comment

Markdown syntax in v6.

 

V6 supports markdown syntax to create rich text and simplifies the overall text generation. The use of <table class="settings"> is discouraged.

 

To use markdwon in a form (e.g. when creating a settings page), do the following:

 

<form [color=red]markdown="1"[/color] name="shellinabox_settings" method="POST" action="/update.php" target="progressFrame">

 

This allows settings to be defined using name and field, as follows:

<form markdown="1" name="shellinabox_settings" method="POST" action="/update.php" target="progressFrame">
<input type="hidden" name="#file" value="<?=$shellinabox_cfgfile;?>" />
<input type="hidden" id="command" name="#command" value="" />

Enable Shellinabox Server <?=$shellinabox_version;?>:
: <select id="SERVICE" name="SERVICE" size="1" onChange="checkRUNNING(this.form);">
  <?=mk_option($shellinabox_service, "disable", "No");?>
  <?=mk_option($shellinabox_service, "enable", "Yes");?>
  </select>

Port:
: <input type="text" name="PORT" maxlength="40" value="<?=$shellinabox_port;?>" title="port must be 0-65535" placeholder="Default Port is 8000" >

Run as User:
: <select id="USERS" 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>
  <input type="hidden" name="RUNAS" style="width:222px" maxlength="40" value=<?=$shellinabox_runas;?> >

 
: <input type="submit" value="Apply" onClick="verifyDATA(this.form)"><input type="button" value="Done" onClick="done()">
</form>

Thanks. I never that understood that till now.

Link to comment

When I startup/reboot unRAID I am getting the following error message in the syslog

shellinaboxd: Failed to find any available port

 

If I go to Settings->Command Line I have to then disable/enable the ShellInABox server before I can use the option.  I have not changed any settings from the default.  Once I have done that it appears to work fine without further error messages.

 

Any thoughts?  Do you want the full diagnostics?

Link to comment

When I startup/reboot unRAID I am getting the following error message in the syslog

shellinaboxd: Failed to find any available port

 

If I go to Settings->Command Line I have to then disable/enable the ShellInABox server before I can use the option.  I have not changed any settings from the default.  Once I have done that it appears to work fine without further error messages.

 

Any thoughts?  Do you want the full diagnostics?

Did you update the plugin?  I initially used a start event "svcs_started" from v5 that's not in v6. Right now I'm using "started" event. Maybe I should use a different start event?

Link to comment

Just noticed an error listed on my console for the 'start' script.    Apparently on line 15 there is a 'return' statement that I think should actually be an exit' instead?

Yep. It's in the stop also. Thanks forgot those when I split up the rc script.

 

Did you get the port figured out?

Link to comment
  • 2 weeks later...

updated shellinabox to latest unofficial fork since original developement is dead. https://github.com/shellinabox/shellinabox

 

2015-03

 

Contributors: Luka Krajger, Philip Hughes, Daniel Gröber, Ezra Buehler, Anders Kaseorg, Jonathan Rennison, Guillaume Martres

 

- Swap to gzip compression (fixes #262 and #266).

 

- Set the encoding of .html files to UTF-8.

 

- Fix <input> element type.

 

- Issue #173: Keyboard icon on dark background.

 

- Another (final) fix for Firefox keycodes problems.

 

- Removed at sign (@) from beginning of some JS comments.

 

- Issues #51, #202 ... : Keycodes fixes for FireFox.

 

- Issue #195: A couple of bugs in vt100.jspp.

 

- Issue #103, #203: Child process termination (partial fix).

 

- Merge pull request #285 from KLuka/master.

 

- Issue #275: gracefully manage HTTP time-outs and connection problems.

 

- Set SSL options for increased security and disable compromised SSL

version 2.0 and 3.0.

 

- Issue #262: Page cannot be displayed.

 

- Issue #180: Ever growing console occurs in iPad.

 

- Issue #202: "-_" keys don't not work in FF > 15.

 

- No longer set HTTP Content-Length.

 

- Issue #245: Blank screen in Chrome 31.0.1650.57.

 

- Issue #114: popup warning on tab/window close.

 

- Issues 39, 43, 166 and 172 commits applied to .jspp files.

 

- Removed auto-generated .js files.

Link to comment

just updated plugin and now all "\" are being stripped:

 

root@Tower:~# \boot\scripts\vlog
-bash: bootscriptsvlog: command not found

 

even using the onscreen keyboard they are stripped

 

 

 

the "-" does work now btw......

 

Myk

                                                                                                                   

Link to comment

just updated plugin and now all "\" are being stripped:

 

root@Tower:~# \boot\scripts\vlog
-bash: bootscriptsvlog: command not found

 

even using the onscreen keyboard they are stripped

 

 

 

the "-" does work now btw......

 

Myk

                                                                                                                 

I'll check it out when I get home. It's useless on any android browser.

Link to comment

just updated plugin and now all "\" are being stripped:

 

root@Tower:~# \boot\scripts\vlog
-bash: bootscriptsvlog: command not found

 

even using the onscreen keyboard they are stripped

 

 

 

the "-" does work now btw......

 

Myk

                                                                                                                 

 

Right, same thing for me!

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.