54 lines
2.6 KiB
Bash
Executable File
54 lines
2.6 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
# Configuration only. Native packages are managed by the official LinuxServer mod.
|
|
mkdir -p /run/sshd /config/.hermes-workspace/hostkeys /opt/hermes-workspace/bin
|
|
chown root:root /config/.hermes-workspace/hostkeys
|
|
chmod 700 /config/.hermes-workspace/hostkeys
|
|
for kind in ed25519 rsa; do
|
|
test -f /config/.hermes-workspace/hostkeys/ssh_host_${kind}_key || ssh-keygen -q -t "$kind" -N '' -f /config/.hermes-workspace/hostkeys/ssh_host_${kind}_key
|
|
# Shared-workspace ACLs must never make SSH server private keys group-readable.
|
|
chmod 600 /config/.hermes-workspace/hostkeys/ssh_host_${kind}_key
|
|
done
|
|
usermod -s /bin/bash abc
|
|
cat > /etc/ssh/sshd_config.d/hermes-workspace.conf <<'EOF'
|
|
Port 22
|
|
HostKey /config/.hermes-workspace/hostkeys/ssh_host_ed25519_key
|
|
HostKey /config/.hermes-workspace/hostkeys/ssh_host_rsa_key
|
|
PermitRootLogin no
|
|
PasswordAuthentication no
|
|
KbdInteractiveAuthentication no
|
|
PubkeyAuthentication yes
|
|
AuthorizedKeysFile /config/.hermes-workspace/authorized_keys
|
|
AllowUsers abc
|
|
UsePAM yes
|
|
AllowTcpForwarding yes
|
|
X11Forwarding no
|
|
AllowAgentForwarding no
|
|
PermitUserEnvironment no
|
|
EOF
|
|
sed -i '/pam_loginuid.so/d' /etc/pam.d/sshd
|
|
cat > /etc/profile.d/hermes-workspace.sh <<'EOF'
|
|
export PATH=/opt/hermes-workspace/bin:/opt/hermes-workspace/node/bin:$PATH
|
|
export AGENT_BROWSER_EXECUTABLE_PATH=/usr/bin/chromium
|
|
export AGENT_BROWSER_HEADED=1
|
|
export DISPLAY=:1
|
|
EOF
|
|
ln -sf /opt/hermes-workspace/node/bin/agent-browser /usr/local/bin/agent-browser
|
|
ln -sf /opt/hermes-workspace/bin/webtop-browser /usr/local/bin/webtop-browser
|
|
ln -sf /opt/hermes-workspace/cua/cua-driver /usr/local/bin/cua-driver
|
|
# PulseAudio requires the configuration directory to belong to its runtime user.
|
|
# Old Webtop homes can retain the former PUID; retain content and correct ownership.
|
|
if test -d /config/.config/pulse; then chown -R abc:abc /config/.config/pulse; fi
|
|
chown abc:abc /config/.hermes-workspace
|
|
chown -R abc:abc /opt/hermes-workspace/node
|
|
if test -f /config/.hermes-workspace/authorized_keys; then
|
|
chown abc:abc /config/.hermes-workspace/authorized_keys
|
|
chmod 600 /config/.hermes-workspace/authorized_keys
|
|
fi
|
|
if ! pgrep -u "$(id -u abc)" -x chromium >/dev/null; then
|
|
rm -f /config/.hermes-workspace/browser-profile/SingletonLock /config/.hermes-workspace/browser-profile/SingletonSocket /config/.hermes-workspace/browser-profile/SingletonCookie
|
|
rm -f /config/.agent-browser/hermes-workspace.sock /config/.agent-browser/hermes-workspace.pid /config/.agent-browser/hermes-workspace.engine /config/.agent-browser/hermes-workspace.stream /config/.agent-browser/hermes-workspace.version
|
|
fi
|
|
chmod +x /config/.local/bin/proot-apps
|
|
printf 'ready\n' > /config/.hermes-workspace/setup-ready
|