first commit
This commit is contained in:
commit
68b524268a
|
|
@ -0,0 +1,53 @@
|
||||||
|
FROM alpine:3.21
|
||||||
|
|
||||||
|
ENV FIREFOX_HOMEPAGE="https://www.google.com" \
|
||||||
|
RDP_PASSWORD="changeme"
|
||||||
|
|
||||||
|
# Install packages
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
openbox \
|
||||||
|
xrdp \
|
||||||
|
mesa-dri-gallium \
|
||||||
|
mesa-gl \
|
||||||
|
font-noto \
|
||||||
|
font-noto-emoji \
|
||||||
|
dbus \
|
||||||
|
firefox \
|
||||||
|
bash \
|
||||||
|
supervisor \
|
||||||
|
xterm \
|
||||||
|
x11vnc \
|
||||||
|
xset \
|
||||||
|
xvfb
|
||||||
|
|
||||||
|
# Create user
|
||||||
|
RUN adduser -D -s /bin/bash openbox && \
|
||||||
|
echo "openbox:${RDP_PASSWORD}" | chpasswd
|
||||||
|
|
||||||
|
# Configure XRDP - proxy mode to existing VNC session
|
||||||
|
COPY config/xrdp.ini /etc/xrdp/xrdp.ini
|
||||||
|
RUN mkdir -p /run/xrdp && \
|
||||||
|
chmod 0755 /run/xrdp
|
||||||
|
|
||||||
|
# OpenBox config
|
||||||
|
RUN mkdir -p /home/openbox/.config/openbox
|
||||||
|
|
||||||
|
COPY config/menu.xml /home/openbox/.config/openbox/menu.xml
|
||||||
|
COPY config/autostart.sh /home/openbox/.config/openbox/autostart
|
||||||
|
COPY config/rc.xml /home/openbox/.config/openbox/rc.xml
|
||||||
|
|
||||||
|
# Startup scripts
|
||||||
|
COPY scripts/start.sh /usr/local/bin/start.sh
|
||||||
|
COPY scripts/set-password.sh /usr/local/bin/set-password.sh
|
||||||
|
|
||||||
|
RUN chmod +x /home/openbox/.config/openbox/autostart && \
|
||||||
|
chmod +x /usr/local/bin/start.sh && \
|
||||||
|
chmod +x /usr/local/bin/set-password.sh && \
|
||||||
|
chown -R openbox:openbox /home/openbox
|
||||||
|
|
||||||
|
# Supervisor config
|
||||||
|
COPY config/supervisord.conf /etc/supervisord.conf
|
||||||
|
|
||||||
|
EXPOSE 3389 5900
|
||||||
|
|
||||||
|
CMD ["/usr/local/bin/start.sh"]
|
||||||
|
|
@ -0,0 +1,180 @@
|
||||||
|
# OpenBox Browser Container (RDP & VNC)
|
||||||
|
|
||||||
|
Alpine-basierter Docker-Container mit OpenBox Window Manager, Firefox Browser und Fernzugriff via RDP und VNC.
|
||||||
|
|
||||||
|
## Schnellstart
|
||||||
|
|
||||||
|
1. `.env`-Datei anpassen:
|
||||||
|
|
||||||
|
```env
|
||||||
|
FIREFOX_HOMEPAGE=https://www.google.com
|
||||||
|
RDP_PASSWORD=dein-sicheres-passwort
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Container starten:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose up -d --build
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Verbinden:
|
||||||
|
|
||||||
|
| Protokoll | Port | Passwort |
|
||||||
|
|-----------|------|----------|
|
||||||
|
| RDP | 3389 | `RDP_PASSWORD` aus `.env` |
|
||||||
|
| VNC | 5900 | `RDP_PASSWORD` aus `.env` |
|
||||||
|
|
||||||
|
- **RDP**: Windows Remotedesktop, Remmina, etc. (Benutzername wird ignoriert)
|
||||||
|
- **VNC**: TigerVNC Viewer, RealVNC, Remmina, etc.
|
||||||
|
|
||||||
|
Beide Protokolle zeigen die gleiche Session.
|
||||||
|
|
||||||
|
## Environment-Variablen
|
||||||
|
|
||||||
|
| Variable | Beschreibung | Standard |
|
||||||
|
|----------|-------------|----------|
|
||||||
|
| `FIREFOX_HOMEPAGE` | Firefox-Startseite | `https://www.google.com` |
|
||||||
|
| `RDP_PASSWORD` | Passwort fuer RDP- und VNC-Zugang | `changeme` |
|
||||||
|
|
||||||
|
## Persistenz
|
||||||
|
|
||||||
|
Firefox-Daten (Lesezeichen, Verlauf, Einstellungen, Cookies, etc.) werden im Ordner `firefox-data/` gespeichert und bleiben beim Neustart des Containers erhalten.
|
||||||
|
|
||||||
|
## OpenBox-Menu
|
||||||
|
|
||||||
|
Rechtsklick auf den Desktop oeffnet das Kontextmenue:
|
||||||
|
|
||||||
|
- **Firefox** - Startet Firefox mit der konfigurierten Startseite
|
||||||
|
- **Neustarten** - Startet die OpenBox-Session neu
|
||||||
|
- **Herunterfahren** - Beendet die OpenBox-Session
|
||||||
|
|
||||||
|
## Tastenkuerzel
|
||||||
|
|
||||||
|
| Kuerzel | Aktion |
|
||||||
|
|---------|--------|
|
||||||
|
| `Alt+F4` | Fenster schliessen |
|
||||||
|
| `Alt+Tab` | Fenster wechseln |
|
||||||
|
| `Alt+Linksklick` (Ziehen) | Fenster verschieben |
|
||||||
|
| `Alt+Rechtsklick` (Ziehen) | Fenster skalieren |
|
||||||
|
| Doppelklick Titelleiste | Fenster maximieren/wiederherstellen |
|
||||||
|
|
||||||
|
## Neubauen ohne Cache
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose down && docker compose build --no-cache && docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Projektstruktur
|
||||||
|
|
||||||
|
```
|
||||||
|
.
|
||||||
|
├── .env # Environment-Variablen (Passwort, Startseite)
|
||||||
|
├── Dockerfile # Container-Image Definition
|
||||||
|
├── docker-compose.yml # Service-Konfiguration
|
||||||
|
├── config/
|
||||||
|
│ ├── autostart.sh # OpenBox Autostart-Skript
|
||||||
|
│ ├── menu.xml # OpenBox Rechtsklick-Menue
|
||||||
|
│ ├── rc.xml # OpenBox Fenster-/Tastatur-/Maus-Konfiguration
|
||||||
|
│ ├── supervisord.conf # Prozess-Management (Startreihenfolge)
|
||||||
|
│ └── xrdp.ini # XRDP-Server Konfiguration
|
||||||
|
├── scripts/
|
||||||
|
│ ├── start.sh # Container-Einstiegspunkt
|
||||||
|
│ └── set-password.sh # Setzt Benutzerpasswort aus ENV
|
||||||
|
└── firefox-data/ # Persistente Firefox-Daten (Volume)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Konfigurationsdateien im Detail
|
||||||
|
|
||||||
|
### config/supervisord.conf
|
||||||
|
|
||||||
|
Verwaltet alle Dienste im Container ueber Supervisor. Die Dienste starten in dieser Reihenfolge:
|
||||||
|
|
||||||
|
| Prioritaet | Dienst | Beschreibung |
|
||||||
|
|------------|--------|-------------|
|
||||||
|
| 5 | **Xvfb** | Virtueller Framebuffer (Display `:10`, 1920x1080, 24bit). Stellt den X11-Server bereit, ohne physische Grafikkarte. |
|
||||||
|
| 10 | **OpenBox** | Window Manager. Startet nach 2s auf Display `:10` als Benutzer `openbox`. Laedt `.bashrc` fuer Umgebungsvariablen. |
|
||||||
|
| 20 | **x11vnc** | VNC-Server. Startet nach 3s, verbindet sich mit Display `:10`. Passwortgeschuetzt, Port 5900, Shared-Modus. |
|
||||||
|
| 30 | **XRDP** | RDP-Server. Startet nach 4s, fungiert als RDP-zu-VNC Proxy auf Port 3389. |
|
||||||
|
|
||||||
|
Alle Dienste haben `autorestart=true` und werden bei Absturz automatisch neu gestartet. Die `sleep`-Verzoegerungen stellen sicher, dass jeder Dienst erst startet, wenn seine Abhaengigkeiten bereit sind.
|
||||||
|
|
||||||
|
### config/xrdp.ini
|
||||||
|
|
||||||
|
XRDP-Server Konfiguration. Arbeitet im **Proxy-Modus** - leitet RDP-Verbindungen an den lokalen x11vnc-Server weiter.
|
||||||
|
|
||||||
|
Wichtige Einstellungen:
|
||||||
|
|
||||||
|
| Einstellung | Wert | Beschreibung |
|
||||||
|
|-------------|------|-------------|
|
||||||
|
| `port` | 3389 | Standard-RDP Port |
|
||||||
|
| `security_layer` | rdp | RDP-Verschluesselung |
|
||||||
|
| `crypt_level` | high | Hohe Verschluesselungsstufe |
|
||||||
|
| `max_bpp` | 32 | Maximale Farbtiefe |
|
||||||
|
| `lib` | libvnc.so | VNC-Protokoll als Backend |
|
||||||
|
| `ip` | 127.0.0.1 | Verbindet zu lokalem VNC |
|
||||||
|
| `port` (Session) | 5900 | VNC-Port von x11vnc |
|
||||||
|
|
||||||
|
Channels wie Clipboard (`cliprdr`), Sound (`rdpsnd`) und Laufwerks-Umleitung (`rdpdr`) sind aktiviert.
|
||||||
|
|
||||||
|
### config/autostart.sh
|
||||||
|
|
||||||
|
Wird von OpenBox automatisch beim Sessionstart ausgefuehrt. Aufgaben:
|
||||||
|
|
||||||
|
1. **Energiesparmodus deaktivieren**:
|
||||||
|
- `xset s off` - Bildschirmschoner aus
|
||||||
|
- `xset s noblank` - Kein Bildschirm-Blanking
|
||||||
|
- `xset -dpms` - Display Power Management aus (kein Standby/Suspend/Off)
|
||||||
|
|
||||||
|
2. **Firefox starten** mit der Startseite aus `FIREFOX_HOMEPAGE`
|
||||||
|
|
||||||
|
### config/menu.xml
|
||||||
|
|
||||||
|
Definiert das OpenBox-Rechtsklick-Kontextmenue mit vier Eintraegen:
|
||||||
|
- **Firefox** - Startet Firefox mit `--url "${FIREFOX_HOMEPAGE}"`
|
||||||
|
- **Terminal** - Oeffnet xterm
|
||||||
|
- **Neustarten** - `openbox --restart` (laedt OpenBox-Konfiguration neu)
|
||||||
|
- **Herunterfahren** - `openbox --exit` (beendet die Session)
|
||||||
|
|
||||||
|
### config/rc.xml
|
||||||
|
|
||||||
|
OpenBox Window Manager Konfiguration:
|
||||||
|
- **Theme**: Clearlooks mit Noto Sans Schriftart (Groesse 10)
|
||||||
|
- **Desktops**: 1 virtueller Desktop
|
||||||
|
- **Titelleiste**: NLIMC-Layout (Minimize, Maximize, Close Buttons)
|
||||||
|
- **Tastenkuerzel**: Alt+F4 (Schliessen), Alt+Tab (Wechseln)
|
||||||
|
- **Maus**: Rechtsklick auf Desktop oeffnet Menue, Titelleiste ziehbar, Doppelklick maximiert
|
||||||
|
|
||||||
|
### scripts/start.sh
|
||||||
|
|
||||||
|
Container-Einstiegspunkt. Fuehrt beim Start folgende Schritte aus:
|
||||||
|
1. Setzt das Benutzerpasswort aus `RDP_PASSWORD`
|
||||||
|
2. Erstellt VNC-Passwortdatei (gleiche wie RDP)
|
||||||
|
3. Schreibt `FIREFOX_HOMEPAGE` in `.bashrc` fuer die OpenBox-Session
|
||||||
|
4. Stellt korrekte Berechtigungen fuer Firefox-Daten sicher
|
||||||
|
5. Erstellt X11-Socket-Verzeichnis `/tmp/.X11-unix`
|
||||||
|
6. Generiert XRDP RSA-Schluessel (falls nicht vorhanden)
|
||||||
|
7. Startet Supervisor mit allen Diensten
|
||||||
|
|
||||||
|
### scripts/set-password.sh
|
||||||
|
|
||||||
|
Setzt das Passwort des Benutzers `openbox` aus der Environment-Variable `RDP_PASSWORD` via `chpasswd`.
|
||||||
|
|
||||||
|
## Architektur
|
||||||
|
|
||||||
|
```
|
||||||
|
┌──────────────────────────────────┐
|
||||||
|
│ Docker Container │
|
||||||
|
│ │
|
||||||
|
RDP :3389 ──────> │ XRDP ──> x11vnc ──> Xvfb :10 │
|
||||||
|
│ │ │
|
||||||
|
VNC :5900 ──────> │ x11vnc ─────────> Xvfb :10 │
|
||||||
|
│ │ │
|
||||||
|
│ OpenBox │
|
||||||
|
│ │ │
|
||||||
|
│ Firefox │
|
||||||
|
└──────────────────────────────────┘
|
||||||
|
│
|
||||||
|
./firefox-data (Volume)
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Disable screen saver and power saving
|
||||||
|
xset s off
|
||||||
|
xset s noblank
|
||||||
|
xset -dpms
|
||||||
|
|
||||||
|
# Start Firefox with configured homepage
|
||||||
|
firefox --url "${FIREFOX_HOMEPAGE}" &
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<openbox_menu xmlns="http://openbox.org/3.4/menu">
|
||||||
|
<menu id="root-menu" label="Openbox">
|
||||||
|
<item label="Firefox">
|
||||||
|
<action name="Execute">
|
||||||
|
<execute>bash -c 'firefox --url "$FIREFOX_HOMEPAGE"'</execute>
|
||||||
|
</action>
|
||||||
|
</item>
|
||||||
|
<separator />
|
||||||
|
<item label="Neustarten">
|
||||||
|
<action name="Execute">
|
||||||
|
<execute>openbox --restart</execute>
|
||||||
|
</action>
|
||||||
|
</item>
|
||||||
|
<item label="Herunterfahren">
|
||||||
|
<action name="Execute">
|
||||||
|
<execute>openbox --exit</execute>
|
||||||
|
</action>
|
||||||
|
</item>
|
||||||
|
</menu>
|
||||||
|
</openbox_menu>
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<openbox_config xmlns="http://openbox.org/3.4/rc">
|
||||||
|
<theme>
|
||||||
|
<name>Clearlooks</name>
|
||||||
|
<titleLayout>NLIMC</titleLayout>
|
||||||
|
<font place="ActiveWindow"><name>Noto Sans</name><size>10</size></font>
|
||||||
|
<font place="InactiveWindow"><name>Noto Sans</name><size>10</size></font>
|
||||||
|
<font place="MenuHeader"><name>Noto Sans</name><size>10</size></font>
|
||||||
|
<font place="MenuItem"><name>Noto Sans</name><size>10</size></font>
|
||||||
|
</theme>
|
||||||
|
<desktops>
|
||||||
|
<number>1</number>
|
||||||
|
</desktops>
|
||||||
|
<keyboard>
|
||||||
|
<keybind key="A-F4">
|
||||||
|
<action name="Close"/>
|
||||||
|
</keybind>
|
||||||
|
<keybind key="A-Tab">
|
||||||
|
<action name="NextWindow"/>
|
||||||
|
</keybind>
|
||||||
|
</keyboard>
|
||||||
|
<mouse>
|
||||||
|
<context name="Root">
|
||||||
|
<mousebind button="Right" action="Press">
|
||||||
|
<action name="ShowMenu"><menu>root-menu</menu></action>
|
||||||
|
</mousebind>
|
||||||
|
</context>
|
||||||
|
<context name="Titlebar">
|
||||||
|
<mousebind button="Left" action="Drag">
|
||||||
|
<action name="Move"/>
|
||||||
|
</mousebind>
|
||||||
|
<mousebind button="Left" action="DoubleClick">
|
||||||
|
<action name="ToggleMaximize"/>
|
||||||
|
</mousebind>
|
||||||
|
</context>
|
||||||
|
<context name="Frame">
|
||||||
|
<mousebind button="A-Left" action="Drag">
|
||||||
|
<action name="Move"/>
|
||||||
|
</mousebind>
|
||||||
|
<mousebind button="A-Right" action="Drag">
|
||||||
|
<action name="Resize"/>
|
||||||
|
</mousebind>
|
||||||
|
</context>
|
||||||
|
</mouse>
|
||||||
|
</openbox_config>
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
[supervisord]
|
||||||
|
nodaemon=true
|
||||||
|
logfile=/var/log/supervisord.log
|
||||||
|
pidfile=/var/run/supervisord.pid
|
||||||
|
|
||||||
|
[program:xvfb]
|
||||||
|
command=/usr/bin/Xvfb :10 -screen 0 1920x1080x24
|
||||||
|
autorestart=true
|
||||||
|
priority=5
|
||||||
|
|
||||||
|
[program:openbox]
|
||||||
|
command=/bin/bash -c "sleep 2 && DISPLAY=:10 su -c 'source ~/.bashrc && openbox-session' openbox"
|
||||||
|
autorestart=true
|
||||||
|
priority=10
|
||||||
|
|
||||||
|
[program:x11vnc]
|
||||||
|
command=/bin/bash -c "sleep 3 && x11vnc -display :10 -rfbauth /home/openbox/.vnc/passwd -rfbport 5900 -forever -shared -noxdamage"
|
||||||
|
autorestart=true
|
||||||
|
priority=20
|
||||||
|
|
||||||
|
[program:xrdp]
|
||||||
|
command=/bin/bash -c "sleep 4 && /usr/sbin/xrdp --nodaemon"
|
||||||
|
autorestart=true
|
||||||
|
priority=30
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
[Globals]
|
||||||
|
ini_version=1
|
||||||
|
fork=true
|
||||||
|
port=3389
|
||||||
|
use_vsock=false
|
||||||
|
tcp_nodelay=true
|
||||||
|
tcp_keepalive=true
|
||||||
|
security_layer=rdp
|
||||||
|
crypt_level=high
|
||||||
|
certificate=
|
||||||
|
key_file=
|
||||||
|
ssl_protocols=TLSv1.2, TLSv1.3
|
||||||
|
autorun=
|
||||||
|
allow_channels=true
|
||||||
|
allow_multimon=true
|
||||||
|
bitmap_cache=true
|
||||||
|
bitmap_compression=true
|
||||||
|
bulk_compression=true
|
||||||
|
max_bpp=32
|
||||||
|
new_cursors=true
|
||||||
|
|
||||||
|
[Logging]
|
||||||
|
LogFile=xrdp.log
|
||||||
|
LogLevel=INFO
|
||||||
|
EnableSyslog=true
|
||||||
|
|
||||||
|
[Channels]
|
||||||
|
rdpdr=true
|
||||||
|
rdpsnd=true
|
||||||
|
drdynvc=true
|
||||||
|
cliprdr=true
|
||||||
|
rail=false
|
||||||
|
xrdpvr=true
|
||||||
|
tcutils=true
|
||||||
|
|
||||||
|
[xrdp1]
|
||||||
|
name=Openbox Session
|
||||||
|
lib=libvnc.so
|
||||||
|
username=na
|
||||||
|
password=ask
|
||||||
|
ip=127.0.0.1
|
||||||
|
port=5900
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
services:
|
||||||
|
openbox-rdp:
|
||||||
|
build: .
|
||||||
|
container_name: openbox-rdp
|
||||||
|
ports:
|
||||||
|
- "3389:3389"
|
||||||
|
- "5900:5900"
|
||||||
|
environment:
|
||||||
|
- FIREFOX_HOMEPAGE=${FIREFOX_HOMEPAGE}
|
||||||
|
- RDP_PASSWORD=${RDP_PASSWORD}
|
||||||
|
volumes:
|
||||||
|
- ./firefox-data:/home/openbox/.mozilla
|
||||||
|
restart: unless-stopped
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -n "${RDP_PASSWORD}" ]; then
|
||||||
|
echo "openbox:${RDP_PASSWORD}" | chpasswd
|
||||||
|
fi
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Set user password from environment variable
|
||||||
|
/usr/local/bin/set-password.sh
|
||||||
|
|
||||||
|
# Store VNC password
|
||||||
|
mkdir -p /home/openbox/.vnc
|
||||||
|
x11vnc -storepasswd "${RDP_PASSWORD}" /home/openbox/.vnc/passwd
|
||||||
|
chown -R openbox:openbox /home/openbox/.vnc
|
||||||
|
|
||||||
|
# Pass environment variables to the openbox user session
|
||||||
|
echo "export FIREFOX_HOMEPAGE=\"${FIREFOX_HOMEPAGE}\"" > /home/openbox/.bashrc
|
||||||
|
chown openbox:openbox /home/openbox/.bashrc
|
||||||
|
|
||||||
|
# Ensure Firefox profile directory exists and has correct ownership
|
||||||
|
mkdir -p /home/openbox/.mozilla
|
||||||
|
chown -R openbox:openbox /home/openbox/.mozilla
|
||||||
|
|
||||||
|
# Prepare X11 socket directory
|
||||||
|
mkdir -p /tmp/.X11-unix
|
||||||
|
chmod 1777 /tmp/.X11-unix
|
||||||
|
|
||||||
|
# Generate XRDP RSA key if missing
|
||||||
|
if [ ! -f /etc/xrdp/rsakeys.ini ]; then
|
||||||
|
xrdp-keygen xrdp auto
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start services via supervisor
|
||||||
|
exec /usr/bin/supervisord -c /etc/supervisord.conf
|
||||||
Loading…
Reference in New Issue