summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrice Clement <monsieurp@gentoo.org>2015-10-23 08:31:53 +0000
committerPatrice Clement <monsieurp@gentoo.org>2015-10-23 08:32:34 +0000
commit85c4bf6fd5e57b0927330638ef071c71f1f5a64e (patch)
tree66e9b6f30d9267093329a68f967191d0a91de215 /www-misc/shellinabox/files
parentwww-client/chromium: backport fix for bug #562590 by W. Trevor King to M47 (diff)
downloadgentoo-85c4bf6fd5e57b0927330638ef071c71f1f5a64e.tar.gz
gentoo-85c4bf6fd5e57b0927330638ef071c71f1f5a64e.tar.bz2
gentoo-85c4bf6fd5e57b0927330638ef071c71f1f5a64e.zip
www-misc/shellinabox: Initial import. Fixes bug 343765.
Package-Manager: portage-2.2.20.1 Signed-off-by: Patrice Clement <monsieurp@gentoo.org>
Diffstat (limited to 'www-misc/shellinabox/files')
-rw-r--r--www-misc/shellinabox/files/shellinaboxd.conf75
-rw-r--r--www-misc/shellinabox/files/shellinaboxd.init61
2 files changed, 136 insertions, 0 deletions
diff --git a/www-misc/shellinabox/files/shellinaboxd.conf b/www-misc/shellinabox/files/shellinaboxd.conf
new file mode 100644
index 000000000000..7f020c123d1c
--- /dev/null
+++ b/www-misc/shellinabox/files/shellinaboxd.conf
@@ -0,0 +1,75 @@
+# conf.d file for shellinaboxd
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Options available (copied from the man page):
+#
+# Sometimes, it is not necessary to replace the entire style sheet using the
+# --static-file option. But instead a small incremental change should be made to
+# the visual appearance of the terminal. The --css option provides a means to
+# append additional style rules to the end of the default styles.css sheet. More
+# than one --css option can be given on the same command line.
+#
+# You shouldn't need to change this value
+# unless you want to load your own style sheets.
+SIAB_CSS_DIR="/usr/share/shellinabox-resources"
+
+# If built with SSL/TLS support enabled, the daemon will look in SIAB_CERT_DIR for any
+# certificates. If unspecified, this defaults to the current working directory.
+#
+# If the browser negotiated a Server Name Identification the daemon will look for
+# a matching certificate-SERVERNAME.pem file. This allows for virtual hosting
+# of multiple server names on the same IP address and port.
+#
+# If no SNI handshake took place, it falls back on using the certificate in the
+# certificate.pem file.
+#
+# The administrator should make sure that there are matching certificates for
+# each of the virtual hosts on this server, and that there is a generic certifi‐
+# cate.pem file.
+#
+# If no suitable certificate is installed, shellinaboxd will attempt to invoke
+# /usr/bin/openssl and create a new self-signed certificate. This only
+# succeeds if, after dropping privileges, shellinaboxd has write
+# permissions for SIAB_CERT_DIR.
+#
+# Most browsers show a warning message when encountering a self-signed
+# certificate and then allow the user the option of accepting the certificate.
+# Due to this usability problem, and due to the perceived security
+# implications, the use of auto-generated self-signed certificates is intended
+# for testing or in intranet deployments, only.
+#
+SIAB_CERT_DIR="/etc/shellinabox/cert"
+
+# By default, shellinaboxd redirectes all incoming HTTP requests to their
+# equivalent HTTPS URLs. If promoting of connections to encrypted SSL/TLS
+# sessions is undesired, this behavior can be disabled.
+#
+# This option is also useful during testing or for deployment in trusted
+# intranets, if SSL certificates are unavailable.
+#
+# SIAB_DISABLE_SSL and SIAB_CERT_DIR are mutually exclusive options.
+#
+# Add this option to SIAB_OPTS if you don't want SSL support.
+SIAB_DISABLE_SSL="--disable-ssl"
+
+# Default port to listen on.
+SIAB_HTTP_PORT="4200"
+
+# Run shellinabox as this user.
+SIAB_USER="shellinaboxd"
+
+# Run shellinabox as this group.
+SIAB_GROUP="shellinaboxd"
+
+# Default service to launch
+SIAB_SERVICE="/:LOGIN"
+
+# Do not add both SIAB_CSS_DIR or SIAB_CERT_DIR to SIAB_OPTS.
+
+# Default setup turns off SSL.
+SIAB_OPTS="${SIAB_DISABLE_SSL} --port=${SIAB_HTTP_PORT} --user=${SIAB_USER} --group=${SIAB_GROUP} --service=${SIAB_SERVICE}"
+
+# Uncomment this line to activate SSL.
+# SIAB_OPTS="--cert=${SIAB_CERT_DIR} --port=${SIAB_HTTP_PORT} --user=${SIAB_USER} --group=${SIAB_GROUP} --service=${SIAB_SERVICE}"
diff --git a/www-misc/shellinabox/files/shellinaboxd.init b/www-misc/shellinabox/files/shellinaboxd.init
new file mode 100644
index 000000000000..7282fedcc031
--- /dev/null
+++ b/www-misc/shellinabox/files/shellinaboxd.init
@@ -0,0 +1,61 @@
+#!/sbin/runscript
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+my_daemon="shellinaboxd"
+pidfile="/var/run/${my_daemon}.pid"
+command="/usr/sbin/${my_daemon}"
+command_args="${SIAB_OPTS}"
+
+depend() {
+ use net
+}
+
+start_pre() {
+ function my_join() { local IFS="${1}"; shift; echo "$*"; }
+
+ if [[ -n ${SIAB_CSS_DIR} ]]; then
+ # This code searches SIAB_CSS_DIR for CSS files
+ # and formats the --user-css option accordingly.
+ local CSS_FILES=( "${SIAB_CSS_DIR}"/*.css )
+ local SIAB_CSS_FILES=()
+
+ for _CSS in "${CSS_FILES[@]}"; do
+ _BASE="$(basename ${_CSS})"
+ _NAME="${_BASE%%\.css}"
+ _NAME="${_NAME//-/_}"
+ _NAME="${_NAME^}"
+ # These are the default style sheets. Don't load them.
+ [[ ${_NAME} =~ ^(Print|Styles).*? ]] && continue
+ SIAB_CSS_FILES+=("\"${_NAME}\":-${_CSS}")
+ done
+
+ # The 1st one, which the default one, must be turned on using a + sign.
+ SIAB_CSS_FILES[0]=$(sed 's#:-#:+#' <<< ${SIAB_CSS_FILES[0]})
+
+ command_args="${command_args} --user-css=$(my_join , "${SIAB_CSS_FILES[@]}")"
+ fi
+
+ return 0
+}
+
+start() {
+ ebegin "Starting ${my_daemon}"
+ start-stop-daemon \
+ --start \
+ --background \
+ --pidfile ${pidfile} \
+ --make-pidfile \
+ --exec ${command} \
+ -- ${command_args}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${my_daemon}"
+ start-stop-daemon \
+ --stop \
+ --pidfile ${pidfile}
+ eend $?
+}