📦 build: add memory limit and session safeguard settings

This commit is contained in:
2026-07-16 21:58:55 +07:00
parent 9995557ae2
commit 2e320b03f3
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -26,12 +26,16 @@ FORCE_GRAYSCALE=false
# Max rendered width/height in characters. # Max rendered width/height in characters.
MAX_DIMENSION=512 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). # Memory budget in MB for the rendered-frame cache (0 disables caching).
RENDER_CACHE_MB=256 RENDER_CACHE_MB=256
# Go soft memory limit; set below your container limit to avoid OOM kills. # Go soft memory limit; set below your container limit to avoid OOM kills.
GOMEMLIMIT=1GiB 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. # Connection limits. New connections over a limit are dropped immediately.
# Max simultaneous connections from a single client IP. # Max simultaneous connections from a single client IP.
@@ -43,6 +47,8 @@ MAX_TOTAL_CONNECTIONS=1000
MAX_AUTH_ATTEMPTS=3 MAX_AUTH_ATTEMPTS=3
# SSH handshake deadline in ms (0 to disable). # SSH handshake deadline in ms (0 to disable).
HANDSHAKE_TIMEOUT=30000 HANDSHAKE_TIMEOUT=30000
# Maximum session lifetime in ms (0 to disable).
SESSION_TIMEOUT=600000
# Log attempted usernames/passwords. # Log attempted usernames/passwords.
LOG_CREDENTIALS=true LOG_CREDENTIALS=true
+1
View File
@@ -3,6 +3,7 @@ services:
image: ghcr.io/yuzuzensai/trollssh:v1.0.1 image: ghcr.io/yuzuzensai/trollssh:v1.0.1
container_name: trollssh container_name: trollssh
restart: unless-stopped restart: unless-stopped
mem_limit: ${MEMORY_LIMIT:-2g}
ports: ports:
- "22:22" - "22:22"
env_file: env_file: