Commit graph

70 commits

Author SHA1 Message Date
KLuka
6c9f98bf34 Logging and debuging
* Added prefixes to all log messages. Prefix should describe source of
  message, like "config", "http", "ssl", "server", etc... This should
  give users more info to figure out what went wrong or what is going
  on. Prefixes also make automatic processing easier.
* Usage is not displayed by default when given command line options are
  incorrect. This way it is easier to notice actual error.
2015-08-23 19:25:36 +02:00
KLuka
1f54ff5f71 Added prefix to SSL related debug messages 2015-08-06 18:11:32 +02:00
KLuka
eacb2fcb81 Disable secure client-initiated renegotiation
* In case that this SSL feature is abused it is possible to overload the
  server. Other web servers disable this feature by default, but users
  are able to change it with configuration. This is not possible with
  shellinabox as this feature is not needed.
* Solution was implemented similary as in Lighttpd web server.
2015-08-06 18:06:11 +02:00
KLuka
f0437832d3 Added support for Perfect Forward Secrecy (#331)
* Support for PFS is enabled with help of chiper suits that use ECDHE
  key exchange. OpenSSL added support for eliptic curve operations (EC)
  in version 0.9.8. Note that there are also some library distributions
  which don't support EC operations.
* Added precompiler guards for builds with OpenSSL older than 0.9.8 and
  builds with '--enable-runtime-loading' configure script option.
* Cleaned up some SSL related code.
2015-08-05 17:57:05 +02:00
KLuka
458cd7aa8f Minor improvments
* Added "reconnect" and "onsessionchange" message types to use with
  embedded terminal. Usage examples were added to misc/embedded.html
  file.
* Improved code for unix domain socket functionality.
2015-07-09 21:51:43 +02:00
KLuka
bdca920abc Another update for unix domain sockets support
* Changed initialization of variables and handling of unix socket path.
* Added fixes for command line argument parsing, that I forgot in previous
  commit.
2015-07-07 10:48:14 +02:00
KLuka
c6186530bb Minor fixes for unix domain sockets
* Improved user input checking and error handling for code from #320.
* Added some guards for unlinking socket file in server init and destroy
  functions.
* Added peer name handling for AF_UNIX type connections in HTTP handling
  code.
2015-07-06 22:02:54 +02:00
Witold Filipczyk
4d8ec30100 Unix domain sockets support.
The socket is not removed on shutdown, but the rest seems to work.
2015-07-01 13:06:04 +02:00
KLuka
b3309b23d8 Fixes for some defects found by Coverity
* Added more checks for return values and null pointers.
* Removed some dead code and unused variables.
* Fixed handling of calls to exec() family functions. If this functions
  fail we need to cleanup resources.
2015-05-31 13:04:00 +02:00
KLuka
6402688084 Improved code session and URL handling
* URL dependency was removed from session handling code. URL object
  was only needed to get session key from client request. This was
  moved somewhere else to achive better code reusability.
* Added URL parsing functionality that can be used without URL object.
2015-05-26 22:37:32 +02:00
KLuka
883b7aa7f0 Real IP recognition over proxy (partial fix #54)
* Recogniton of HTTP header field 'X-Real-IP' was added. Value
  is used in LOGIN service with peer name as remote host identifier.
  This was we are able to see real IP in login related log files
  such as /var/log/auth.log, etc...
* Real IP, peer name and URL are also passed to launched  service
  as environment variables (SHELLINABOX_PEERNAME, SHELLINABOX_REALIP
  and SHELLINABOX_URL). This can be used by custom user service shell
  scripts or programs.
* Real IP can also be passed to custom user service as command line
  parameter ${realip}.
2015-05-17 20:05:15 +02:00
tickelton
228dd0c69c fix build with --disable-ssl
Commit b06b1f15ac broke the configure option
"--disable-ssl" as the function sslMakeContext() was not enclosed in an
"#if defined(HAVE_OPENSSL)" statement.
2015-05-02 16:12:33 +02:00
KLuka
62871a605d Issue #186: Does not build on OpenBSD
* Added stdint.h include for uintptr_t compilation error
2015-03-17 13:32:05 +01:00
Ezra Buehler
284d90ccc4 Remove trailing whitespace 2015-03-11 17:56:36 +01:00
Philip Hughes
939068c533 Swap to gzip compression (fixes #262 and #266)
Instead of making the browser sniffing more complicated, it's probably
better to use code that works for all current browsers. As such, this
swaps to use gzip compression encoding instead of deflate and drops the
IE browser sniffing code. This means shellinabox works in IE11 and
should work in every version of IE since IE7. From this commit, IE6 is
no longer supported. Thanks @lfourquaux.
2015-03-10 10:21:20 +00:00
Jonathan G Rennison
490781d998 Add dynamic linking for functions required by SSL v2/3 disabling patch. 2015-03-05 18:02:09 +01:00
Anders Kaseorg
b06b1f15ac Set SSL options for increased security
Disable SSLv2, SSLv3, and compression; generate new DH or ECDH keys
during each handshake; always start a new session on server
renegotiation; set a strong cipher list.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

[ Patch from https://code.google.com/p/shellinabox/issues/detail?id=215 ]
2015-03-05 18:00:16 +01:00
KLuka
4f0b949081 IE 11 - This page can’t be displayed (Issue #262)
Now we are able to identify IE11 as MSIE browser and disable
compresion.

Patch taken from issue comments.

https://code.google.com/p/shellinabox/issues/detail?id=262
2015-03-05 17:26:47 +01:00
Marc Singer
9619327ddb Debian build now defaults to direct link with shared libraries.
o Use of runtime linkage emperils correctness of package.  So, runtime
  linking disabled in configuration.
o Workaround using environment variables to pass the names of the
  shared libraries into the daemon is disabled.
o Auxiliary source file used to determine the current soname for
  libssl is removed.
2012-04-10 15:28:53 -07:00
Marc Singer
7ecd468128 Revision to dependencies.
o Moved libssl from a dependency to being recommended.
o Added small program to support Recommended link generation.
o Fixed typo in lsb-base dependency.
o Added comment in the package description about the need for libssl.
o Fixed permissions on libhttp/ssl.c
o Added environment variables for specifying the ssl and crypto
  libraries.
2012-04-07 16:09:38 -07:00
Jay Weisskopf
9cff326327 Use 2048-bit RSA keys for auto-generated certificates.
Security researchers have recommended moving away from 1024-bit
keys for a few years now.
2012-03-30 13:12:22 -07:00
Jay Weisskopf
85c3a03aec Assume a private key is RSA if the header does not specify a type.
Auto-generated certificates are RSA, but the header does not indicate
this (e.g. BEGIN PRIVATE KEY). Since the type is not specified,
the certificate was not being parsed correctly, and attempts to
connect over HTTPS failed and caused web browser errors.

Fixes "ERR_SSL_VERSION_OR_CIPHER_MISMATCH" in Chrome.
Fixes "ssl_error_no_cypher_overlap" in Firefox.
2012-03-30 13:12:22 -07:00
Anders Kaseorg
e20a7d2536 sslGenerateCertificate: Don't use the shell
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2012-03-30 13:12:22 -07:00
Anders Kaseorg
3115eb4995 sslSNICallback: Properly disallow invalid characters
Completely discard hostnames containing invalid characters, instead of
merely replacing the invalid characters with uninitialized memory.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2012-03-30 13:12:22 -07:00
Jay Weisskopf
8630c134a8 Check for null pointers from gethostbyname_r() to prevent seg faults. 2012-03-30 13:12:21 -07:00
zodiac@gmail.com
1867125c3b Second try :-)
git-svn-id: https://shellinabox.googlecode.com/svn/trunk@239 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2010-10-02 23:54:49 +00:00
zodiac@gmail.com
1a33fc8127 The server could sometimes end up listening for events even though it
was not really interested in them. This could result in inefficient I/O
behavior and most noticably it broke the ability to interrupt long running
output with CTRL-C.


git-svn-id: https://shellinabox.googlecode.com/svn/trunk@238 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2010-10-02 23:40:24 +00:00
zodiac@gmail.com
2c2389fe30 Some more research on the web suggests the Apple ships their operating
systems with an implementation of poll() that isn't completely POSIX
compliant. We now fall back on calling select() instead. That's not our
first choice, but it is presumably the best that MacOS X can do.


git-svn-id: https://shellinabox.googlecode.com/svn/trunk@236 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2010-10-02 01:54:29 +00:00
zodiac@gmail.com
301823036a Some changes to improve compatibility with MacOS X.
git-svn-id: https://shellinabox.googlecode.com/svn/trunk@231 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2010-09-29 06:28:58 +00:00
zodiac@gmail.com
13d0448fc6 Fix a pointer aliasing violation by explicitly breaking aliasing with a
call to memcpy().


git-svn-id: https://shellinabox.googlecode.com/svn/trunk@220 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2010-09-03 19:17:11 +00:00
zodiac@gmail.com
e8c241583d Fixed a check() failure that was caused by incorrect handling of partially
processed buffers. I believe, this could only be triggered by clients that
enabled HTTP pipelining. That might explain why we haven't seen bug reports
any earlier.


git-svn-id: https://shellinabox.googlecode.com/svn/trunk@216 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2010-08-27 22:22:15 +00:00
zodiac@gmail.com
d1df9b6441 Fixed a NULL pointer dereference that can occur when hostnames
do not resolve. Thanks to <vmagerya> for pointing out this problem.


git-svn-id: https://shellinabox.googlecode.com/svn/trunk@206 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2010-07-02 19:00:33 +00:00
zodiac@gmail.com
9b0a937e35 Started working on support for WebSockets.
Fixed some compiler warnings when compiling with -Wextra

Thanks to Jan Jaeger's excellent bug report, made some changes
that should make it easier to build ShellInABox for OpenWRT.


git-svn-id: https://shellinabox.googlecode.com/svn/trunk@202 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2010-03-29 16:40:17 +00:00
zodiac@gmail.com
e17458375d Removed compiler warning when building without SSL support.
git-svn-id: https://shellinabox.googlecode.com/svn/trunk@187 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-11-22 03:05:09 +00:00
zodiac@gmail.com
fe5a28f992 Some minor tweaks to make newer versions of gcc and glibc compile without warnings.
git-svn-id: https://shellinabox.googlecode.com/svn/trunk@181 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-11-18 17:17:56 +00:00
zodiac
15e91a32f7 Internet Explorer still doesn't properly support CSS. In particular, it has
problems dealing with "inherit" styles. This prevented proper switching
between color and monochrome.

Implemented a work-around.


git-svn-id: https://shellinabox.googlecode.com/svn/trunk@172 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-08-16 05:20:09 +00:00
zodiac
161e848e23 Simplify the code that compresses HTTP replies. This also gives us the ability
to manipulate headers more easily. We now add "Connection: close" in more cases
where we force a closing of the connection.


git-svn-id: https://shellinabox.googlecode.com/svn/trunk@171 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-08-15 22:55:02 +00:00
zodiac
71ba8641c1 Fixed support for Swedish keyboards
Some more tweaks for IE6 support. Overall, IE6 is still pretty
broken. Not sure if we can do much about this.


git-svn-id: https://shellinabox.googlecode.com/svn/trunk@166 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-08-11 18:37:12 +00:00
zodiac
13263e1737 Make 'update' warn about merge conflicts
git-svn-id: https://shellinabox.googlecode.com/svn/trunk@147 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-07-08 20:11:40 +00:00
zodiac
8920606f6f Optionally compress large responses, if the browser accepts deflate compression. This mainly improves start up time.
git-svn-id: https://shellinabox.googlecode.com/svn/trunk@142 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-07-08 08:33:36 +00:00
zodiac
ca18a5346f Run-time testing for availability of libpthread functions does not
work reliably on some platforms. So, avoid doing so on anything other
than Linux/i386. For all other platforms, assume that the code is not
linked against libpthread. For ShellInABox, this is always the correct
assumption. But if the code gets embedded into other projects, this
might have to be changed.


git-svn-id: https://shellinabox.googlecode.com/svn/trunk@141 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-07-07 00:40:51 +00:00
zodiac
bb4dbaa5f5 Making it easier to host the terminal on non-root URLs by always redirecting to a URL that includes a trailing slash.
git-svn-id: https://shellinabox.googlecode.com/svn/trunk@140 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-07-06 16:27:11 +00:00
zodiac
cedb046244 Fixed a null pointer dereference that could be triggered by using non-standard
service definitions.


git-svn-id: https://shellinabox.googlecode.com/svn/trunk@136 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-07-04 08:46:28 +00:00
zodiac@gmail.com
5ec8c4c19b Added new "--localhost-only" command line option.
git-svn-id: https://shellinabox.googlecode.com/svn/trunk@125 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-06-21 19:55:20 +00:00
zodiac@gmail.com
2c090c8beb Respect "Connection: close" if sent by the browser.
git-svn-id: https://shellinabox.googlecode.com/svn/trunk@123 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-06-21 18:51:14 +00:00
zodiac@gmail.com
db631d5e35 Added SSL support for OpenBSD
git-svn-id: https://shellinabox.googlecode.com/svn/trunk@122 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-05-25 06:03:26 +00:00
zodiac
41fd8f3ea5 Fixed various issues with building on OpenBSD
git-svn-id: https://shellinabox.googlecode.com/svn/trunk@119 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-05-21 07:50:22 +00:00
zodiac
3bacdb002b - Make the code actually do, what the comments say (i.e. skip PAM account
management, if we don't have the privileges to do so, anyway)
- Make ssl.h compile again, even if OpenSSL is not found at compile time.


git-svn-id: https://shellinabox.googlecode.com/svn/trunk@115 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-04-16 20:54:08 +00:00
zodiac
0258d46926 - Add support for commands that want to read before they write anything.
- A couple of changes to avoid false error messages in valgrind.
- Fixed a bug that could potentially lead to a double-free()


git-svn-id: https://shellinabox.googlecode.com/svn/trunk@114 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-04-16 05:33:05 +00:00
zodiac
3e0241dde3 Added initial revision of demo application
git-svn-id: https://shellinabox.googlecode.com/svn/trunk@93 0da03de8-d603-11dd-86c2-0f8696b7b6f9
2009-03-30 08:41:48 +00:00