|
| 1 | +name: yunderaterminal |
| 2 | + |
| 3 | +services: |
| 4 | + yunderaterminal: |
| 5 | + image: nginx:alpine |
| 6 | + container_name: yunderaterminal |
| 7 | + restart: unless-stopped |
| 8 | + expose: |
| 9 | + - "3000" |
| 10 | + user: "root" |
| 11 | + command: ["nginx", "-c", "/custom-config/nginx.conf", "-g", "daemon off;"] |
| 12 | + volumes: |
| 13 | + - type: bind |
| 14 | + source: /DATA/AppData/yunderaterminal/nginx |
| 15 | + target: /custom-config |
| 16 | + read_only: true |
| 17 | + - type: bind |
| 18 | + source: /DATA/AppData/yunderaterminal |
| 19 | + target: /DATA/AppData/yunderaterminal |
| 20 | + depends_on: |
| 21 | + - ttyd |
| 22 | + networks: |
| 23 | + - pcs |
| 24 | + privileged: true |
| 25 | + cap_add: |
| 26 | + - SYS_ADMIN |
| 27 | + - NET_ADMIN |
| 28 | + |
| 29 | + ttyd: |
| 30 | + image: tsl0922/ttyd:latest |
| 31 | + container_name: yunderaterminaltty |
| 32 | + restart: unless-stopped |
| 33 | + user: "root" |
| 34 | + command: ["ttyd", "--writable", "--client-option", "enableZmodem=true", "--client-option", "enableSixel=false", "--client-option", "enableTrzsz=false", "--terminal-type", "xterm-256color", "chroot", "/host", "bash"] |
| 35 | + volumes: |
| 36 | + - type: bind |
| 37 | + source: / |
| 38 | + target: /host |
| 39 | + networks: |
| 40 | + - pcs |
| 41 | + privileged: true |
| 42 | + cap_add: |
| 43 | + - SYS_ADMIN |
| 44 | + - NET_ADMIN |
| 45 | + |
| 46 | +networks: |
| 47 | + pcs: |
| 48 | + external: true |
| 49 | + |
| 50 | +x-casaos: |
| 51 | + architectures: |
| 52 | + - amd64 |
| 53 | + - arm64 |
| 54 | + main: yunderaterminal |
| 55 | + author: yundera |
| 56 | + developer: yundera |
| 57 | + icon: https://cdn-icons-png.flaticon.com/512/2933/2933245.png |
| 58 | + tagline: |
| 59 | + en_us: "Secure hash-locked terminal access (Classic)" |
| 60 | + category: Utilities |
| 61 | + description: |
| 62 | + en_us: "A secure terminal with hash-based authentication using classic nginx approach" |
| 63 | + title: |
| 64 | + en_us: "Yundera Terminal Classic" |
| 65 | + store_app_id: yunderaterminal-classic |
| 66 | + is_uncontrolled: false |
| 67 | + index: /?hash=$AUTH_HASH |
| 68 | + webui_port: 3000 |
| 69 | + volumes: |
| 70 | + - /DATA/AppData/$AppID/nginx |
| 71 | + pre-install-cmd: | |
| 72 | + mkdir -p /DATA/AppData/yunderaterminal/nginx 2>/dev/null |
| 73 | + mkdir -p /DATA/AppData/yunderaterminal/nginx-cache/{client_temp,proxy_temp,fastcgi_temp,uwsgi_temp,scgi_temp} 2>/dev/null |
| 74 | + chown -R ubuntu:988 /DATA/AppData/yunderaterminal/ 2>/dev/null || true |
| 75 | + chmod -R 755 /DATA/AppData/yunderaterminal/ 2>/dev/null || true |
| 76 | +
|
| 77 | + NGINX_DIR="/DATA/AppData/yunderaterminal/nginx" |
| 78 | + cat > "$NGINX_DIR/nginx.conf" << 'NGINX_EOF' |
| 79 | + pid /DATA/AppData/yunderaterminal/nginx-cache/nginx.pid; |
| 80 | + error_log /DATA/AppData/yunderaterminal/nginx-cache/error.log; |
| 81 | +
|
| 82 | + events { |
| 83 | + worker_connections 1024; |
| 84 | + } |
| 85 | +
|
| 86 | + http { |
| 87 | + include /etc/nginx/mime.types; |
| 88 | + default_type application/octet-stream; |
| 89 | +
|
| 90 | + client_body_temp_path /DATA/AppData/yunderaterminal/nginx-cache/client_temp; |
| 91 | + proxy_temp_path /DATA/AppData/yunderaterminal/nginx-cache/proxy_temp; |
| 92 | + fastcgi_temp_path /DATA/AppData/yunderaterminal/nginx-cache/fastcgi_temp; |
| 93 | + uwsgi_temp_path /DATA/AppData/yunderaterminal/nginx-cache/uwsgi_temp; |
| 94 | + scgi_temp_path /DATA/AppData/yunderaterminal/nginx-cache/scgi_temp; |
| 95 | +
|
| 96 | + sendfile on; |
| 97 | + tcp_nopush on; |
| 98 | + tcp_nodelay on; |
| 99 | + keepalive_timeout 65; |
| 100 | +
|
| 101 | + server { |
| 102 | + listen 3000; |
| 103 | + server_name _; |
| 104 | +
|
| 105 | + location / { |
| 106 | + if (\$arg_hash != "$AUTH_HASH") { |
| 107 | + return 403 "Access denied: Invalid or missing authentication hash. Please access through CasaOS dashboard."; |
| 108 | + } |
| 109 | +
|
| 110 | + proxy_pass http://yunderaterminaltty:7681; |
| 111 | + proxy_http_version 1.1; |
| 112 | + proxy_set_header Upgrade \$http_upgrade; |
| 113 | + proxy_set_header Connection "upgrade"; |
| 114 | + proxy_set_header Host \$host; |
| 115 | + proxy_set_header X-Real-IP \$remote_addr; |
| 116 | + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; |
| 117 | + proxy_set_header X-Forwarded-Proto \$scheme; |
| 118 | +
|
| 119 | + proxy_buffering off; |
| 120 | + proxy_cache off; |
| 121 | + proxy_read_timeout 86400; |
| 122 | + proxy_send_timeout 86400; |
| 123 | + proxy_connect_timeout 60s; |
| 124 | +
|
| 125 | + proxy_set_header X-Forwarded-Host \$host; |
| 126 | + proxy_set_header X-Forwarded-Server \$host; |
| 127 | + } |
| 128 | + } |
| 129 | + } |
| 130 | + NGINX_EOF |
0 commit comments