First commit

This commit is contained in:
Héctor Molinero Fernández
2019-06-16 11:17:51 +02:00
commit 97f710716f
18 changed files with 1129 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
#!/bin/sh
set -eu
# Disable xdummy if there is no graphics card
if [ ! -d /dev/dri/ ]; then
unlink /etc/service/xdummy
fi
# Update guest user password
if [ -n "${GUEST_USER_PASSWORD-}" ]; then
printf '%s' "guest:${GUEST_USER_PASSWORD}" | chpasswd
unset GUEST_USER_PASSWORD
fi
# Dump environment variables
export-env >> /etc/profile.d/env.sh
# Generate self-signed certificate
if [ ! -f "${RDP_TLS_KEY_PATH}" ] || [ ! -f "${RDP_TLS_CERT_PATH}" ]; then
KEY_FILE=${RDP_TLS_KEY_PATH}
CRT_FILE=${RDP_TLS_CERT_PATH}
CSR_FILE=$(mktemp -u)
(umask 077 \
&& openssl genrsa -out "${KEY_FILE}" 2048 \
) >/dev/null
(umask 022 \
&& openssl req -new -subj "/CN=$(uname -n)" -key "${KEY_FILE}" -out "${CSR_FILE}" \
&& openssl x509 -req -days 3650 -signkey "${KEY_FILE}" -in "${CSR_FILE}" -out "${CRT_FILE}" \
&& rm -f "${CSR_FILE}" \
) >/dev/null
fi
# Start all services
exec runsvdir -P /etc/service/

12
scripts/bin/export-env Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/awk -f
BEGIN {
for (v in ENVIRON) {
if (v !~ /^(HOME|PWD|SHELL|USER|GROUP|UID|GID)$/) {
gsub(/[^0-9A-Za-z]/, "_", v)
gsub(/\n/, " ", ENVIRON[v])
gsub(/'/, "'\\''", ENVIRON[v])
print "export '"v"="ENVIRON[v]"'"
}
}
}

View File

@@ -0,0 +1,3 @@
#!/bin/sh
exec /usr/bin/sudo -u messagebus /usr/bin/dbus-daemon --system --nofork

3
scripts/service/sshd/run Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
exec /usr/sbin/sshd -D

7
scripts/service/xdummy/run Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
exec /usr/bin/Xorg \
-noreset -nolisten tcp \
+extension GLX +extension RANDR +extension RENDER \
-logfile /var/log/xdummy.log \
:0

View File

@@ -0,0 +1,3 @@
#!/bin/sh
exec /usr/sbin/xrdp-sesman --nodaemon

3
scripts/service/xrdp/run Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
exec /usr/sbin/xrdp --nodaemon