ProFTPD module mod_rlimit



The mod_rlimit module handles setting and enforcement of resource limits such as CPU, memory, and file descriptor usage.

By default, the mod_rlimit module will impose one resource restriction on new session processes: the RLIMIT_NPROC (see getrlimit(2) limit, which controls the number of processes which can be forked from this process, is set to zero. There is absolutely no reason for a proftpd session process to need to create a new process via fork(2).

This module is contained in the mod_rlimit.c file for ProFTPD 1.3.x, and is compiled by default. See the installation section for more details.

The most current version of mod_rlimit can be found in the ProFTPD source distribution:

  http://www.proftpd.org/

Directives


RLimitCPU

Syntax: RLimitCPU [scope] soft-limit|"max" [hard-limit|"max"]
Default: System defaults
Context: "server config", <VirtualHost>, <Global>
Module: mod_rlimit
Compatibility: 1.3.5rc2

The RLimitCPU directive is used to set a limit on the CPU usage, expressed as a maximum number of seconds.

RLimitCPU takes from one to three parameters. The first parameter is an optional scope parameter, indicating the scope of the resource limit. The scope parameter may be one of:

If none of these keywords are used, the resource limit is assumed to apply to both daemon and session processes.

The next parameters indicate the actual resource limits, both the so-called "soft limit" and any "hard limit". These parameters may be a number (indicating the number of seconds), or the value "max" to indicate that maximum resource limit value allowed is to be used.

Example:

  # Limit a given session to 30 minutes of CPU time (which can take
  # considerably longer than 30 minutes of wall time, due to CPU scheduling)
  RLimitCPU 1800


RLimitMemory

Syntax: RLimitMemory [scope] soft-limit|"max" [hard-limit|"max"]
Default: System defaults
Context: "server config", <VirtualHost>, <Global>
Module: mod_rlimit
Compatibility: 1.3.5rc2

The RLimitMemory directive is used to set a limit on the memory usage, expressed as a maximum number of bytes.

RLimitMemory takes from one to three parameters. The first parameter is an optional scope parameter, indicating the scope of the resource limit. The scope parameter may be one of:

If none of these keywords are used, the resource limit is assumed to apply to both daemon and session processes.

The next parameters indicate the actual resource limits, both the so-called "soft limit" and any "hard limit". These parameters may be a number (indicating the number of bytes), or the value "max" to indicate that maximum resource limit value allowed is to be used.

Example:

  # Limit a given session to 128MB minutes of memory
  RLimitMemory 128MB


RLimitOpenFiles

Syntax: RLimitOpenFiles [scope] soft-limit|"max" [hard-limit|"max"]
Default: System defaults
Context: "server config", <VirtualHost>, <Global>
Module: mod_rlimit
Compatibility: 1.3.5rc2

The RLimitOpenFiles directive is used to set a limit on the file descriptors, expressed as counts.

RLimitOpenFiles takes from one to three parameters. The first parameter is an optional scope parameter, indicating the scope of the resource limit. The scope parameter may be one of:

If none of these keywords are used, the resource limit is assumed to apply to both daemon and session processes.

The next parameters indicate the actual resource limits, both the so-called "soft limit" and any "hard limit". These parameters may be a number, or the value "max" to indicate that maximum resource limit value allowed is to be used.

Example:

  # Limit a given session to 12 open file descriptors
  RLimitMemory session 12


RLimitProcesses

Syntax: RLimitProcesses on|off Default: RLimitProcesses on
Context: "server config", <VirtualHost>, <Global>
Module: mod_rlimit
Compatibility: 1.3.5rc2

The RLimitProcesses directive is used to determine whether mod_rlimit sets a limit on the number of child processes.

Example:

  # Disable mod_rlimit's default limiting of processes.
  # NOTE: NOT RECOMMENDED
  RLimitProcesses off


Installation

The mod_rlimit module is compiled into proftpd by default.



Author: $Author: castaglia $
Last Updated: $Date: 2013/02/21 21:02:45 $


© Copyright 2013 TJ Saunders
All Rights Reserved