1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 AUTOTOOLS_AUTORECONF="yes"
7 AUTOTOOLS_IN_SOURCE_BUILD="yes"
9 inherit user autotools-utils
11 DESCRIPTION="Web server that can export arbitrary command line tools to a web based terminal emulator"
12 HOMEPAGE="https://github.com/shellinabox/shellinabox"
13 SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.zip -> ${P}.zip"
17 KEYWORDS="amd64 ppc ppc64 x86"
22 ssl? ( dev-libs/openssl:0= )
25 SIAB_CERT_DIR="/etc/shellinabox/cert"
26 SIAB_SSL_BASH="${SIAB_CERT_DIR}/gen_ssl_cert.bash"
29 shellinbox_gen_ssl_setup() {
30 read -r -d '' SIAB_SSL_SETUP << EOF
32 openssl genrsa -des3 -out server.key 1024
33 openssl req -new -key server.key -out server.csr
34 cp server.key server.key.org
35 openssl rsa -in server.key.org -out server.key
36 openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
37 cat server.crt server.key > certificate.pem
42 enewgroup "${SIAB_DAEMON}"
43 enewuser "${SIAB_DAEMON}" -1 -1 -1 "${SIAB_DAEMON}"
47 local myeconf="--disable-runtime-loading"
56 emake DESTDIR="${D}" install || die
58 # make installs the binary in bin.
59 rm -rf "${D}/usr/bin" || die
61 # whereas it should put it in sbin.
62 dosbin "${SIAB_DAEMON}"
64 # Install init+conf files.
65 newinitd "${FILESDIR}/${SIAB_DAEMON}.init" "${SIAB_DAEMON}"
66 newconfd "${FILESDIR}/${SIAB_DAEMON}.conf" "${SIAB_DAEMON}"
69 insinto "/usr/share/${PN}-resources"
70 doins -r "${PN}"/*.css
73 # Create directory where SSL certificates will be generated.
74 dodir "${SIAB_CERT_DIR}"
75 fowners "${SIAB_DAEMON}:${SIAB_DAEMON}" "${SIAB_CERT_DIR}"
77 # Generate set up variable.
78 shellinbox_gen_ssl_setup
80 # Dump it in a bash script.
81 echo "#!/usr/bin/env bash" > "${D}/${SIAB_SSL_BASH}" ||die
82 echo "${SIAB_SSL_SETUP}" >> "${D}/${SIAB_SSL_BASH}" || die
83 chmod +x "${D}/${SIAB_SSL_BASH}" || die
89 ewarn "The default configuration expose a login shell"
90 ewarn "with SSL disabled on the localhost interface only."
94 shellinbox_gen_ssl_setup
97 einfo "To generate self-signed SSL certificates"
98 einfo "please read the following procedure"
99 einfo "explained here: https://code.google.com/p/shellinabox/issues/detail?id=59#c15"
101 einfo "${SIAB_SSL_SETUP}"
103 einfo "This walkthrough has been written in ${SIAB_SSL_BASH} for your convenience."
104 einfo "Make sure to execute this script."