blob: 31b346de315fecb435f5adaaa75acf0c347c3b37 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit autotools 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}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 ppc ~ppc64 ~x86"
IUSE="+pam"
RDEPEND="
acct-user/shellinaboxd
acct-group/shellinaboxd"
DEPEND="
${RDEPEND}
dev-libs/openssl:0=
pam? ( sys-libs/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
}
src_prepare() {
default
eautoreconf
}
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 file.
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}"
# 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
}
|