My favorites | Sign in
Project Logo
                
Search
for
Updated Dec 03, 2009 by zod...@gmail.com
shellinaboxd_man  
shellinaboxd - publish command line shell through AJAX interface

shellinaboxd

SYNOPSIS

 shellinaboxd  [ -b |    --background[=pidfile] ]    [ -c |    --cert=certdir ]
               [ --cert-fd=fd ] [ --css=filename ] [ --cgi[=portrange] ] [ -d |
               --debug ]  [ -f |  --static-file=url:file ] [ -g | --group=gid ] 
               [ -h |      --help ]      [ --linkify=[none|normal|aggressive] ] 
               [ --localhost-only ]  [ --no-beep ]  [ -n |  --numeric ]  [ -p |
               --port=port ] [ -s | --service=service ] [ -t |  --disable-ssl ] 
               [ --disable-ssl-menu ]   [ -q |  --quiet ]  [ -u |  --user=uid ] 
               [ --user-css=styles ] [ -v | --verbose ] [ --version ] 

DESCRIPTION

The shellinaboxd daemon implements a webserver that listens on the specified port. The web server publishes one or more services that will be displayed in a VT100 emulator implemented as an AJAX web application. By default, the port is 4200 and the default service URL is http://localhost:4200/.

If no particular service was requested, the server launches /bin/login querying the user for their username and password. It then starts the user's default login shell.

Any modern JavaScript and CSS enabled browser will be able to access the published service without requiring additional plugins.

OPTIONS

The following command line parameters control the operation of the daemon:

CONFIGURATION

There are no configuration files or permanent settings for shellinaboxd. A small number of run-time configuration options are available from a context menu that becomes available when clicking the right mouse button.

There are no configuration files or permanent settings for shellinaboxd.

A small number of run-time configuration options are available from a context menu that becomes available when clicking the right mouse button. These options get persisted in a browser cookie.

Many sites already have a web server running and would like to integrate shellinaboxd into their existing site. This is most commonly done by means of a reverse-proxy entry for the main web server. For Apache this would require adding an option such as:

  <Location /shell>
    ProxyPass  http://localhost:4200/
    Order      allow,deny
    Allow      from all
  </Location>

If you are using a different web server, refer to that server's documentation on how to configure reverse proxy operations.

When using a reverse proxy, the --localhost-only option would normally be enabled as well. In addition, the --disable-ssl might also be considered depending on the exact configuration details of the reverse proxy.

EXAMPLES

  • shellinaboxd
  • Attaches a web-enabled login shell to https://localhost:4200/. If the user connected without SSL, the session will automatically be promoted. Unless SSL certificates can be found in the current directory, the daemon will automatically generate suitable self-signed certificates. If the command was invoked by a non-root user, the daemon uses ssh instead of /bin/login for the session.
  • shellinaboxd -t
  • Attaches a web-enabled login shell to http://localhost:4200/ with SSL/TLS support disabled.
  • shellinaboxd -t -f beep.wav:/dev/null
  • Runs all services with the audible-bell permanently disabled.
  • shellinaboxd -s /:SSH:example.org
  • The terminal connects to a ssh session on example.org.
  • shellinaboxd -t -s /:AUTH:HOME:/bin/bash
  • Interactively request the user's name and password prior to launching a Bourne shell. This command can be run by unprivileged users. But if doing so, it only allows this particular user to log in.
  • shellinaboxd -c certificates -g shellinaboxd
  • If the certificates directory exists and is writable by the shellinaboxd group, self-signed SSL certificates will be generated in this directory. Running this command as root allows any user on the system to log in at http://localhost:4200/. Sessions will automatically be promoted to SSL/TLS.
  • shellinaboxd -t -s /:LOGIN -s /who:nobody:nogroup:/:w
  • In addition to the login shell at http://localhost:4200, show a list of currently logged in users when accessing http://localhost:4200/who. This command must be run as root in order to be able to change to nobody:nogroup as requested by the service description.
  • shellinaboxd -t -s '/:root:root:/:wy60 -c /bin/login'
  • Instead of the standard ANSI/VT100 terminal, publish a Wyse 60 terminal. Again, this command should be run as root.
  • shellinaboxd --css white-on-black.css
  • Loads the white-on-black.css style sheet from the current directory and appends it to the built-in styles.css sheet. This causes the terminal to always render white text on a black background.
  • shellinaboxd --user-css Normal:+black-on-white.css,Reverse:-white-on-black.css
  • Allow the user to select whether they want text to be rendered normally or in reverse video. This command line option adds a new entry to the right-click context menu.

DIAGNOSTICS

The daemon returns a non-zero exit code in case of failure. With the exception of a small number of common error cases that are handled explicitly, most errors result in printing a "Check failed" message. This does not typically indicate a bug in the program but is instead its normal way of reporting errors.

Common failure conditions are reusing a port that is already in use, lack of sufficient privileges to run a service, failure to find SSL/TLS certificates, and failure to write newly generated certificates to the certification directory.

"SEE ALSO"

chmod(1), last(1), login(1), sh(1), shells(5), openssl(1SSL), w(1), wy60(1), xterm(1).

SECURITY

The daemon uses privilege separation techniques to allow it to drop privileges early. It is aware of setuid flags and restricts some operations when launched as a setuid application.

Despite these safety features, a bug could conceivably lead to a determined attacker gaining elevated privileges. It is therefore strongly discouraged to set the setuid flag on the binary.

The expected deployment would be from a system rc script launched by /sbin/init. For extra security, the --group and --user options should be used to change to a dedicated user.

AUTHOR

Copyright (C) 2008-2009 by Markus Gutschke <markus@shellinabox.com>.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

In addition to these license terms, the author grants the following additional rights:

If you modify this program, or any covered work, by linking or combining it with the OpenSSL project's OpenSSL library (or a modified version of that library), containing parts covered by the terms of the OpenSSL or SSLeay licenses, the author grants you additional permission to convey the resulting work. Corresponding Source for a non-source form of such a combination shall include the source code for the parts of OpenSSL used as well as that of the covered work.

You may at your option choose to remove this additional permission from the work, or from any part of it.

If you would like to negotiate different licensing terms that are compatible for integration with other projects, please contact the author.

If the OpenSSL system libraries can be found at run-time, they will be invoked by shellinaboxd to provide SSL/TLS support. The OpenSSL and SSLeay licenses require the following notices:

This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)

This product includes cryptographic software written by Eric Young (eay@cryptsoft.com)

BUGS

Due to browser limitations, some features might not be available to users of all browers.


Comment by devraj, Apr 27, 2009

It would be nice to see an example for SSHing forward to another host using ShellInABox.

I can' seem to figure out the --service parameter.

Thanks.

Comment by mkende, May 20, 2009

Hi,

I am using UTF8 as the default encoding for my files. They show up correctly in the shellinabox, but I can't enter any accentuated character with my keyboard (azerty/french). Is it a bug, or is it that this feature is not implemented ?

In any case, thanks for your work. This is really a good piece of software.

Comment by zod...@gmail.com, May 21, 2009

Support for accepting keyboard input is one of the parts of JavaScript? that is very poorly supported by most browsers. It takes a lot of browser-specific code to be able to receive most keyboard input, but some keys or key combinations are still difficult or impossible to receive. International (i.e. non-US) keys and keyboards are often particularly poorly supported by the JavaScript? implementations in many browsers.

Having said all that, I would still like to try and find a solution for the problem that you are reporting. But you could help me a lot if you provided more details. Maybe, you could file a new "Issue" and include information on the browser that you are using (including version number), the operating system that is affected, and the exact keyboard configuration. If I can reproduce the problem locally, then I might be able to find a work-around that detects the particular configuration and figures out the correct keys.

Also, since I probably don't know how the AZERTY keyboard is supposed to behave, please give an exact description of which key(s) you press, what result you expect to see, and what ShellInABox does instead.

Comment by zod...@gmail.com, May 23, 2009

This is tracked as  Issue 13  which is now resolved.

Comment by cpmgdb, Jun 18, 2009

Firstly thank you very much for creating shellinabox.

I've compiled it to run on my Nokia N800 tablet (which is always switched on, unlike my PC, so better suited to remote access). However, the objcopy commands didn't work until I changed the output target. In Makefile.in, I changed: ' -O elf64-x86-64 -B i386:x86-64' to ' -O elf32-littlearm -B arm' Obviously this is not a proper fix, but it got it working for me. The available targets I have are: elf32-littlearm elf32-bigarm elf32-little elf32-big srec symbolsrec tekhex binary ihex - I started at the first option on the list, which seems to work, so I didn't try any more.

I also reverse-proxied shellinabox through Apache (with SSL + client certs + http auth). I modified the code to make shellinabox listen on the loopback adapter only (I didn't want other machines to be able to connect directly, only via Apache). In libhttp/server.c I changed serverAddr.sin_addr.s_addr = INADDR_ANY; to serverAddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); May I suggest making this as a command-line option?

Thank you.

Comment by zod...@gmail.com, Jun 21, 2009

Thank you for those suggestions. The SVN version now has both of these changes.

Comment by cpmgdb, Jun 22, 2009

I can confirm the latest version (svn131) successfully compiles for my N800 without making any changes to the Makefile. I've tried the --localhost-only switch and that works fine too.

Thanks very much!

Comment by zod...@gmail.com, Jul 30, 2009

In reply to "devraj"'s query. I added a SSH option to the list of predefined services and included an example in the manual page. This should make this common use case easier to configure.

Comment by markus.kremer, Oct 21, 2009

shellinabox is really a great tool. Would it be possible to run the spawned cgi process on a local socket and tunnel all communication through the cgi script? This will solve problems where people are behind a port-80/443-only proxy.

Comment by zod...@gmail.com, Oct 21, 2009

You can use the --localhost-only option to make the daemon listen on a local socket.

But there currently is no option to run the binary as a CGI that connects to this socket. It would be trivial to write a tiny script that does this, but you are probably better off to configure your web server or your (reverse-)proxy to connect to the local socket.

This is in fact that way that a lot of people are using ShellInABox.

Performance is not quite as good as when using a dedicated external socket, as most reverse proxies appear to not know about keeping connections open. But in practice that doesn't matter much for local connections from the proxy to the ShellInABox daemon.

Comment by maci...@pi.net.pl, Nov 04, 2009

shellinabox is really a great tools for me but non working with ssh

Comment by doobiest, Nov 12, 2009

Could anyone tell me if it's possible to have it auto-login to a bash prompt after passing either PHP/PERL authentication? It might sound insecure but its a risk I'm comfortable taking given the nature of what I'm doing, local intranet.

Alternatively can someone show me how to only allow this to run after passing php authentication? If a user's session isnt authenticated I dont even want them getting to this app.


Sign in to add a comment
Hosted by Google Code