1 # Copyright 1999-2019 Gentoo Authors
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 systemd
11 DESCRIPTION="Export 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 pam? ( sys-libs/pam )"
24 SIAB_CERT_DIR="/etc/shellinabox/cert"
25 SIAB_SSL_BASH="${SIAB_CERT_DIR}/gen_ssl_cert.bash"
28 shellinbox_gen_ssl_setup() {
29 read -r -d '' SIAB_SSL_SETUP << EOF
31 openssl genrsa -des3 -out server.key 1024
32 openssl req -new -key server.key -out server.csr
33 cp server.key server.key.org
34 openssl rsa -in server.key.org -out server.key
35 openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
36 cat server.crt server.key > certificate.pem
41 enewgroup "${SIAB_DAEMON}"
42 enewuser "${SIAB_DAEMON}" -1 -1 -1 "${SIAB_DAEMON}"
47 --disable-runtime-loading
57 emake DESTDIR="${D}" install
59 # make installs the binary in bin...
60 rm -rf "${D}/usr/bin" || die
62 # ... whereas it should put it in sbin.
63 dosbin "${SIAB_DAEMON}"
65 # Install init+conf files.
66 newinitd "${FILESDIR}/${SIAB_DAEMON}.init" "${SIAB_DAEMON}"
67 newconfd "${FILESDIR}/${SIAB_DAEMON}.conf" "${SIAB_DAEMON}"
69 # Install systemd unit file.
70 systemd_dounit "${FILESDIR}"/shellinaboxd.service
73 insinto "/usr/share/${PN}-resources"
74 doins -r "${PN}"/*.css
76 # Create directory where SSL certificates will be generated.
77 dodir "${SIAB_CERT_DIR}"
78 fowners "${SIAB_DAEMON}:${SIAB_DAEMON}" "${SIAB_CERT_DIR}"
80 # Generate set up variable.
81 shellinbox_gen_ssl_setup
83 # Dump it in a bash script.
84 echo "#!/usr/bin/env bash" > "${D}/${SIAB_SSL_BASH}" || die
85 echo "${SIAB_SSL_SETUP}" >> "${D}/${SIAB_SSL_BASH}" || die
86 chmod +x "${D}/${SIAB_SSL_BASH}" || die
91 ewarn "The default configuration exposes a login shell"
92 ewarn "with SSL disabled on the localhost interface only."
95 shellinbox_gen_ssl_setup
98 einfo "To generate self-signed SSL certificates"
99 einfo "please read the procedure explained here:"
100 einfo "https://code.google.com/p/shellinabox/issues/detail?id=59#c15"
102 einfo "${SIAB_SSL_SETUP}"
104 einfo "This walkthrough has been written in ${SIAB_SSL_BASH} for your convenience."
105 einfo "Make sure to execute this script."