927c9f1051
SSH is now a standalone `ssh: true/false` value that starts sshd on port 22 *in addition to* whatever IDE is running, rather than replacing it. The `ide` value loses the `ssh` option and gains `none` (keep container alive with no GUI IDE, useful when ssh: true is the only access method). - chart/values.yaml: replace `ide: ssh` with `ssh: false` boolean - chart/templates/deployment.yaml: expose port 22 when ssh=true, port 5800 when ide!=none; probes use HTTP (VNC) or TCP socket (SSH-only) - chart/templates/service.yaml: include both ports when both enabled - scripts/cont-init-sshd.sh: check SSH=true instead of IDE=ssh - scripts/startapp.sh: add ide=none case (sleep infinity), drop ssh case - chart/Chart.yaml: bump to 0.1.6 - README.md: update IDE choice and SSH access docs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
28 lines
916 B
Bash
28 lines
916 B
Bash
#!/bin/sh
|
|
# Start OpenSSH server when SSH=true.
|
|
# Runs as root during container initialisation (cont-init.d).
|
|
[ "${SSH:-false}" = "true" ] || exit 0
|
|
|
|
echo "=== SSH enabled: starting sshd ==="
|
|
|
|
# Generate host keys if missing (first boot or ephemeral /etc/ssh)
|
|
ssh-keygen -A 2>/dev/null || true
|
|
|
|
# Populate authorized_keys from env var (injected via Kubernetes secret)
|
|
if [ -n "$SSH_AUTHORIZED_KEYS" ]; then
|
|
HOME_DIR="/home/user"
|
|
mkdir -p "$HOME_DIR/.ssh"
|
|
chmod 700 "$HOME_DIR/.ssh"
|
|
printf '%s\n' "$SSH_AUTHORIZED_KEYS" > "$HOME_DIR/.ssh/authorized_keys"
|
|
chmod 600 "$HOME_DIR/.ssh/authorized_keys"
|
|
chown -R 1000:1000 "$HOME_DIR/.ssh"
|
|
echo "SSH authorized keys configured."
|
|
else
|
|
echo "WARNING: SSH_AUTHORIZED_KEYS not set — you will not be able to log in."
|
|
fi
|
|
|
|
# Start sshd in background (root required to bind :22 and fork sessions)
|
|
/usr/sbin/sshd -D &
|
|
|
|
echo "sshd started (PID $!)"
|