]> andersk Git - test.git/blob - shellinabox/shellinaboxd.man.in
Updated manual page to show new SSH service.
[test.git] / shellinabox / shellinaboxd.man.in
1 '\" t
2 .\" shellinaboxd.man -- Make command line applications available as AJAX web applications
3 .\" Copyright (C) 2008-2009 Markus Gutschke <markus@shellinabox.com>
4 .\"
5 .\" This program is free software; you can redistribute it and/or modify
6 .\" it under the terms of the GNU General Public License version 2 as
7 .\" published by the Free Software Foundation.
8 .\"
9 .\" This program is distributed in the hope that it will be useful,
10 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
11 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 .\" GNU General Public License for more details.
13 .\"
14 .\" You should have received a copy of the GNU General Public License along
15 .\" with this program; if not, write to the Free Software Foundation, Inc.,
16 .\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 .\"
18 .\" In addition to these license terms, the author grants the following
19 .\" additional rights:
20 .\"
21 .\" If you modify this program, or any covered work, by linking or
22 .\" combining it with the OpenSSL project's OpenSSL library (or a
23 .\" modified version of that library), containing parts covered by the
24 .\" terms of the OpenSSL or SSLeay licenses, the author
25 .\" grants you additional permission to convey the resulting work.
26 .\" Corresponding Source for a non-source form of such a combination
27 .\" shall include the source code for the parts of OpenSSL used as well
28 .\" as that of the covered work.
29 .\"
30 .\" You may at your option choose to remove this additional permission from
31 .\" the work, or from any part of it.
32 .\"
33 .\" It is possible to build this program in a way that it loads OpenSSL
34 .\" libraries at run-time. If doing so, the following notices are required
35 .\" by the OpenSSL and SSLeay licenses:
36 .\"
37 .\" This product includes software developed by the OpenSSL Project
38 .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)
39 .\"
40 .\" This product includes cryptographic software written by Eric Young
41 .\" (eay@cryptsoft.com)
42 .\"
43 .\"
44 .\" The most up-to-date version of this program is always available from
45 .\" http://shellinabox.com
46 .\"
47 .TH SHELLINABOXD 1 "Dec 25, 2008"
48 .SH NAME
49 shellinaboxd \- publish command line shell through AJAX interface
50 .SH SYNOPSIS
51 .TP
52 .B shellinaboxd
53 [\ \fB-b\fP\ | \fB--background\fP[\fB=\fP\fIpidfile\fP]\ ]
54 #ifdef HAVE_OPENSSL
55 [\ \fB-c\fP\ | \fB--cert=\fP\fIcertdir\fP\ ]
56 #endif
57 [\ \fB--cert-fd=\fP\fIfd\fP\ ]
58 [\ \fB--cgi\fP[\fB=\fP\fIportrange\fP]\ ]
59 [\ \fB-d\fP\ | \fB--debug\fP\ ]
60 [\ \fB-f\fP\ | \fB--static-file=\fP\fIurl\fP:\fIfile\fP\ ]
61 [\ \fB-g\fP\ | \fB--group=\fP\fIgid\fP\ ]
62 [\ \fB-h\fP\ | \fB--help\fP\ ]
63 [\ \fB--linkify\fP=[\fBnone\fP|\fBnormal\fP|\fBaggressive\fP]\ ]
64 [\ \fB--localhost-only\fP\ ]
65 [\ \fB--no-beep\fP\ ]
66 [\ \fB-n\fP\ | \fB--numeric\fP\ ]
67 [\ \fB-p\fP\ | \fB--port=\fP\fIport\fP\ ]
68 [\ \fB-s\fP\ | \fB--service=\fP\fIservice\fP\ ]
69 #ifdef HAVE_OPENSSL
70 [\ \fB-t\fP\ | \fB--disable-ssl\fP\ ]
71 #endif
72 [\ \fB--disable-ssl-menu\fP\ ]
73 [\ \fB-q\fP\ | \fB--quiet\fP\ ]
74 [\ \fB-u\fP\ | \fB--user=\fP\fIuid\fP\ ]
75 [\ \fB-v\fP\ | \fB--verbose\fP\ ]
76 [\ \fB--version\fP\ ]
77 .SH DESCRIPTION
78 The
79 .B shellinaboxd
80 daemon implements a webserver that listens on the specified
81 .IR port .
82 The web server publishes one or more
83 .I services
84 that will be displayed in a VT100 emulator implemented as an AJAX web
85 application. By default, the port is 4200 and the default service URL is
86 .IR http://localhost:4200/ .
87 .P
88 If no particular
89 .I service
90 was requested, the server launches
91 .B /bin/login
92 querying the user for their username and password. It then starts the
93 user's default login shell.
94 .P
95 Any modern JavaScript and CSS enabled browser will be able to access the
96 published
97 .I service
98 without requiring additional plugins.
99 .SH OPTIONS
100 The following command line parameters control the operation of the daemon:
101 .TP \w'\-b\ |\ 'u
102 \fB-b\fP\ | \fB--background\fP[\fB=\fP\fIpidfile\fP]
103 Launch
104 .B shellinaboxd
105 as a background daemon process. Optionally, write the process id to
106 .IR pidfile .
107 #ifdef HAVE_OPENSSL
108 .TP
109 \fB-c\fP\ |\ \fB--cert=\fP\fIcertdir\fP
110 If built with SSL/TLS support enabled, the daemon will look in
111 .I certdir
112 for any certificates. If unspecified, this defaults to the current
113 working directory.
114
115 If the browser negotiated a
116 .B Server Name Identification
117 the daemon will look for a matching
118 .I certificate-\f[BI]SERVERNAME\fP.pem
119 file. This allows for virtual hosting of multiple server names on the
120 same IP address and port.
121
122 If no
123 .B SNI
124 handshake took place, it falls back on using the certificate in the
125 .I certificate.pem
126 file.
127
128 The administrator should make sure that there are matching
129 certificates for each of the virtual hosts on this server, and that
130 there is a generic
131 .I certificate.pem
132 file.
133
134 If no suitable certificate is installed,
135 .B shellinaboxd
136 will attempt to invoke
137 .B /usr/bin/openssl
138 and create a new self-signed certificate. This only succeeds if, after
139 dropping privileges,
140 .B shell\%ina\%boxd
141 has write permissions for
142 .IR certdir .
143
144 Most browsers show a warning message when encountering a self-signed
145 certificate and then allow the user the option of accepting the
146 certificate. Due to this usability problem, and due to the perceived
147 security implications, the use of auto-generated self-signed
148 certificates is intended for testing or in intranet deployments, only.
149 .TP
150 \fB--cert-fd=\fP\fIfd\fP
151 Instead of providing a
152 .B --cert
153 directory, it is also possible to provide a filedescriptor
154 .I fd
155 where the certificate and key can be retrieved. While this option disables
156 .B SNI
157 support, it does offer an alternative solution for securely providing
158 the private key data to the daemon.
159 #endif
160 .TP
161 \fB--cgi\fP[\fB=\fP\fIportrange\fP]
162 Instead of running
163 .B shellinaboxd
164 as a permanent process, it can be demand-loaded as a CGI web server
165 extension. When doing so, it will spawn a server that lives for the
166 duration of the user's session. If an optional
167 .I portrange
168 of the form
169 .BR MINPORT-MAXPORT
170 has been provided, the server limits itself to these port numbers. They
171 should be configured to pass through the firewall.
172
173 The
174 .B --cgi
175 option is mutually exclusive with the
176 .B --background
177 and
178 .B --port
179 options.
180
181 In order to be useful as a CGI script, the
182 .B shellinaboxd
183 binary probably will have to be made
184 .BR setuid-root .
185 This is currently a discouraged configuration. Use with care. 
186 .TP
187 \fB-d\fP\ |\ \fB--debug\fP
188 Enables debugging mode, resulting in lots of log messages on
189 .IR stderr .
190 This option is mutually exclusive with
191 .B --quiet
192 and
193 .BR --verbose .
194 .TP
195 \fB-f\fP\ |\ \fB--static-file=\fP\fIurl\fP:\fIfile\fP
196 The daemon serves various built-in resources from URLs underneath the
197 .I service
198 mount points. One or more
199 .B --static-file
200 options allow for overriding these resources with customized externally
201 provided
202 .IR files .
203 The
204 .I url
205 can either be an absolute or a relative path. In the former case, it overrides
206 exactly one built-in resource for one specific
207 .IR service ,
208 whereas in the latter case it overrides resources for each defined
209 .IR service .
210
211 The following resources are available for customization:
212 .RS
213 .TP \w'ShellInABox.js\ \ \ 'u
214 .B beep.wav
215 audio sample that gets played whenever the terminal BEL is sounded.
216 .TP
217 .B favicon.ico
218 favicon image file that is displayed in the browser's navigation bar.
219 .TP
220 .B ShellInABox.js
221 JavaScript file implementing the AJAX terminal emulator.
222 .TP
223 .B styles.css
224 CSS style file that controls the visual appearance of the terminal.
225 .P
226 It is not recommended to override the root HTML page for a particular
227 .IR service .
228 Instead, move the service to an anonymous URL and serve a
229 .I static-file
230 that references the
231 .I service
232 in an
233 .IR <iframe> .
234
235 Instead of a
236 .IR file ,
237 it is possible to provide the name of a directory. This turns
238 .B shellinaboxd
239 into a simple web server that publishes all of the files in that
240 particular directory. This option can be helpful when publishing a more
241 complex root HTML page.
242 .RE
243 .TP
244 \fB-g\fP\ |\ \fB--group=\fP\fIgid\fP
245 When started as
246 .BR root ,
247 the server drops most privileges at start up. Unless overridden by the
248 .B --group
249 option, it switches to
250 .BR nogroup .
251
252 When already running as an unprivileged user, group changes are not
253 possible.
254
255 If running with SSL/TLS support enabled, the certificates must be
256 accessible to the unprivileged user and/or group that the daemon
257 runs as.
258 .TP
259 \fB-h\fP\ |\ \fB--help\fP
260 Display a brief usage message showing the valid command line parameters.
261 .TP
262 \fB--linkify\fP=[\fBnone\fP|\fBnormal\fP|\fBaggressive\fP]
263 the daemon attempts to recognize URLs in the terminal output and makes them
264 clickable. This is not neccessarily a fool-proof process and both false
265 negatives and false positives are possible. By default, only URLs starting
266 with a well known protocol of
267 .BR http:// ,\  https:// ,\  ftp:// ,\ or\  mailto:
268 are recognized. In
269 .B aggressive
270 mode, anything that looks like a hostname, URL or e-mail address is
271 recognized, even if not preceded by a protocol.
272 .TP
273 \fB--localhost-only\fP
274 Normally, 
275 .B shellinaboxd
276 listens on all available network interfaces. When operating behind a
277 reverse-proxy that is not always desirable. This command line option
278 tells the daemon to only listen on the loopback interface.
279 .TP
280 \fB--no-beep\fP
281 not only are audible signals undesired in some working environments, but
282 browser support for media playback is often buggy, too. Setting this option
283 suppresses all audio playback and enables the visual bell by default.
284 .TP
285 \fB-n\fP\ |\ \fB--numeric\fP
286 When running in
287 .B --verbose
288 mode, the daemon prints an
289 .IR Apache -style
290 log file to
291 .IR stderr .
292 By default, host names of peers get resolved
293 before logging them. As DNS look-ups can be expensive, it is possible
294 to request logging of numeric IP addresses, instead.
295 .TP
296 \fB-p\fP\ |\ \fB--port=\fP\fIport\fP
297 Unless overridden by this option, the web server listens on port 4200
298 for incoming HTTP and HTTPS requests.
299
300 .B shellinaboxd
301 can distinguish between SSL/TLS requests and unencrypted requests. It
302 also knows how to negotiate
303 .B Server Name
304 .BR Identification ,
305 allowing the use of a single port for all types of requests even when
306 virtual hosting.
307 .TP
308 \fB-s\fP\ |\ \fB--service=\fP\fIservice\fP
309 One or more services can be registered on different URL paths:
310 .in +4
311 \fISERVICE\fP := <url-path> ':' \fIAPPLICATION\fP
312 .in
313
314 There is a pre-defined \fIapplication\fP, 'LOGIN', which causes the
315 daemon to invoke
316 .B /bin/login
317 requesting the user's name and password, and starting his
318 login shell. This is the default option for the
319 .B root
320 user, if no
321 .B --service
322 was defined. Starting
323 .B /bin/login
324 requires
325 .B root
326 privileges.
327
328 There is another pre-defined \fIapplication\fP, 'SSH'. Instead of invoking
329 .BR /bin/login ,
330 it calls
331 .BR ssh .
332 This is the default option for unprivileged users, if no
333 .B --service
334 was defined. This operation is available to both privileged and regular
335 users. If the optional \fIhost\fP parameter is omitted,
336 .B shellinaboxd
337 connects to
338 .BR localhost .
339
340 Alternatively, an \fIapplication\fP can be specified by providing a
341 \fIuser\fP description, a working directory, and a command line:
342 .in +4
343 \fIAPPLICATION\fP := 'LOGIN' | 'SSH' [ ':' <host> ] |  \fIUSER\fP ':' \fICWD\fP ':' <cmdline>
344
345 #ifdef HAVE_PAM
346 .in
347 The keyword 'AUTH' indicates that the \fIuser\fP information should
348 be requested interactively, instead of being provided as part of the
349 \fIservice\fP description:
350 .in +4
351 #endif
352 #ifdef HAVE_PAM
353 \fIUSER\fP := 'AUTH' |
354 #endif
355 #ifndef HAVE_PAM
356 \fIUSER\fP :=
357 #endif
358 <username> ':' <groupname>
359 .in
360
361 The working directory can either be given as an absolute path, or it
362 can be the user's home directory:
363 .in +4
364 \fICWD\fP := 'HOME' : <dir>
365 .in
366
367 The <cmdline> supports expansion of variables of the form ${VAR}.
368 Supported variables are:
369 .RS
370 .TP \w'${columns}\ \ 'u
371 .B ${columns}
372 number of columns.
373 .TP
374 .B ${gid}
375 numeric group id.
376 .TP
377 .B ${group}
378 group name.
379 .TP
380 .B ${home}
381 home directory.
382 .TP
383 .B ${lines}
384 number of rows.
385 .TP
386 .B ${peer}
387 name of remote peer.
388 .TP
389 .B ${uid}
390 numeric user id.
391 .TP
392 .B ${user}
393 user name.
394 .P
395 Other than the default environment variables of
396 .BR $TERM ,
397 .B $COLUMNS
398 and
399 .BR $LINES ,
400 services can have environment variables passed to them, by preceding
401 the <cmdline> with space separated variable assignments of the form
402 .IR KEY = VALUE .
403
404 The <cmdline> supports single and double quotes, as well as
405 backslashes for escaping characters in the familiar fashion.
406
407 Please note that when invoking
408 .B shellinaboxd
409 from a command line shell, additional quoting might be required to
410 prevent the shell from expanding the variables prior to passing them
411 to the daemon.
412
413 If no explicit
414 .B --service
415 has been requested,
416 .B shellinaboxd
417 defaults to attaching the default service to the root directory of the web
418 server. For
419 .BR root ,
420 this is
421 .BR /bin/login ,
422 and for unprivileged users, this is \fBssh localhost\fP. This is equivalent
423 to saying
424 .BR --service=/:LOGIN ,
425 or
426 .BR --service=/:SSH ,
427 respectively.
428 .RE
429 #ifdef HAVE_OPENSSL
430 .TP
431 \fB-t\fP\ |\ \fB--disable-ssl\fP
432 By default,
433 .B shellinaboxd
434 redirectes all incoming HTTP requests to their equivalent HTTPS
435 URLs. If promoting of connections to encrypted SSL/TLS sessions is
436 undesired, this behavior can be disabled.
437
438 This option is also useful during testing or for deployment in trusted
439 intranets, if SSL certificates are unavailable.
440 #endif
441 .TP
442 \fB--disable-ssl-menu\fP
443 If the user should not be able to switch between HTTP and HTTPS modes, this
444 choice can be removed from the context menu. The user can still make this
445 choice by directly going to the appropriate URL.
446 .TP
447 \fB-q\fP\ |\ \fB--quiet\fP
448 Surpresses all messages to
449 .IR stderr .
450 This option is mutually exclusive with
451 .B --debug
452 and
453 .BR --verbose .
454 .TP
455 \fB-u\fP\ |\ \fB--user=\fP\fIuid\fP
456 If started as
457 .BR root ,
458 the server drops privileges by changing to
459 .BR nobody ,
460 unless the
461 .I uid
462 has been overridden by this option.
463
464 For more details, refer to the description of the
465 .B --group
466 option.
467 .TP
468 \fB-v\fP\ |\ \fB--verbose\fP
469 Enables logging of
470 .IR Apache -style
471 log file to
472 .IR stderr .
473 This option is mutually exclusive with
474 .B --debug
475 and
476 .BR --quiet .
477 .TP
478 \fB--version\fP
479 Prints the version number of the binary and exits.
480 .SH CONFIGURATION
481 There are no configuration files or permanent settings for
482 .BR shell\%ina\%boxd .
483 A small number of run-time configuration options are available from a
484 context menu that becomes available when clicking the right mouse button.
485 .SH EXAMPLES
486 .TP \w'shellinaboxd\ 'u
487 .B shellinaboxd -t
488 Attaches a web-enabled login shell to
489 .I http://localhost:4200/
490 with SSL/TLS support disabled. This command must be run as
491 .B root
492 or the attempt to launch
493 .I /bin/login
494 will fail.
495 .TP
496 .B shellinaboxd -t -f beep.wav:/dev/null
497 Runs all services with the audible-bell permanently disabled.
498 .TP
499 .B shellinaboxd -t -s /:AUTH:HOME:/bin/bash
500 Interactively request the user's name and password prior to launching
501 a Bourne shell. This command can be run by unprivileged users. But if
502 doing so, it only allows this particular user to log in.
503 .TP
504 .B shellinaboxd -c certificates -u shellinabox -g shellinabox
505 If the
506 .B certificates
507 directory exists and is writable by the
508 .B shellinabox
509 user and group, self-signed SSL certificates will be generated in this
510 directory. This might require creating an appropriately named user first.
511 Running this command as
512 .B root
513 allows any user on the system to log in at
514 .BR http://localhost:4200/ .
515 Sessions will automatically be promoted to SSL/TLS.
516 .TP
517 .B shellinaboxd -t -s /:LOGIN -s /who:nobody:nogroup:/:w
518 In addition to the login shell at
519 .IR http://localhost:4200 ,
520 show a list of currently logged in users when accessing
521 .IR http://localhost:4200/who .
522 This command must be run as
523 .B root
524 in order to be able to change to
525 .B nobody:nogroup
526 as requested by the service description.
527 .TP
528 .B shellinaboxd -t -s '/:root:root:/:wy60 -c /bin/login'
529 Instead of the standard
530 .B ANSI/VT100
531 terminal, publish a
532 .B Wyse 60\*(Tm
533 terminal. Again, this command should be run as
534 .BR root .
535 .P
536 .SH DIAGNOSTICS
537 The daemon returns a non-zero exit code in case of failure. With the
538 exception of a small number of common error cases that are handled
539 explicitly, most errors result in printing a
540 .I \(dqCheck failed\(dq
541 message. This does not typically indicate a bug in the program but is
542 instead its normal way of reporting errors.
543
544 Common failure conditions are reusing a port that is already in use,
545 lack of sufficient privileges to run a service, failure to find
546 SSL/TLS certificates, and failure to write newly generated
547 certificates to the certification directory.
548 .SH "SEE ALSO"
549 .BR chmod (1),
550 .BR last (1),
551 .BR login (1),
552 .BR sh (1),
553 .BR shells (5),
554 .BR openssl (1SSL),
555 .BR w (1),
556 .BR wy60 (1),
557 .BR xterm (1).
558 .SH SECURITY
559 The daemon uses privilege separation techniques to allow it to drop
560 privileges early. It is aware of setuid flags and restricts some
561 operations when launched as a setuid application.
562
563 Despite these safety features, a bug could conceivably lead to a
564 determined attacker gaining elevated privileges. It is therefore
565 strongly discouraged to set the setuid flag on the binary.
566
567 The expected deployment would be from a system
568 .I rc
569 script launched by
570 .BR /sbin/init .
571 For extra security, the
572 .B --group
573 and
574 .B --user
575 options should be used to change to a dedicated user.
576 .SH AUTHOR
577 Copyright (C) 2008-2009 by Markus Gutschke
578 .RI < "markus@shellinabox.com" >.
579 .P
580 This program is free software; you can redistribute it and/or modify
581 it under the terms of the GNU General Public License version 2 as
582 published by the Free Software Foundation.
583 .P
584 This program is distributed in the hope that it will be useful,
585 but WITHOUT ANY WARRANTY; without even the implied warranty of
586 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
587 GNU General Public License for more details.
588 .P
589 You should have received a copy of the GNU General Public License
590 along with this program; if not, write to the Free Software
591 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
592 USA
593 .P
594 In addition to these license terms, the author grants the following
595 additional rights:
596 .P
597 If you modify this program, or any covered work, by linking or
598 combining it with the OpenSSL project's OpenSSL library (or a
599 modified version of that library), containing parts covered by the
600 terms of the OpenSSL or SSLeay licenses, the author
601 grants you additional permission to convey the resulting work.
602 Corresponding Source for a non-source form of such a combination
603 shall include the source code for the parts of OpenSSL used as well
604 as that of the covered work.
605 .P
606 You may at your option choose to remove this additional permission from
607 the work, or from any part of it.
608 .P
609 If you would like to negotiate different licensing terms that are
610 compatible for integration with other projects, please contact the
611 author.
612 #ifdef HAVE_OPENSSL
613 .P
614 If the OpenSSL
615 system libraries can be found at run-time, they will be invoked by
616 .B shellinaboxd
617 to provide SSL/TLS support. The OpenSSL and SSLeay
618 licenses require the following notices:
619 .P
620 This product includes software developed by the OpenSSL Project
621 for use in the OpenSSL Toolkit. (http://www.openssl.org/)
622 .P
623 This product includes cryptographic software written by Eric Young
624 (eay@cryptsoft.com)
625 #endif
626 .SH BUGS
627 Due to browser limitations, some features might not be available to
628 users of all browers.
629 .P
630 Konqueror does not allow for reliable interception of
631 .I CTRL
632 keys. If you press a key together with the
633 .I CTRL
634 modifier, it continues performing the browser's predefined behavior for
635 this particular key combination. In most cases, it also fails to report
636 the correct key to the terminal emulator. As a work-around, pressing
637 both the
638 .I CTRL
639 and the
640 .I WINDOWS
641 key sometimes works.
642 .P
643 Some browsers, most notably IE on Windows, disallow interception of
644 .I ALT
645 keys and always interpret these keys as menu accelerators. As a
646 work-around, many UNIX applications allow pressing
647 .IR ESC ,
648 instead of
649 .IR ALT .
650 .P
651 When using non-US keyboard layouts, some browser do not allow for
652 reliably determining shifted
653 .I ALT
654 keys. Please report these cases if they turn out to be a problem, as
655 work-arounds might be possible.
656 .P
657 Access to the native clipboard is typically not possible. Instead, an
658 internal clipboard accessible from the right-button context menu is used
659 for all but IE.
660 .P
661 Some browsers restrict the number of concurrent connections to a
662 server. This restricts how many AJAX terminals can be opened
663 simultaneously. If this becomes a problem, users can typically
664 reconfigure their browsers to raise the limit.
665 .P
666 There have been reports of the VLC plugin on Linux/x86_64 crashing Firefox
667 when the browser page gets reloaded. Setting the
668 .B --no-beep
669 option eliminates all references to VLC and thus appears to work around
670 this crash.
This page took 0.821199 seconds and 5 git commands to generate.