https://gitlab.synchro.net/main/sbbs/-/commit/a35cb08fb0a5f69bbe11f010
Modified Files:
src/sbbs3/mailsrvr.c
Log Message:
Better resource (e.g. client thread) management
My mail server was suddenly and inexplicably creating thousands of SMTPS
client threads, each with a unique remote IP address, and each eventually failing with the rather obscure log message (from cryptlib):
dbg 'Cannot read item from object' (-41) setting session active
Eventually (after not long, really), the server would run out of resources
and fail in weird and wonderful ways (can't malloc, can't create JS runtime
or context, etc.). The max_clients limit (100, as I have it set) wasn't being effectively-imposed on SMTPS connections.
The root-cause: the active_clients (counter) wasn't incremented until *after* the cryptlib/TLS setup for SMTPS connections and SMTPS/TLS connections can
take a long time to fail, resulting in a vulnerability to an effective denial of service attack.
Raise the minimum severity of all cryptlib/TLS log messages from Debug to
Info.
Create wrappers for smtp_thread() [now smtp_client_thread()] and pop3_thread [now pop3_client_thread()] that handle basic resource management (thread counters, active client counters, the client socket).
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net