Compare commits
No commits in common. "master" and "v2.19" have entirely different histories.
0
.gitignore
vendored
Executable file → Normal file
0
AUTHORS
Executable file → Normal file
0
CHANGELOG.md
Executable file → Normal file
0
COPYING
Executable file → Normal file
0
GPL-2
Executable file → Normal file
2
INSTALL.Debian
Executable file → Normal file
|
@ -41,7 +41,7 @@ you point your browser to the site.
|
||||||
|
|
||||||
At the very least, you need a file called "certificate.pem" that includes
|
At the very least, you need a file called "certificate.pem" that includes
|
||||||
both the private key and the public certificate in PEM (i.e. ASCII) format.
|
both the private key and the public certificate in PEM (i.e. ASCII) format.
|
||||||
Additionally, you should create files for each of the publicly visible
|
Additionally, you should create files for each of the publically visible
|
||||||
hostnames that your machine has. These are named "certificate-${FQDN}.pem".
|
hostnames that your machine has. These are named "certificate-${FQDN}.pem".
|
||||||
You probably also want "certificate-localhost.pem".
|
You probably also want "certificate-localhost.pem".
|
||||||
|
|
||||||
|
|
9
Makefile.am
Executable file → Normal file
|
@ -242,8 +242,7 @@ shellinaboxd.1: ${top_srcdir}/shellinabox/shellinaboxd.man.in \
|
||||||
|
|
||||||
clean-local: clean-demo
|
clean-local: clean-demo
|
||||||
-rm -rf shellinaboxd.1 \
|
-rm -rf shellinaboxd.1 \
|
||||||
shellinaboxd.ps \
|
shellinaboxd.ps
|
||||||
shellinaboxd.pdf
|
|
||||||
-rm -rf debian/shellinabox \
|
-rm -rf debian/shellinabox \
|
||||||
debian/shellinabox*.debhelper* \
|
debian/shellinabox*.debhelper* \
|
||||||
debian/shellinabox.substvars \
|
debian/shellinabox.substvars \
|
||||||
|
@ -365,9 +364,3 @@ clean-demo:
|
||||||
"(int)sizeof($${sym}Start);"; \
|
"(int)sizeof($${sym}Start);"; \
|
||||||
} >"$@"
|
} >"$@"
|
||||||
|
|
||||||
shellinaboxd.ps: shellinaboxd.1
|
|
||||||
groff -man -T ps $^ >$@
|
|
||||||
|
|
||||||
shellinaboxd.pdf: shellinaboxd.ps
|
|
||||||
ps2pdf $^ $@
|
|
||||||
|
|
||||||
|
|
0
NEWS
Executable file → Normal file
0
README
Executable file → Normal file
0
README.Fedora
Executable file → Normal file
57
README.md
Executable file → Normal file
|
@ -6,16 +6,16 @@ shellinabox
|
||||||
[](https://gitter.im/shellinabox/shellinabox?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
[](https://gitter.im/shellinabox/shellinabox?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
|
||||||
|
|
||||||
This is an unofficial fork of the project **Shell In A Box**. The fork was created because
|
This is unofficial fork of project **Shell In A Box**. Fork was created because
|
||||||
the original project was not maintained anymore and we cannot contact the original
|
original project is not maintained anymore and we cannot contact original
|
||||||
repository owners.
|
repository owners.
|
||||||
|
|
||||||
Our aim is to continue with maintenance of the shellinabox project. For a list of
|
Our aim is to continue with maintanince of shellinabox project. For list of
|
||||||
recent changes, please see [CHANGELOG.md](/CHANGELOG.md).
|
recent changes please see [CHANGELOG.md](/CHANGELOG.md).
|
||||||
|
|
||||||
If you have any questions, issues, or patches, please feel free to submit a pull
|
If you have any questions, issues or patches, please fell free to submit pull
|
||||||
request or report an issue. You can also drop an email to the original project
|
request or report an issue. You can also drop an email to original project
|
||||||
[issue #261](https://code.google.com/p/shellinabox/issues/detail?id=261) discussion
|
[issue #261](https://code.google.com/p/shellinabox/issues/detail?id=261) discusion
|
||||||
from where this fork started.
|
from where this fork started.
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,17 +42,34 @@ Build
|
||||||
For building **shellinabox** from source on Debian or RHEL based systems use commands
|
For building **shellinabox** from source on Debian or RHEL based systems use commands
|
||||||
listed below. This will create executable file `shellinaboxd` in project directory.
|
listed below. This will create executable file `shellinaboxd` in project directory.
|
||||||
|
|
||||||
1. Clone the autotools
|
1. Install dependencies
|
||||||
|
|
||||||
```
|
```
|
||||||
wget https://raw.githubusercontent.com/simono41/shellinabox/master/auto.sh
|
apt-get install git libssl-dev libpam0g-dev zlib1g-dev dh-autoreconf
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Run autotools
|
or
|
||||||
|
|
||||||
```
|
```
|
||||||
chmod +x auto.sh
|
yum install git openssl-devel pam-devel zlib-devel autoconf automake libtool
|
||||||
./auto.sh
|
```
|
||||||
|
|
||||||
|
2. Clone source files and move to project directory
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/shellinabox/shellinabox.git && cd shellinabox
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Run autotools in project directory
|
||||||
|
|
||||||
|
```
|
||||||
|
autoreconf -i
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Run configure and make in project directory
|
||||||
|
|
||||||
|
```
|
||||||
|
./configure && make
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Debian package
|
#### Debian package
|
||||||
|
@ -86,19 +103,5 @@ created from our sources. In new issue report please include following things:
|
||||||
* Version of shellinabox
|
* Version of shellinabox
|
||||||
* Steps to reproduce the problem
|
* Steps to reproduce the problem
|
||||||
|
|
||||||
Also feel free to post any questions or comments in [shellinabox chat room](https://gitter.im/shellinabox/shellinabox)
|
Also feel free to post any questions or comments in [shellianbox chat room](https://gitter.im/shellinabox/shellinabox)
|
||||||
on Gitter.
|
on Gitter.
|
||||||
|
|
||||||
|
|
||||||
Known Issues
|
|
||||||
------------
|
|
||||||
|
|
||||||
* The openssl package is required for HTTP/SSL support.
|
|
||||||
Shell-in-a-box may be used without SSL such that the login session
|
|
||||||
is not encrypted. To enable automatic creation of self-signed
|
|
||||||
certificates or to use a generated certificate, install openssl.
|
|
||||||
|
|
||||||
* On Debian Jessie, the default openssl package does not include the
|
|
||||||
utilities necessary for Shell-in-a-box to generate self-signed
|
|
||||||
certificates. Upgrade openssl to install a version of the tools
|
|
||||||
that support certificate creation.
|
|
||||||
|
|
0
TODO
Executable file → Normal file
56
auto.sh
|
@ -1,56 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
if [[ $EUID -ne 0 ]]; then
|
|
||||||
echo "This script must be run as root" 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Als root Angemeldet"
|
|
||||||
|
|
||||||
if [ -f /usr/bin/apt ]; then
|
|
||||||
apt update
|
|
||||||
|
|
||||||
apt install git libssl-dev libpam0g-dev zlib1g-dev dh-autoreconf
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f /usr/bin/pacman ]; then
|
|
||||||
pacman -Sy git openssl autoconf automake make gcc
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd /opt/
|
|
||||||
|
|
||||||
git clone https://github.com/simono41/shellinabox.git
|
|
||||||
|
|
||||||
cd shellinabox
|
|
||||||
|
|
||||||
autoreconf -i
|
|
||||||
|
|
||||||
./configure && make
|
|
||||||
|
|
||||||
cp shellinabox.service /etc/systemd/system/
|
|
||||||
|
|
||||||
systemctl daemon-reload
|
|
||||||
|
|
||||||
systemctl enable shellinabox.service
|
|
||||||
|
|
||||||
# adduser
|
|
||||||
|
|
||||||
echo adduser webssh
|
|
||||||
|
|
||||||
useradd webssh
|
|
||||||
|
|
||||||
mkdir /home/webssh
|
|
||||||
|
|
||||||
cp shellinabox_sshwrapper.sh /home/webssh/
|
|
||||||
|
|
||||||
chmod 770 -R /home/webssh/
|
|
||||||
|
|
||||||
chown -cR webssh:webssh /home/webssh/
|
|
||||||
|
|
||||||
passwd webssh <<EOT
|
|
||||||
webssh
|
|
||||||
webssh
|
|
||||||
EOT
|
|
||||||
|
|
||||||
systemctl start shellinabox.service &
|
|
35
configure.ac
Executable file → Normal file
|
@ -2,7 +2,7 @@ AC_PREREQ(2.57)
|
||||||
|
|
||||||
dnl This is one of the locations where the authoritative version
|
dnl This is one of the locations where the authoritative version
|
||||||
dnl number is stored. The other is in the debian/changelog.
|
dnl number is stored. The other is in the debian/changelog.
|
||||||
AC_INIT(shellinabox, 2.20, markus@shellinabox.com)
|
AC_INIT(shellinabox, 2.19, markus@shellinabox.com)
|
||||||
if test -e .git; then
|
if test -e .git; then
|
||||||
VCS_REVISION=" (revision `cd $srcdir && git log -1 --format=format:%h`)"
|
VCS_REVISION=" (revision `cd $srcdir && git log -1 --format=format:%h`)"
|
||||||
else
|
else
|
||||||
|
@ -32,7 +32,7 @@ AC_SUBST(AR_FLAGS, [cr])
|
||||||
|
|
||||||
dnl Check for header files that do not exist on all platforms
|
dnl Check for header files that do not exist on all platforms
|
||||||
AC_CHECK_HEADERS([libutil.h pthread.h pty.h strings.h syslog.h sys/prctl.h \
|
AC_CHECK_HEADERS([libutil.h pthread.h pty.h strings.h syslog.h sys/prctl.h \
|
||||||
sys/uio.h util.h])
|
sys/uio.h util.h utmp.h utmpx.h])
|
||||||
|
|
||||||
dnl Most systems require linking against libutil.so in order to get login_tty()
|
dnl Most systems require linking against libutil.so in order to get login_tty()
|
||||||
AC_CHECK_FUNCS(login_tty, [],
|
AC_CHECK_FUNCS(login_tty, [],
|
||||||
|
@ -75,6 +75,15 @@ AC_TRY_LINK([#include <math.h>],
|
||||||
[AC_DEFINE(HAVE_ISNAN, 1,
|
[AC_DEFINE(HAVE_ISNAN, 1,
|
||||||
Define to 1 if you have support for isnan)])
|
Define to 1 if you have support for isnan)])
|
||||||
|
|
||||||
|
dnl Even if utmpx.h exists, not all systems have support for updwtmpx()
|
||||||
|
AC_TRY_LINK([#include <utmp.h>],
|
||||||
|
[updwtmp(0, 0);],
|
||||||
|
[AC_DEFINE(HAVE_UPDWTMP, 1,
|
||||||
|
Define to 1 if you have support for updwtmp)])
|
||||||
|
AC_TRY_LINK([#include <utmpx.h>],
|
||||||
|
[updwtmpx(0, 0);],
|
||||||
|
[AC_DEFINE(HAVE_UPDWTMPX, 1,
|
||||||
|
Define to 1 if you have support for updwtmpx)])
|
||||||
|
|
||||||
dnl Check if the compiler supports aliasing of symbols
|
dnl Check if the compiler supports aliasing of symbols
|
||||||
AC_TRY_LINK([void x(void) { };
|
AC_TRY_LINK([void x(void) { };
|
||||||
|
@ -138,28 +147,6 @@ AC_ARG_ENABLE(runtime-loading,
|
||||||
these libraries into the binary, thus making them a
|
these libraries into the binary, thus making them a
|
||||||
hard dependency, then disable runtime-loading.])
|
hard dependency, then disable runtime-loading.])
|
||||||
|
|
||||||
dnl This is feature is not suported in some standard C libs. So users can use
|
|
||||||
dnl this switch to avoid compile and runtime problems. Note that utmp must
|
|
||||||
dnl disabled on systems with musl libc.
|
|
||||||
AC_ARG_ENABLE(utmp,
|
|
||||||
[ --disable-utmp Disable support for login records. Note
|
|
||||||
that for systems with musl libc utmp must
|
|
||||||
be disabled.])
|
|
||||||
|
|
||||||
if test "x$enable_utmp" != xno; then
|
|
||||||
AC_CHECK_HEADERS([utmp.h utmpx.h])
|
|
||||||
|
|
||||||
dnl Even if utmpx.h exists, not all systems have support for updwtmpx()
|
|
||||||
AC_TRY_LINK([#include <utmp.h>],
|
|
||||||
[updwtmp(0, 0);],
|
|
||||||
[AC_DEFINE(HAVE_UPDWTMP, 1,
|
|
||||||
Define to 1 if you have support for updwtmp)])
|
|
||||||
AC_TRY_LINK([#include <utmpx.h>],
|
|
||||||
[updwtmpx(0, 0);],
|
|
||||||
[AC_DEFINE(HAVE_UPDWTMPX, 1,
|
|
||||||
Define to 1 if you have support for updwtmpx)])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Only test for OpenSSL headers, if not explicitly disabled
|
dnl Only test for OpenSSL headers, if not explicitly disabled
|
||||||
if test "x$enable_ssl" != xno; then
|
if test "x$enable_ssl" != xno; then
|
||||||
AC_CHECK_HEADERS([openssl/bio.h openssl/err.h openssl/ssl.h])
|
AC_CHECK_HEADERS([openssl/bio.h openssl/err.h openssl/ssl.h])
|
||||||
|
|
0
contrib/README-siab.rb
Executable file → Normal file
0
contrib/siab.rb
Executable file → Normal file
0
debian/README.available
vendored
Executable file → Normal file
0
debian/README.enabled
vendored
Executable file → Normal file
0
debian/README.source
vendored
Executable file → Normal file
24
debian/changelog
vendored
Executable file → Normal file
|
@ -1,31 +1,9 @@
|
||||||
shellinabox (2.20) unstable; urgency=medium
|
|
||||||
|
|
||||||
* Fixed issue #222, LOGIN service
|
|
||||||
* Fixed issue #360, ignore escape sequences to fix dir listing
|
|
||||||
* Fix for function key presses
|
|
||||||
* Adjusting scale on IE
|
|
||||||
* New option to disable peer check (#364)
|
|
||||||
* Add option for custom SSH port
|
|
||||||
* Support for APL characters
|
|
||||||
* PDF documentation
|
|
||||||
* Fix for BSD build
|
|
||||||
* New ready event support
|
|
||||||
* OpenSSL 1.1 fixes (Closes: #828542)
|
|
||||||
* May build with MUSL library
|
|
||||||
* Documentation added that SSL support is optional and requires
|
|
||||||
installation of openssl on Debian. (Closes: #839067)
|
|
||||||
* Jessie requires explicit installation of openssl because the default
|
|
||||||
package does not include the necessary utilities to support creation
|
|
||||||
of certificates. (Closes: #839066)
|
|
||||||
|
|
||||||
-- Marc Singer <elf@debian.org> Wed, 09 Nov 2016 09:52:24 -0800
|
|
||||||
|
|
||||||
shellinabox (2.19) unstable; urgency=high
|
shellinabox (2.19) unstable; urgency=high
|
||||||
|
|
||||||
* Added support for middle-click paste, #350.
|
* Added support for middle-click paste, #350.
|
||||||
* Improved iOS support, #354.
|
* Improved iOS support, #354.
|
||||||
* New logic to enable soft keyboard icon, #119, #321, #354.
|
* New logic to enable soft keyboard icon, #119, #321, #354.
|
||||||
* Disable HTTP fallback using the URL /plain. Consequently disables
|
* Disable HTTPS fallback using the URL /plain. Consequently disables
|
||||||
automatic upgrades from HTTP to HTTPS, #355. (CVE-2015-8400).
|
automatic upgrades from HTTP to HTTPS, #355. (CVE-2015-8400).
|
||||||
|
|
||||||
-- Marc Singer <elf@debian.org> Sat, 05 Dec 2015 10:24:12 -0800
|
-- Marc Singer <elf@debian.org> Sat, 05 Dec 2015 10:24:12 -0800
|
||||||
|
|
0
debian/compat
vendored
Executable file → Normal file
6
debian/control
vendored
Executable file → Normal file
|
@ -16,7 +16,5 @@ Suggests: openssl
|
||||||
Description: publish command line shell through AJAX interface
|
Description: publish command line shell through AJAX interface
|
||||||
Shellinabox can export arbitrary command line programs to any JavaScript
|
Shellinabox can export arbitrary command line programs to any JavaScript
|
||||||
enabled web browser. By default, it prompts for username and password
|
enabled web browser. By default, it prompts for username and password
|
||||||
and then exports a login shell. Shellinabox provides a VT100
|
and then exports a SSL/TLS encrypted login shell. Shellinabox provides
|
||||||
compatible terminal emulator that runs within any modern
|
a VT100 compatible terminal emulator that runs within any modern browser.
|
||||||
browser. Support for HTTPS protocol (SSL/TLS encryption) is optional
|
|
||||||
and requires installation of openssl.
|
|
||||||
|
|
0
debian/copyright
vendored
Executable file → Normal file
0
debian/docs
vendored
Executable file → Normal file
0
debian/shellinabox.default
vendored
Executable file → Normal file
0
debian/shellinabox.dirs
vendored
Executable file → Normal file
0
debian/shellinabox.examples
vendored
Executable file → Normal file
0
debian/shellinabox.lintian-overrides
vendored
Executable file → Normal file
0
debian/shellinabox.preinst
vendored
Executable file → Normal file
0
debian/shellinabox.prerm
vendored
Executable file → Normal file
0
debian/source/format
vendored
Executable file → Normal file
0
debian/source/include-binaries
vendored
Executable file → Normal file
0
debian/source/options
vendored
Executable file → Normal file
0
demo/demo.html
Executable file → Normal file
0
demo/demo.jspp
Executable file → Normal file
0
demo/demo.xml
Executable file → Normal file
0
demo/keyboard.html
Executable file → Normal file
0
etc-pam.d-shellinabox-example
Executable file → Normal file
0
libhttp/hashmap.c
Executable file → Normal file
0
libhttp/hashmap.h
Executable file → Normal file
0
libhttp/http.h
Executable file → Normal file
2
libhttp/httpconnection.c
Executable file → Normal file
|
@ -430,7 +430,7 @@ void destroyHttpConnection(struct HttpConnection *http) {
|
||||||
http->peerName ? http->peerName : "???", http->peerPort);
|
http->peerName ? http->peerName : "???", http->peerPort);
|
||||||
}
|
}
|
||||||
httpShutdown(http, http->closed ? SHUT_WR : SHUT_RDWR);
|
httpShutdown(http, http->closed ? SHUT_WR : SHUT_RDWR);
|
||||||
dcheck(!close(http->fd) || errno != EBADF);
|
dcheck(!close(http->fd));
|
||||||
free(http->peerName);
|
free(http->peerName);
|
||||||
free(http->url);
|
free(http->url);
|
||||||
free(http->method);
|
free(http->method);
|
||||||
|
|
0
libhttp/httpconnection.h
Executable file → Normal file
0
libhttp/libhttp.sym
Executable file → Normal file
0
libhttp/server.c
Executable file → Normal file
0
libhttp/server.h
Executable file → Normal file
39
libhttp/ssl.c
Executable file → Normal file
|
@ -100,7 +100,6 @@ BIO_METHOD * (*BIO_f_buffer)(void);
|
||||||
void (*BIO_free_all)(BIO *);
|
void (*BIO_free_all)(BIO *);
|
||||||
BIO * (*BIO_new)(BIO_METHOD *);
|
BIO * (*BIO_new)(BIO_METHOD *);
|
||||||
BIO * (*BIO_new_socket)(int, int);
|
BIO * (*BIO_new_socket)(int, int);
|
||||||
BIO * (*BIO_next)(BIO *);
|
|
||||||
BIO * (*BIO_pop)(BIO *);
|
BIO * (*BIO_pop)(BIO *);
|
||||||
BIO * (*BIO_push)(BIO *, BIO *);
|
BIO * (*BIO_push)(BIO *, BIO *);
|
||||||
#if defined(HAVE_OPENSSL_EC)
|
#if defined(HAVE_OPENSSL_EC)
|
||||||
|
@ -281,7 +280,6 @@ static void loadSSL(void) {
|
||||||
{ { &BIO_free_all }, "BIO_free_all" },
|
{ { &BIO_free_all }, "BIO_free_all" },
|
||||||
{ { &BIO_new }, "BIO_new" },
|
{ { &BIO_new }, "BIO_new" },
|
||||||
{ { &BIO_new_socket }, "BIO_new_socket" },
|
{ { &BIO_new_socket }, "BIO_new_socket" },
|
||||||
{ { &BIO_next }, "BIO_next" },
|
|
||||||
{ { &BIO_pop }, "BIO_pop" },
|
{ { &BIO_pop }, "BIO_pop" },
|
||||||
{ { &BIO_push }, "BIO_push" },
|
{ { &BIO_push }, "BIO_push" },
|
||||||
{ { &ERR_clear_error }, "ERR_clear_error" },
|
{ { &ERR_clear_error }, "ERR_clear_error" },
|
||||||
|
@ -1015,14 +1013,6 @@ int sslPromoteToSSL(struct SSLSupport *ssl, SSL **sslHndl, int fd,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
BIO *sslGetNextBIO(BIO *b) {
|
|
||||||
#if OPENSSL_VERSION_NUMBER <= 0x10100000L
|
|
||||||
return b->next_bio;
|
|
||||||
#else
|
|
||||||
return BIO_next(b);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void sslFreeHndl(SSL **sslHndl) {
|
void sslFreeHndl(SSL **sslHndl) {
|
||||||
#if defined(HAVE_OPENSSL)
|
#if defined(HAVE_OPENSSL)
|
||||||
if (*sslHndl) {
|
if (*sslHndl) {
|
||||||
|
@ -1030,23 +1020,24 @@ void sslFreeHndl(SSL **sslHndl) {
|
||||||
// BIOs. This is particularly a problem if an SSL connection has two
|
// BIOs. This is particularly a problem if an SSL connection has two
|
||||||
// different BIOs for the read and the write end, with one being a stacked
|
// different BIOs for the read and the write end, with one being a stacked
|
||||||
// derivative of the other. Unfortunately, this is exactly the scenario
|
// derivative of the other. Unfortunately, this is exactly the scenario
|
||||||
// that we set up with call to "BIO_push(readBIO, writeBIO)" in function
|
// that we set up.
|
||||||
// "sslPromoteToSSL()".
|
|
||||||
// As a work-around, we un-stack the BIOs prior to freeing the SSL
|
// As a work-around, we un-stack the BIOs prior to freeing the SSL
|
||||||
// connection.
|
// connection.
|
||||||
debug("[ssl] Freeing SSL handle.");
|
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
BIO *writeBIO, *readBIO;
|
BIO *writeBIO, *readBIO;
|
||||||
check(writeBIO = SSL_get_wbio(*sslHndl));
|
check(writeBIO = SSL_get_wbio(*sslHndl));
|
||||||
check(readBIO = SSL_get_rbio(*sslHndl));
|
check(readBIO = SSL_get_rbio(*sslHndl));
|
||||||
if (writeBIO != readBIO) {
|
if (writeBIO != readBIO) {
|
||||||
if (sslGetNextBIO(readBIO) == writeBIO) {
|
if (readBIO->next_bio == writeBIO) {
|
||||||
// OK, that's exactly the bug we are looking for. We know that
|
// OK, that's exactly the bug we are looking for. We know how to
|
||||||
// writeBIO needs to be removed from readBIO chain.
|
// fix it.
|
||||||
debug("[ssl] Removing stacked write BIO!");
|
|
||||||
check(BIO_pop(readBIO) == writeBIO);
|
check(BIO_pop(readBIO) == writeBIO);
|
||||||
check(!sslGetNextBIO(readBIO));
|
check(readBIO->references == 1);
|
||||||
} else if (sslGetNextBIO(readBIO) == sslGetNextBIO(writeBIO)) {
|
check(writeBIO->references == 1);
|
||||||
|
check(!readBIO->next_bio);
|
||||||
|
check(!writeBIO->prev_bio);
|
||||||
|
} else if (readBIO->next_bio == writeBIO->next_bio &&
|
||||||
|
writeBIO->next_bio->prev_bio == writeBIO) {
|
||||||
// Things get even more confused, if the SSL handshake is aborted
|
// Things get even more confused, if the SSL handshake is aborted
|
||||||
// prematurely.
|
// prematurely.
|
||||||
// OpenSSL appears to internally stack a BIO onto the read end that
|
// OpenSSL appears to internally stack a BIO onto the read end that
|
||||||
|
@ -1055,13 +1046,15 @@ void sslFreeHndl(SSL **sslHndl) {
|
||||||
// reading and one for writing). In this case, not only is the
|
// reading and one for writing). In this case, not only is the
|
||||||
// reference count wrong, but the chain of next_bio/prev_bio pairs
|
// reference count wrong, but the chain of next_bio/prev_bio pairs
|
||||||
// is corrupted, too.
|
// is corrupted, too.
|
||||||
warn("[ssl] Removing stacked socket BIO!");
|
|
||||||
BIO *sockBIO;
|
BIO *sockBIO;
|
||||||
check(sockBIO = BIO_pop(readBIO));
|
check(sockBIO = BIO_pop(readBIO));
|
||||||
check(sockBIO == BIO_pop(writeBIO));
|
check(sockBIO == BIO_pop(writeBIO));
|
||||||
check(!sslGetNextBIO(readBIO));
|
check(readBIO->references == 1);
|
||||||
check(!sslGetNextBIO(writeBIO));
|
check(writeBIO->references == 1);
|
||||||
check(!sslGetNextBIO(sockBIO));
|
check(sockBIO->references == 1);
|
||||||
|
check(!readBIO->next_bio);
|
||||||
|
check(!writeBIO->next_bio);
|
||||||
|
check(!sockBIO->prev_bio);
|
||||||
BIO_free_all(sockBIO);
|
BIO_free_all(sockBIO);
|
||||||
} else {
|
} else {
|
||||||
// We do not know, how to fix this situation. Something must have
|
// We do not know, how to fix this situation. Something must have
|
||||||
|
|
2
libhttp/ssl.h
Executable file → Normal file
|
@ -82,7 +82,6 @@ extern BIO_METHOD *(*x_BIO_f_buffer)(void);
|
||||||
extern void (*x_BIO_free_all)(BIO *);
|
extern void (*x_BIO_free_all)(BIO *);
|
||||||
extern BIO *(*x_BIO_new)(BIO_METHOD *);
|
extern BIO *(*x_BIO_new)(BIO_METHOD *);
|
||||||
extern BIO *(*x_BIO_new_socket)(int, int);
|
extern BIO *(*x_BIO_new_socket)(int, int);
|
||||||
extern BIO *(*x_BIO_next)(BIO *);
|
|
||||||
extern BIO *(*x_BIO_pop)(BIO *);
|
extern BIO *(*x_BIO_pop)(BIO *);
|
||||||
extern BIO *(*x_BIO_push)(BIO *, BIO *);
|
extern BIO *(*x_BIO_push)(BIO *, BIO *);
|
||||||
#if defined(HAVE_OPENSSL_EC)
|
#if defined(HAVE_OPENSSL_EC)
|
||||||
|
@ -132,7 +131,6 @@ extern void *(*x_SSL_COMP_get_compression_methods)(void);
|
||||||
#define BIO_free_all x_BIO_free_all
|
#define BIO_free_all x_BIO_free_all
|
||||||
#define BIO_new x_BIO_new
|
#define BIO_new x_BIO_new
|
||||||
#define BIO_new_socket x_BIO_new_socket
|
#define BIO_new_socket x_BIO_new_socket
|
||||||
#define BIO_next x_BIO_next
|
|
||||||
#define BIO_pop x_BIO_pop
|
#define BIO_pop x_BIO_pop
|
||||||
#define BIO_push x_BIO_push
|
#define BIO_push x_BIO_push
|
||||||
#define EC_KEY_free x_EC_KEY_free
|
#define EC_KEY_free x_EC_KEY_free
|
||||||
|
|
0
libhttp/trie.c
Executable file → Normal file
0
libhttp/trie.h
Executable file → Normal file
0
libhttp/url.c
Executable file → Normal file
0
libhttp/url.h
Executable file → Normal file
12
logging/logging.c
Executable file → Normal file
|
@ -100,11 +100,7 @@ void error(const char *fmt, ...) {
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
debugMsg(MSG_ERROR, fmt, ap);
|
debugMsg(MSG_ERROR, fmt, ap);
|
||||||
#ifdef HAVE_SYSLOG_H
|
#ifdef HAVE_SYSLOG_H
|
||||||
va_list apSyslog;
|
vsyslog(LOG_ERR, fmt, ap);
|
||||||
va_copy(apSyslog, ap);
|
|
||||||
va_start(apSyslog, fmt);
|
|
||||||
vsyslog(LOG_ERR, fmt, apSyslog);
|
|
||||||
va_end(apSyslog);
|
|
||||||
#endif
|
#endif
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
@ -121,11 +117,7 @@ void fatal(const char *fmt, ...) {
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
debugMsg(MSG_QUIET, fmt, ap);
|
debugMsg(MSG_QUIET, fmt, ap);
|
||||||
#ifdef HAVE_SYSLOG_H
|
#ifdef HAVE_SYSLOG_H
|
||||||
va_list apSyslog;
|
vsyslog(LOG_CRIT, fmt, ap);
|
||||||
va_copy(apSyslog, ap);
|
|
||||||
va_start(apSyslog, fmt);
|
|
||||||
vsyslog(LOG_CRIT, fmt, apSyslog);
|
|
||||||
va_end(apSyslog);
|
|
||||||
syslog(LOG_CRIT, "[server] Aborting...");
|
syslog(LOG_CRIT, "[server] Aborting...");
|
||||||
#endif
|
#endif
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
0
logging/logging.h
Executable file → Normal file
0
m4/.gitignore
vendored
Executable file → Normal file
23
misc/embedded.html
Executable file → Normal file
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
For communication with Shell In A Box we need to set '-m' (messages-origin)
|
For communication with Shell In A Box we need to set '-m' (messages-origin)
|
||||||
command line option with appropriate messages origin. Origin should be set to
|
command line option with appropriate messages origin. Origin should be set to
|
||||||
URL of parent (this) window. If origin is set to '*' Shell In A Box won't check
|
URL of parent (this) window. If origin is set to '*' Shell In A Box won't checki
|
||||||
origin on received messages. This is usually unsafe option.
|
origin on received messages. This is usually unsafe option.
|
||||||
|
|
||||||
Command line example:
|
Command line example:
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
# Client Side
|
# Client Side
|
||||||
#
|
#
|
||||||
|
|
||||||
Shell In A Box accepts messages formatted as JSON strings with 'type' and 'data'
|
Shell In A Box accepts messages formated as JSON strings with 'type' and 'data'
|
||||||
fields. Messages with same format can be passed back to parent (this) window.
|
fields. Messages with same format can be passed back to parent (this) window.
|
||||||
|
|
||||||
Message example:
|
Message example:
|
||||||
|
@ -59,9 +59,6 @@
|
||||||
|
|
||||||
Following types of messages can be received from shellinabox:
|
Following types of messages can be received from shellinabox:
|
||||||
|
|
||||||
* ready
|
|
||||||
signals that shellinabox is ready to send and receive messages
|
|
||||||
|
|
||||||
* output
|
* output
|
||||||
data field contains terminal output
|
data field contains terminal output
|
||||||
|
|
||||||
|
@ -143,6 +140,10 @@
|
||||||
var output = document.getElementById("output");
|
var output = document.getElementById("output");
|
||||||
var session = document.getElementById("session");
|
var session = document.getElementById("session");
|
||||||
|
|
||||||
|
// Add url to our iframe. We do this, only that variable 'url' can be used
|
||||||
|
// throughout the whole code where needed.
|
||||||
|
iframe.src = url;
|
||||||
|
|
||||||
document.getElementById("execute").addEventListener("click", function() {
|
document.getElementById("execute").addEventListener("click", function() {
|
||||||
// Send input to shellinabox
|
// Send input to shellinabox
|
||||||
var message = JSON.stringify({
|
var message = JSON.stringify({
|
||||||
|
@ -208,15 +209,6 @@
|
||||||
// Handle response according to response type
|
// Handle response according to response type
|
||||||
var decoded = JSON.parse(message.data);
|
var decoded = JSON.parse(message.data);
|
||||||
switch (decoded.type) {
|
switch (decoded.type) {
|
||||||
case "ready":
|
|
||||||
// Shellinabox is ready to communicate and we will enable console output
|
|
||||||
// by default.
|
|
||||||
var message = JSON.stringify({
|
|
||||||
type : 'output',
|
|
||||||
data : 'enable'
|
|
||||||
});
|
|
||||||
iframe.contentWindow.postMessage(message, url);
|
|
||||||
break;
|
|
||||||
case "output" :
|
case "output" :
|
||||||
// Append new output
|
// Append new output
|
||||||
output.innerHTML = output.innerHTML + decoded.data;
|
output.innerHTML = output.innerHTML + decoded.data;
|
||||||
|
@ -228,9 +220,6 @@
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
// Add url to our iframe after the event listener is installed.
|
|
||||||
iframe.src = url;
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
0
misc/preview.gif
Executable file → Normal file
Before Width: | Height: | Size: 930 KiB After Width: | Height: | Size: 930 KiB |
0
misc/preview.png
Executable file → Normal file
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 79 KiB |
22
sgit
|
@ -1,22 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
if [[ "--help" == "${1}" ]]; then
|
|
||||||
echo "bash ./sgit user.email commit"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "${2}" ]]; then
|
|
||||||
echo "Bitte email und commit angeben!!!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
git config --global user.email "${1}"
|
|
||||||
git config --global user.name "${1}"
|
|
||||||
git status
|
|
||||||
git pull
|
|
||||||
git add --all
|
|
||||||
git commit --all -m "${2}"
|
|
||||||
git show
|
|
||||||
git push
|
|
||||||
git status
|
|
|
@ -1,9 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=shellinabox
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/opt/shellinabox/shellinaboxd -t --service=/:webssh:webssh:HOME:'/home/webssh/shellinabox_sshwrapper.sh'
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
0
shellinabox/beep.wav
Executable file → Normal file
0
shellinabox/black-on-white.css
Executable file → Normal file
0
shellinabox/cgi_root.html
Executable file → Normal file
0
shellinabox/color.css
Executable file → Normal file
0
shellinabox/enabled.gif
Executable file → Normal file
Before Width: | Height: | Size: 847 B After Width: | Height: | Size: 847 B |
0
shellinabox/externalfile.c
Executable file → Normal file
0
shellinabox/externalfile.h
Executable file → Normal file
0
shellinabox/favicon.ico
Executable file → Normal file
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
0
shellinabox/keyboard-layout.html
Executable file → Normal file
0
shellinabox/keyboard.png
Executable file → Normal file
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
1
shellinabox/launcher.c
Executable file → Normal file
|
@ -63,7 +63,6 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/ttydefaults.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
|
|
0
shellinabox/launcher.h
Executable file → Normal file
0
shellinabox/monochrome.css
Executable file → Normal file
0
shellinabox/print-styles.css
Executable file → Normal file
0
shellinabox/privileges.c
Executable file → Normal file
0
shellinabox/privileges.h
Executable file → Normal file
0
shellinabox/root_page.html
Executable file → Normal file
41
shellinabox/service.c
Executable file → Normal file
|
@ -121,29 +121,18 @@ void initService(struct Service *service, const char *arg) {
|
||||||
service->group = NULL;
|
service->group = NULL;
|
||||||
check(service->cwd = strdup("/"));
|
check(service->cwd = strdup("/"));
|
||||||
char *host;
|
char *host;
|
||||||
char *sshPort;
|
|
||||||
check(host = strdup("localhost"));
|
check(host = strdup("localhost"));
|
||||||
check(sshPort = strdup("22"));
|
|
||||||
|
|
||||||
if ((ptr = strchr(arg, ':')) != NULL) {
|
if ((ptr = strchr(arg, ':')) != NULL) {
|
||||||
ptr = ptr + 1;
|
check(ptr = strdup(ptr + 1));
|
||||||
if (*ptr) {
|
char *end;
|
||||||
char *tmp = strchr(ptr, ':');
|
if ((end = strchr(ptr, ':')) != NULL) {
|
||||||
if (tmp == NULL) {
|
*end = '\000';
|
||||||
// If the second ":" is not found, keep as host whatever is after first ":".
|
|
||||||
free(host);
|
|
||||||
check(host = strdup(ptr));
|
|
||||||
} else {
|
|
||||||
// If we find a second ":", keep as a host whatever is in between first ":"
|
|
||||||
// and second ":" and as sshPort whatever is after second ":".
|
|
||||||
int size = (tmp - ptr + 1);
|
|
||||||
free(host);
|
|
||||||
free(sshPort);
|
|
||||||
check(host = malloc(size));
|
|
||||||
memset(host, 0, size);
|
|
||||||
memcpy(host, ptr, size - 1);
|
|
||||||
check(sshPort = strdup(tmp + 1));
|
|
||||||
}
|
}
|
||||||
|
if (*ptr) {
|
||||||
|
free(host);
|
||||||
|
host = ptr;
|
||||||
|
} else {
|
||||||
|
free(ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,15 +148,6 @@ void initService(struct Service *service, const char *arg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't allow manipulation of the SSH command line through "creative" use
|
|
||||||
// of the port.
|
|
||||||
for (char *h = sshPort; *h; h++) {
|
|
||||||
char ch = *h;
|
|
||||||
if (!(ch >= '0' && ch <= '9')) {
|
|
||||||
fatal("[config] Invalid port \"%s\" in service definition!", sshPort);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
service->cmdline = stringPrintf(NULL,
|
service->cmdline = stringPrintf(NULL,
|
||||||
"ssh -a -e none -i /dev/null -x -oChallengeResponseAuthentication=no "
|
"ssh -a -e none -i /dev/null -x -oChallengeResponseAuthentication=no "
|
||||||
"-oCheckHostIP=no -oClearAllForwardings=yes -oCompression=no "
|
"-oCheckHostIP=no -oClearAllForwardings=yes -oCompression=no "
|
||||||
|
@ -182,9 +162,8 @@ void initService(struct Service *service, const char *arg) {
|
||||||
// feature, we cannot be sure that it is available on the
|
// feature, we cannot be sure that it is available on the
|
||||||
// target server. Removing it for the sake of Centos.
|
// target server. Removing it for the sake of Centos.
|
||||||
// "-oVisualHostKey=no"
|
// "-oVisualHostKey=no"
|
||||||
" -oLogLevel=FATAL -p%s %%s@%s",sshPort, host);
|
" -oLogLevel=FATAL %%s@%s", host);
|
||||||
free(host);
|
free(host);
|
||||||
free(sshPort);
|
|
||||||
} else {
|
} else {
|
||||||
service->useLogin = 0;
|
service->useLogin = 0;
|
||||||
|
|
||||||
|
|
0
shellinabox/service.h
Executable file → Normal file
2
shellinabox/session.c
Executable file → Normal file
|
@ -116,11 +116,9 @@ void initSession(struct Session *session, const char *sessionKey,
|
||||||
session->http = NULL;
|
session->http = NULL;
|
||||||
session->done = 0;
|
session->done = 0;
|
||||||
session->pty = -1;
|
session->pty = -1;
|
||||||
session->ptyFirstRead = 1;
|
|
||||||
session->width = 0;
|
session->width = 0;
|
||||||
session->height = 0;
|
session->height = 0;
|
||||||
session->buffered = NULL;
|
session->buffered = NULL;
|
||||||
session->useLogin = 0;
|
|
||||||
session->len = 0;
|
session->len = 0;
|
||||||
session->pid = 0;
|
session->pid = 0;
|
||||||
session->cleanup = 0;
|
session->cleanup = 0;
|
||||||
|
|
2
shellinabox/session.h
Executable file → Normal file
|
@ -58,11 +58,9 @@ struct Session {
|
||||||
HttpConnection *http;
|
HttpConnection *http;
|
||||||
int done;
|
int done;
|
||||||
int pty;
|
int pty;
|
||||||
int ptyFirstRead;
|
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
char *buffered;
|
char *buffered;
|
||||||
int useLogin;
|
|
||||||
int len;
|
int len;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int cleanup;
|
int cleanup;
|
||||||
|
|
3
shellinabox/shell_in_a_box.jspp
Executable file → Normal file
|
@ -406,9 +406,6 @@ ShellInABox.prototype.messageInit = function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// After message mechanisms are in place "ready" message is sent to parent
|
|
||||||
// window.
|
|
||||||
parent.postMessage(JSON.stringify({type : 'ready', data : ''}), '*');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ShellInABox.prototype.messageReceive = function (message) {
|
ShellInABox.prototype.messageReceive = function (message) {
|
||||||
|
|
42
shellinabox/shellinaboxd.c
Executable file → Normal file
|
@ -63,7 +63,7 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#include <time.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef HAVE_SYS_PRCTL_H
|
#ifdef HAVE_SYS_PRCTL_H
|
||||||
|
@ -110,7 +110,6 @@ static int portMax;
|
||||||
static int localhostOnly = 0;
|
static int localhostOnly = 0;
|
||||||
static int noBeep = 0;
|
static int noBeep = 0;
|
||||||
static int numericHosts = 0;
|
static int numericHosts = 0;
|
||||||
static int peerCheckEnabled = 1;
|
|
||||||
static int enableSSL = 1;
|
static int enableSSL = 1;
|
||||||
static int enableSSLMenu = 1;
|
static int enableSSLMenu = 1;
|
||||||
static int forceSSL = 1; // TODO enable http fallback with commandline option
|
static int forceSSL = 1; // TODO enable http fallback with commandline option
|
||||||
|
@ -292,13 +291,6 @@ static void sessionDone(void *arg) {
|
||||||
completePendingRequest(session, "", 0, INT_MAX);
|
completePendingRequest(session, "", 0, INT_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void delaySession(void) {
|
|
||||||
struct timespec ts;
|
|
||||||
ts.tv_sec = 0;
|
|
||||||
ts.tv_nsec = 200 * 1000; // Delay for 0.2 ms
|
|
||||||
nanosleep(&ts, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int handleSession(struct ServerConnection *connection, void *arg,
|
static int handleSession(struct ServerConnection *connection, void *arg,
|
||||||
short *events, short revents) {
|
short *events, short revents) {
|
||||||
struct Session *session = (struct Session *)arg;
|
struct Session *session = (struct Session *)arg;
|
||||||
|
@ -318,7 +310,7 @@ static int handleSession(struct ServerConnection *connection, void *arg,
|
||||||
int timedOut = serverGetTimeout(connection) < 0;
|
int timedOut = serverGetTimeout(connection) < 0;
|
||||||
if (bytes || timedOut) {
|
if (bytes || timedOut) {
|
||||||
if (!session->http && timedOut) {
|
if (!session->http && timedOut) {
|
||||||
debug("[server] Timeout. Closing session %s!", session->sessionKey);
|
debug("[server] Timeout. Closing session!");
|
||||||
session->cleanup = 1;
|
session->cleanup = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -332,26 +324,8 @@ static int handleSession(struct ServerConnection *connection, void *arg,
|
||||||
*events = 0;
|
*events = 0;
|
||||||
}
|
}
|
||||||
serverSetTimeout(connection, AJAX_TIMEOUT);
|
serverSetTimeout(connection, AJAX_TIMEOUT);
|
||||||
session->ptyFirstRead = 0;
|
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
if (revents & POLLHUP) {
|
|
||||||
if (session->useLogin && session->ptyFirstRead) {
|
|
||||||
// Workaround for random "Session closed" issues related to /bin/login
|
|
||||||
// closing and reopening our pty during initialization. This happens only
|
|
||||||
// on some systems like Fedora for example.
|
|
||||||
// Here we allow that our pty is closed by ignoring POLLHUP on first read.
|
|
||||||
// Delay is also needed so that login process has some time to reopen pty.
|
|
||||||
// Note that the issue may occur anyway but with workaround we reduce the
|
|
||||||
// chances.
|
|
||||||
debug("[server] POLLHUP received on login PTY first read!");
|
|
||||||
session->ptyFirstRead = 0;
|
|
||||||
delaySession();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
debug("[server] POLLHUP received on PTY! Closing session %s!",
|
|
||||||
session->sessionKey);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -394,7 +368,7 @@ static int dataHandler(HttpConnection *http, struct Service *service,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
if (!sessionIsNew && peerCheckEnabled && strcmp(session->peerName, httpGetPeerName(http))) {
|
if (!sessionIsNew && strcmp(session->peerName, httpGetPeerName(http))) {
|
||||||
error("[server] Peername changed from %s to %s",
|
error("[server] Peername changed from %s to %s",
|
||||||
session->peerName, httpGetPeerName(http));
|
session->peerName, httpGetPeerName(http));
|
||||||
httpSendReply(http, 400, "Bad Request", NO_MSG);
|
httpSendReply(http, 400, "Bad Request", NO_MSG);
|
||||||
|
@ -428,7 +402,6 @@ static int dataHandler(HttpConnection *http, struct Service *service,
|
||||||
goto bad_new_session;
|
goto bad_new_session;
|
||||||
}
|
}
|
||||||
session->http = http;
|
session->http = http;
|
||||||
session->useLogin = service->useLogin;
|
|
||||||
if (launchChild(service->id, session,
|
if (launchChild(service->id, session,
|
||||||
rootURL && *rootURL ? rootURL : urlGetURL(url)) < 0) {
|
rootURL && *rootURL ? rootURL : urlGetURL(url)) < 0) {
|
||||||
abandonSession(session);
|
abandonSession(session);
|
||||||
|
@ -809,7 +782,7 @@ static void usage(void) {
|
||||||
" -f, --static-file=URL:FILE serve static file from URL path\n"
|
" -f, --static-file=URL:FILE serve static file from URL path\n"
|
||||||
" -g, --group=GID switch to this group (default: %s)\n"
|
" -g, --group=GID switch to this group (default: %s)\n"
|
||||||
" -h, --help print this message\n"
|
" -h, --help print this message\n"
|
||||||
" --linkify=[none|normal|aggressive] default is \"normal\"\n"
|
" --linkify=[none|normal|agressive] default is \"normal\"\n"
|
||||||
" --localhost-only only listen on 127.0.0.1\n"
|
" --localhost-only only listen on 127.0.0.1\n"
|
||||||
" --no-beep suppress all audio output\n"
|
" --no-beep suppress all audio output\n"
|
||||||
" -n, --numeric do not resolve hostnames\n"
|
" -n, --numeric do not resolve hostnames\n"
|
||||||
|
@ -825,7 +798,6 @@ static void usage(void) {
|
||||||
" --user-css=STYLES defines user-selectable CSS options\n"
|
" --user-css=STYLES defines user-selectable CSS options\n"
|
||||||
" -v, --verbose enable logging messages\n"
|
" -v, --verbose enable logging messages\n"
|
||||||
" --version prints version information\n"
|
" --version prints version information\n"
|
||||||
" --disable-peer-check disable peer check on a session\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"Debug, quiet, and verbose are mutually exclusive.\n"
|
"Debug, quiet, and verbose are mutually exclusive.\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -897,7 +869,6 @@ static void parseArgs(int argc, char * const argv[]) {
|
||||||
int hasSSL = serverSupportsSSL();
|
int hasSSL = serverSupportsSSL();
|
||||||
if (!hasSSL) {
|
if (!hasSSL) {
|
||||||
enableSSL = 0;
|
enableSSL = 0;
|
||||||
forceSSL = 0;
|
|
||||||
}
|
}
|
||||||
int demonize = 0;
|
int demonize = 0;
|
||||||
int cgi = 0;
|
int cgi = 0;
|
||||||
|
@ -936,7 +907,6 @@ static void parseArgs(int argc, char * const argv[]) {
|
||||||
{ "user-css", 1, 0, 0 },
|
{ "user-css", 1, 0, 0 },
|
||||||
{ "verbose", 0, 0, 'v' },
|
{ "verbose", 0, 0, 'v' },
|
||||||
{ "version", 0, 0, 0 },
|
{ "version", 0, 0, 0 },
|
||||||
{ "disable-peer-check", 0, 0, 0 },
|
|
||||||
{ 0, 0, 0, 0 } };
|
{ 0, 0, 0, 0 } };
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
int c = getopt_long(argc, argv, optstring, options, &idx);
|
int c = getopt_long(argc, argv, optstring, options, &idx);
|
||||||
|
@ -1156,7 +1126,6 @@ static void parseArgs(int argc, char * const argv[]) {
|
||||||
warn("[config] Ignoring disable-ssl option, as SSL support is unavailable.");
|
warn("[config] Ignoring disable-ssl option, as SSL support is unavailable.");
|
||||||
}
|
}
|
||||||
enableSSL = 0;
|
enableSSL = 0;
|
||||||
forceSSL = 0;
|
|
||||||
} else if (!idx--) {
|
} else if (!idx--) {
|
||||||
// Disable SSL Menu
|
// Disable SSL Menu
|
||||||
if (!hasSSL) {
|
if (!hasSSL) {
|
||||||
|
@ -1246,9 +1215,6 @@ static void parseArgs(int argc, char * const argv[]) {
|
||||||
// Version
|
// Version
|
||||||
printf("ShellInABox version " VERSION VCS_REVISION "\n");
|
printf("ShellInABox version " VERSION VCS_REVISION "\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
} else if (!idx--) {
|
|
||||||
// disable-peer-check
|
|
||||||
peerCheckEnabled = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (optind != argc) {
|
if (optind != argc) {
|
||||||
|
|
2
shellinabox/shellinaboxd.man.in
Executable file → Normal file
|
@ -282,7 +282,7 @@ Display a brief usage message showing the valid command line parameters.
|
||||||
.TP
|
.TP
|
||||||
\fB--linkify\fP=[\fBnone\fP|\fBnormal\fP|\fBaggressive\fP]
|
\fB--linkify\fP=[\fBnone\fP|\fBnormal\fP|\fBaggressive\fP]
|
||||||
the daemon attempts to recognize URLs in the terminal output and makes them
|
the daemon attempts to recognize URLs in the terminal output and makes them
|
||||||
clickable. This is not necessarily a fool-proof process and both false
|
clickable. This is not neccessarily a fool-proof process and both false
|
||||||
negatives and false positives are possible. By default, only URLs starting
|
negatives and false positives are possible. By default, only URLs starting
|
||||||
with a well known protocol of
|
with a well known protocol of
|
||||||
.BR http:// ,\ https:// ,\ ftp:// ,\ or\ mailto:
|
.BR http:// ,\ https:// ,\ ftp:// ,\ or\ mailto:
|
||||||
|
|
0
shellinabox/usercss.c
Executable file → Normal file
0
shellinabox/usercss.h
Executable file → Normal file
|
@ -83,7 +83,6 @@
|
||||||
#define EStitle 17
|
#define EStitle 17
|
||||||
#define ESss2 18
|
#define ESss2 18
|
||||||
#define ESss3 19
|
#define ESss3 19
|
||||||
#define ESVTEtitle 20
|
|
||||||
|
|
||||||
#define ATTR_DEFAULT 0x60F0
|
#define ATTR_DEFAULT 0x60F0
|
||||||
#define ATTR_REVERSE 0x0100
|
#define ATTR_REVERSE 0x0100
|
||||||
|
@ -1604,9 +1603,6 @@ VT100.prototype.updateWidth = function() {
|
||||||
this.terminalWidth = Math.floor(this.console[this.currentScreen].offsetWidth/this.cursorWidth*this.scale);
|
this.terminalWidth = Math.floor(this.console[this.currentScreen].offsetWidth/this.cursorWidth*this.scale);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ("ActiveXObject" in window)
|
|
||||||
this.terminalWidth = Math.floor(this.console[this.currentScreen].offsetWidth/this.cursorWidth*this.scale*0.95);
|
|
||||||
else
|
|
||||||
this.terminalWidth = Math.floor(this.console[this.currentScreen].offsetWidth/this.cursorWidth*this.scale);
|
this.terminalWidth = Math.floor(this.console[this.currentScreen].offsetWidth/this.cursorWidth*this.scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2844,7 +2840,7 @@ VT100.prototype.handleKey = function(event) {
|
||||||
ch = part1 +
|
ch = part1 +
|
||||||
((event.shiftKey ? 1 : 0) +
|
((event.shiftKey ? 1 : 0) +
|
||||||
(event.altKey|event.metaKey ? 2 : 0) +
|
(event.altKey|event.metaKey ? 2 : 0) +
|
||||||
(event.ctrlKey ? 4 : 0) + 1) +
|
(event.ctrlKey ? 4 : 0)) +
|
||||||
part2;
|
part2;
|
||||||
} else if (ch.length == 1 && (event.altKey || event.metaKey)
|
} else if (ch.length == 1 && (event.altKey || event.metaKey)
|
||||||
&& !this.disableAlt) {
|
&& !this.disableAlt) {
|
||||||
|
@ -2914,9 +2910,9 @@ VT100.prototype.fixEvent = function(event) {
|
||||||
// Some browsers fail to translate keys, if both shift and alt/meta is
|
// Some browsers fail to translate keys, if both shift and alt/meta is
|
||||||
// pressed at the same time. We try to translate those cases, but that
|
// pressed at the same time. We try to translate those cases, but that
|
||||||
// only works for US keyboard layouts.
|
// only works for US keyboard layouts.
|
||||||
|
if (event.shiftKey) {
|
||||||
var u = undefined;
|
var u = undefined;
|
||||||
var s = undefined;
|
var s = undefined;
|
||||||
if (event.shiftKey) {
|
|
||||||
switch (this.lastNormalKeyDownEvent.keyCode) {
|
switch (this.lastNormalKeyDownEvent.keyCode) {
|
||||||
case 39: /* ' -> " */ u = 39; s = 34; break;
|
case 39: /* ' -> " */ u = 39; s = 34; break;
|
||||||
case 44: /* , -> < */ u = 44; s = 60; break;
|
case 44: /* , -> < */ u = 44; s = 60; break;
|
||||||
|
@ -2957,13 +2953,6 @@ VT100.prototype.fixEvent = function(event) {
|
||||||
case 222: /* ' -> " */ u = 39; s = 34; break;
|
case 222: /* ' -> " */ u = 39; s = 34; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
var c = this.lastNormalKeyDownEvent.keyCode;
|
|
||||||
if (c >= 65 && c <= 90) {
|
|
||||||
u = c;
|
|
||||||
s = u | 32;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (s && (event.charCode == u || event.charCode == 0)) {
|
if (s && (event.charCode == u || event.charCode == 0)) {
|
||||||
var fake = [ ];
|
var fake = [ ];
|
||||||
fake.charCode = s;
|
fake.charCode = s;
|
||||||
|
@ -2974,6 +2963,7 @@ VT100.prototype.fixEvent = function(event) {
|
||||||
fake.metaKey = event.metaKey;
|
fake.metaKey = event.metaKey;
|
||||||
return fake;
|
return fake;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return event;
|
return event;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3058,8 +3048,10 @@ VT100.prototype.keyDown = function(event) {
|
||||||
} else {
|
} else {
|
||||||
fake.charCode = 0;
|
fake.charCode = 0;
|
||||||
fake.keyCode = event.keyCode;
|
fake.keyCode = event.keyCode;
|
||||||
}
|
if (!alphNumKey && event.shiftKey) {
|
||||||
fake = this.fixEvent(fake);
|
fake = this.fixEvent(fake);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.handleKey(fake);
|
this.handleKey(fake);
|
||||||
this.lastNormalKeyDownEvent = undefined;
|
this.lastNormalKeyDownEvent = undefined;
|
||||||
|
@ -3174,10 +3166,10 @@ VT100.prototype.keyUp = function(event) {
|
||||||
} else {
|
} else {
|
||||||
fake.charCode = 0;
|
fake.charCode = 0;
|
||||||
fake.keyCode = event.keyCode;
|
fake.keyCode = event.keyCode;
|
||||||
}
|
if (!alphNumKey && (event.ctrlKey || event.altKey || event.metaKey)) {
|
||||||
if (event.ctrlKey || event.altKey || event.metaKey) {
|
|
||||||
fake = this.fixEvent(fake);
|
fake = this.fixEvent(fake);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.lastNormalKeyDownEvent = undefined;
|
this.lastNormalKeyDownEvent = undefined;
|
||||||
this.handleKey(fake);
|
this.handleKey(fake);
|
||||||
}
|
}
|
||||||
|
@ -3908,7 +3900,7 @@ VT100.prototype.csim = function() {
|
||||||
case 27: this.attr &= ~ ATTR_REVERSE; break;
|
case 27: this.attr &= ~ ATTR_REVERSE; break;
|
||||||
case 38:
|
case 38:
|
||||||
if (this.npar >= (i+2) && this.par[i+1] == 5) {
|
if (this.npar >= (i+2) && this.par[i+1] == 5) {
|
||||||
// Foreground color for extended color mode (256 colors). Escape code is formatted
|
// Foreground color for extended color mode (256 colors). Escape code is formated
|
||||||
// as: ESC 38; 5; 0-255. Last parameter is color code in range [0-255]. This is
|
// as: ESC 38; 5; 0-255. Last parameter is color code in range [0-255]. This is
|
||||||
// not VT100 standard.
|
// not VT100 standard.
|
||||||
this.attrFg = (this.par[i+2] >= 0 && this.par[i+2] <= 255) ? this.par[i+2] : false;
|
this.attrFg = (this.par[i+2] >= 0 && this.par[i+2] <= 255) ? this.par[i+2] : false;
|
||||||
|
@ -3924,7 +3916,7 @@ VT100.prototype.csim = function() {
|
||||||
break;
|
break;
|
||||||
case 48:
|
case 48:
|
||||||
if (this.npar >= (i+2) && this.par[i+1] == 5) {
|
if (this.npar >= (i+2) && this.par[i+1] == 5) {
|
||||||
// Background color for extended color mode (256 colors). Escape code is formatted
|
// Background color for extended color mode (256 colors). Escape code is formated
|
||||||
// as: ESC 48; 5; 0-255. Last parameter is color code in range [0-255]. This is
|
// as: ESC 48; 5; 0-255. Last parameter is color code in range [0-255]. This is
|
||||||
// not VT100 standard.
|
// not VT100 standard.
|
||||||
this.attrBg = (this.par[i+2] >= 0 && this.par[i+2] <= 255) ? this.par[i+2] : false;
|
this.attrBg = (this.par[i+2] >= 0 && this.par[i+2] <= 255) ? this.par[i+2] : false;
|
||||||
|
@ -4054,8 +4046,6 @@ VT100.prototype.doControl = function(ch) {
|
||||||
/*0*/ case 0x30:
|
/*0*/ case 0x30:
|
||||||
/*1*/ case 0x31:
|
/*1*/ case 0x31:
|
||||||
/*2*/ case 0x32: this.isEsc = EStitle; this.titleString = ''; break;
|
/*2*/ case 0x32: this.isEsc = EStitle; this.titleString = ''; break;
|
||||||
/*6*/ case 0x36: this.isEsc = ESVTEtitle; break;
|
|
||||||
/*7*/ case 0x37: this.isEsc = ESVTEtitle; break;
|
|
||||||
/*P*/ case 0x50: this.npar = 0; this.par = [ 0, 0, 0, 0, 0, 0, 0 ];
|
/*P*/ case 0x50: this.npar = 0; this.par = [ 0, 0, 0, 0, 0, 0, 0 ];
|
||||||
this.isEsc = ESpalette; break;
|
this.isEsc = ESpalette; break;
|
||||||
/*R*/ case 0x52: // Palette support is not implemented
|
/*R*/ case 0x52: // Palette support is not implemented
|
||||||
|
@ -4283,13 +4273,6 @@ VT100.prototype.doControl = function(ch) {
|
||||||
this.lastCharacter = String.fromCharCode(ch);
|
this.lastCharacter = String.fromCharCode(ch);
|
||||||
lineBuf += this.lastCharacter;
|
lineBuf += this.lastCharacter;
|
||||||
this.isEsc = ESnormal; break;
|
this.isEsc = ESnormal; break;
|
||||||
case ESVTEtitle:
|
|
||||||
// Ignores VTE escape sequences for current directory (OSC6) and current
|
|
||||||
// file (OSC7).
|
|
||||||
if (ch == 0x07 || ch == 0x5C) {
|
|
||||||
this.isEsc = ESnormal;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
this.isEsc = ESnormal; break;
|
this.isEsc = ESnormal; break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
set -ex
|
|
||||||
#
|
|
||||||
read -p "SSH remote host (hostname or ip address) [localhost] : " host;
|
|
||||||
[[ -z "${host}" ]] && host=localhost;
|
|
||||||
#
|
|
||||||
read -p "If a puplic_key authentification?: [y/N] : " puplic;
|
|
||||||
#
|
|
||||||
read -p "SSH remote port [22] : " port;
|
|
||||||
[[ -z "${port}" ]] && port=22;
|
|
||||||
#
|
|
||||||
read -p "SSH remote username [pi] : " username;
|
|
||||||
[[ -z "${username}" ]] && username=pi;
|
|
||||||
#
|
|
||||||
if [ "$puplic" == "y" ];
|
|
||||||
then
|
|
||||||
read -p "How is your public_key?: " key;
|
|
||||||
echo $key > ~/.ssh/id_rsa.pub;
|
|
||||||
|
|
||||||
rm ~/.ssh/id_rsa;
|
|
||||||
echo "Enter your private id here and press the enter key for a new line !!!";
|
|
||||||
id=null
|
|
||||||
while [ "$id" != "" ];
|
|
||||||
do
|
|
||||||
read -p "How is your id_rsa key?: " id;
|
|
||||||
echo $id >> ~/.ssh/id_rsa;
|
|
||||||
done
|
|
||||||
exec ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p $port $username@$host;
|
|
||||||
else
|
|
||||||
exec ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p $port $username@$host;
|
|
||||||
fi
|
|