From 2e320b03f339f08aedaa6e03f541afebb9249e62 Mon Sep 17 00:00:00 2001 From: Yuzu Date: Thu, 16 Jul 2026 21:56:41 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20build:=20add=20memory=20limit=20?= =?UTF-8?q?and=20session=20safeguard=20settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 6 ++++++ docker-compose.yaml | 1 + 2 files changed, 7 insertions(+) diff --git a/.env.example b/.env.example index 1b2ea06..891e7f5 100644 --- a/.env.example +++ b/.env.example @@ -26,12 +26,16 @@ FORCE_GRAYSCALE=false # Max rendered width/height in characters. MAX_DIMENSION=512 +# Max rendered area (columns x rows); larger terminals are scaled down. +MAX_TERMINAL_CELLS=256000 # Memory budget in MB for the rendered-frame cache (0 disables caching). RENDER_CACHE_MB=256 # Go soft memory limit; set below your container limit to avoid OOM kills. GOMEMLIMIT=1GiB +# Docker Compose container memory limit. Leave headroom for mapped frame files. +MEMORY_LIMIT=2g # Connection limits. New connections over a limit are dropped immediately. # Max simultaneous connections from a single client IP. @@ -43,6 +47,8 @@ MAX_TOTAL_CONNECTIONS=1000 MAX_AUTH_ATTEMPTS=3 # SSH handshake deadline in ms (0 to disable). HANDSHAKE_TIMEOUT=30000 +# Maximum session lifetime in ms (0 to disable). +SESSION_TIMEOUT=600000 # Log attempted usernames/passwords. LOG_CREDENTIALS=true diff --git a/docker-compose.yaml b/docker-compose.yaml index ebc4864..6fa290d 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,6 +3,7 @@ services: image: ghcr.io/yuzuzensai/trollssh:v1.0.1 container_name: trollssh restart: unless-stopped + mem_limit: ${MEMORY_LIMIT:-2g} ports: - "22:22" env_file: