Skip to content
  • Rob Swindell's avatar
    733c39b7
    Better resource (e.g. client thread) management · 733c39b7
    Rob Swindell authored
    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).
    733c39b7
    Better resource (e.g. client thread) management
    Rob Swindell authored
    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).
Loading