From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- www-misc/shellinabox/Manifest | 7 ++ www-misc/shellinabox/files/shellinaboxd.conf | 74 ++++++++++++++++ www-misc/shellinabox/files/shellinaboxd.init | 63 ++++++++++++++ www-misc/shellinabox/files/shellinaboxd.service | 14 ++++ www-misc/shellinabox/metadata.xml | 18 ++++ www-misc/shellinabox/shellinabox-2.20-r1.ebuild | 107 ++++++++++++++++++++++++ 6 files changed, 283 insertions(+) create mode 100644 www-misc/shellinabox/Manifest create mode 100644 www-misc/shellinabox/files/shellinaboxd.conf create mode 100644 www-misc/shellinabox/files/shellinaboxd.init create mode 100644 www-misc/shellinabox/files/shellinaboxd.service create mode 100644 www-misc/shellinabox/metadata.xml create mode 100644 www-misc/shellinabox/shellinabox-2.20-r1.ebuild (limited to 'www-misc/shellinabox') diff --git a/www-misc/shellinabox/Manifest b/www-misc/shellinabox/Manifest new file mode 100644 index 000000000000..1056e3e3675d --- /dev/null +++ b/www-misc/shellinabox/Manifest @@ -0,0 +1,7 @@ +AUX shellinaboxd.conf 3564 SHA256 0a06231c8238acc3a721209f20cf84d58e639cad12e208eb998abf9d72ea0725 SHA512 62c29e61a9fb332660806210533d30cdbd473f7c8acba9d1bb7d1960013920962f23b4af5e98b0ccc8a05a6ebfb6907f77b2c26ef3f8d5dee8fb23d2d074681a WHIRLPOOL 5c4a2355771c03e64c817e9a00d5530f9b86baeb9a8b7091394763f4d6582d91508aad00f18fd4f3f6614dc143aecd9643423c59c22bb7165515165e6a2a3122 +AUX shellinaboxd.init 1673 SHA256 57a53d1d230c5caca8d2ff3ed73b3577ca55d097b3de8c8b65660045e6517433 SHA512 7fc79a4a7633c452277ebcfb871ce34f4f3350beae863ad0cf5540ca12c9c8f33367cedddd8777eb1ea75d3ef7816935ef176d8eefac700b3e2917d11bfd280b WHIRLPOOL 51112ae9805ffbee4cf9946c8583bd2e9876182abc47ee6160137a810ad1de2bc9f75e1fb01d3e89d0b7708aa50b139f20d57c22ba84c5d969cd05f0471df46a +AUX shellinaboxd.service 420 SHA256 7e438a7a7f3e1dfbc0471962bb63c2863eef8843a496d21dd794d3d1796e0e80 SHA512 cdb22177b92794c7cda2e10c461f1f31ed165ede156c682fec5b682afbd48f8c9c564420950f3d39f9943cbfbfdb864869a96a2dae60f2bbe1bd36bd61282aa5 WHIRLPOOL 669d2f9514a1bf14328411515b4ca5f06e3f2cdbc67ef23635cba0e2fd2fb055fe9f70fceb4c4496a84534771cf714208a32688a0a46f8a174fda50f999b5052 +DIST shellinabox-2.20.zip 792359 SHA256 2b79ed66e5d20a8a46f68d88ba3a74d5302ffe7e5eb048a46b92b268351419f4 SHA512 0537b6400cb7f4880c76cce270e5eefd6f536eae7e27b5f7b12de0465a1e354f7980bb2f67230237eda1f7945afb1d3bb18013106bf7c3a02e7974532f0d9190 WHIRLPOOL a41f1d4010b6fd5386a8e37d6106d774a4600ac43e4baa3efc7a3b3d0f4c22214f13c5eb3d821a7b169731115ea17c9c0f5a6ad762c9791658a5ad98983f1356 +EBUILD shellinabox-2.20-r1.ebuild 2696 SHA256 1863a6e421d8dc674a4468a3f7d6ed89af0af311c52971796582e1da1ced4c4f SHA512 470af184e4e1a98d2515e80025a57ba850609c52ad77d41130605d2c1d4be2b329353e93dc29f3437de0bb78d7a89a82375d071b176ed76e5c242f6a25d0b302 WHIRLPOOL 8d3f528ebca1823e8800dcaf38239bc35664508bd6c4e3abbb2209eb7e7351e32f8c51be3e21d1c3f2fe0ea5e20ca87ee463ff664c02f8ab0b9c16eca7880c79 +MISC ChangeLog 3587 SHA256 e51bb8a3bda5143dd180869792f11303a2099f0ffc6e85a9500b75290f4044f8 SHA512 82f81dcea1188fd26dd854aaaa523a1a71229fb9422cf33f570b68817dbd43dcb5eb737f6a40b9d0104c12eed46b2aa24ea3dab070408be68e0b6fe5d6d6d13d WHIRLPOOL 847fd9ee402edbac2f92f11fa96eff04c96c6ba0a6afaf1cc389bd812e66209865194aa490336bcdae0d3cd80cc03eb36c6621af93f02c569704cfd80af0476d +MISC metadata.xml 526 SHA256 ee92fa40008e4ee6e0622388809ce0603570836dc5d1768f6d7efd9af213de5f SHA512 c9986b020184cb4393a1934b30dc2fce77ef6e926bd3f1f2f474adc201ae8302fe759c2b64e2775506b3ec0a097f10891490c39b9928359f31886d7818c8b64d WHIRLPOOL caffcb57ab2675edba3e839a665a3a294bb87436dd97ac15b7002aa0d87f536360d810ce087a7efc92788329812b0b702a8c089ce5d73af28fe54f8a50362be4 diff --git a/www-misc/shellinabox/files/shellinaboxd.conf b/www-misc/shellinabox/files/shellinaboxd.conf new file mode 100644 index 000000000000..3c34ab08f5e9 --- /dev/null +++ b/www-misc/shellinabox/files/shellinaboxd.conf @@ -0,0 +1,74 @@ +# conf.d file for shellinaboxd +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# 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..657a137a5c6b --- /dev/null +++ b/www-misc/shellinabox/files/shellinaboxd.init @@ -0,0 +1,63 @@ +#!/sbin/openrc-run +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +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=() + + # Try to keep environment pollution low. + local _CSS _BASE _NAME + + 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 $? +} diff --git a/www-misc/shellinabox/files/shellinaboxd.service b/www-misc/shellinabox/files/shellinaboxd.service new file mode 100644 index 000000000000..1915b0ca924f --- /dev/null +++ b/www-misc/shellinabox/files/shellinaboxd.service @@ -0,0 +1,14 @@ +[Unit] +Description=Shell In A Box daemon +Documentation=man:shellinaboxd(1) +After=network.target nss-lookup.target + +[Service] +EnvironmentFile=/etc/conf.d/shellinaboxd +WorkingDirectory=/usr/share/shellinabox-resources +ExecStart=/usr/sbin/shellinaboxd ${SIAB_DISABLE_SSL} --port=${SIAB_HTTP_PORT} --user=${SIAB_USER} --group=${SIAB_GROUP} --service=${SIAB_SERVICE} +Restart=on-failure + +[Install] +WantedBy=multi-user.target + diff --git a/www-misc/shellinabox/metadata.xml b/www-misc/shellinabox/metadata.xml new file mode 100644 index 000000000000..1a5ec634fb68 --- /dev/null +++ b/www-misc/shellinabox/metadata.xml @@ -0,0 +1,18 @@ + + + + + monsieurp@gentoo.org + Patrice Clement + + + shell-tools@gentoo.org + Gentoo Shell Tools Project + + + Enable PAM support. + + + shellinabox/shellinabox + + diff --git a/www-misc/shellinabox/shellinabox-2.20-r1.ebuild b/www-misc/shellinabox/shellinabox-2.20-r1.ebuild new file mode 100644 index 000000000000..11203d1d18cc --- /dev/null +++ b/www-misc/shellinabox/shellinabox-2.20-r1.ebuild @@ -0,0 +1,107 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +AUTOTOOLS_AUTORECONF="yes" +AUTOTOOLS_IN_SOURCE_BUILD="yes" + +inherit user autotools-utils systemd + +DESCRIPTION="Export command line tools to a web based terminal emulator" +HOMEPAGE="https://github.com/shellinabox/shellinabox" +SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.zip -> ${P}.zip" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 ppc ppc64 x86" +IUSE="+pam" + +DEPEND=" + dev-libs/openssl:0= + pam? ( virtual/pam )" + +SIAB_CERT_DIR="/etc/shellinabox/cert" +SIAB_SSL_BASH="${SIAB_CERT_DIR}/gen_ssl_cert.bash" +SIAB_DAEMON="${PN}d" + +shellinbox_gen_ssl_setup() { + read -r -d '' SIAB_SSL_SETUP << EOF +cd ${SIAB_CERT_DIR} +openssl genrsa -des3 -out server.key 1024 +openssl req -new -key server.key -out server.csr +cp server.key server.key.org +openssl rsa -in server.key.org -out server.key +openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt +cat server.crt server.key > certificate.pem +EOF +} + +pkg_setup() { + enewgroup "${SIAB_DAEMON}" + enewuser "${SIAB_DAEMON}" -1 -1 -1 "${SIAB_DAEMON}" +} + +src_configure() { + local myeconf=( + --disable-runtime-loading + --enable-ssl + ) + + econf \ + $(use_enable pam) \ + "${myeconf[@]}" +} + +src_install() { + emake DESTDIR="${D}" install + + # make installs the binary in bin... + rm -rf "${D}/usr/bin" || die + + # ... whereas it should put it in sbin. + dosbin "${SIAB_DAEMON}" + + # Install init+conf files. + newinitd "${FILESDIR}/${SIAB_DAEMON}.init" "${SIAB_DAEMON}" + newconfd "${FILESDIR}/${SIAB_DAEMON}.conf" "${SIAB_DAEMON}" + + # Install systemd unit files + systemd_dounit "${FILESDIR}"/shellinaboxd.service + + # Install CSS files. + insinto "/usr/share/${PN}-resources" + doins -r "${PN}"/*.css + + # Create directory where SSL certificates will be generated. + dodir "${SIAB_CERT_DIR}" + fowners "${SIAB_DAEMON}:${SIAB_DAEMON}" "${SIAB_CERT_DIR}" + + # Generate set up variable. + shellinbox_gen_ssl_setup + + # Dump it in a bash script. + echo "#!/usr/bin/env bash" > "${D}/${SIAB_SSL_BASH}" || die + echo "${SIAB_SSL_SETUP}" >> "${D}/${SIAB_SSL_BASH}" || die + chmod +x "${D}/${SIAB_SSL_BASH}" || die +} + +pkg_postinst() { + ewarn + ewarn "The default configuration exposes a login shell" + ewarn "with SSL disabled on the localhost interface only." + ewarn + + shellinbox_gen_ssl_setup + + einfo + einfo "To generate self-signed SSL certificates" + einfo "please read the procedure explained here:" + einfo "https://code.google.com/p/shellinabox/issues/detail?id=59#c15" + einfo + einfo "${SIAB_SSL_SETUP}" + einfo + einfo "This walkthrough has been written in ${SIAB_SSL_BASH} for your convenience." + einfo "Make sure to execute this script." + einfo +} -- cgit v1.2.3