mod_ratio

To install, copy this file into modules/ and do: ./configure --with-modules=mod_ratio This module is inactive unless configured, which can be done with an Anonymous, Directory, or VirtualHost block in proftpd.conf, or with a .ftpaccess file. (Ratios must be turned on elsewhere for a directive in .ftpaccess to take effect.) If compiled with -DMOD_MYSQL_RATIOS, this module can get and set session stats using mod_mysql, so the only directive needed is "Ratios on". This acts like a weak "UserRatio" -- any directive described below can override it. It also makes multiple concurrent uploads/downloads possible, with persistent credits. See mod_mysql docs for setup details. Most ratio directives take four numbers: file ratio, initial file credit, byte ratio, and initial byte credit. Setting either ratio to 0 disables that check: FooRatio bar [frate] [fcred] [brate] [bcred] The directives are HostRatio (matches FQDN -- wildcards are allowed in this one), AnonRatio (matches password entered in an anon login, usually an email address), UserRatio (accepts "*" for 'any user'), and GroupRatio. Matches are looked for in that order. Some examples: Ratios on # enable module UserRatio ftp 0 0 0 0 HostRatio master.debian.org 0 0 0 0 # leech access (default) GroupRatio proftpd 100 10 5 100000 # 100:1 files, 10 file cred 5:1 bytes, 100k byte cred AnonRatio billg@microsoft.com 1 0 1 0 # 1:1 ratio, no credits UserRatio * 5 5 5 50000 # special default case FileRatioErrMsg "Come on you can send more files than that...." ByteRatioErrMsg "This file is %i big, you know...." LeechRatioMsg "Access: Unlimited" Setting "Ratios on" without configuring anything else will enable leech mode: it logs activity and sends status messages to the ftp client, but doesn't restrict traffic. Ratio module activity is recorded to syslog at DEBUG0; it usually shows up in /var/log/debug, like this: foo in /: CWD /teen :-15/3450 +0/0 (my 5 15 5 150000) =0/146550 [NO F] This example is for someone who (1) has downloaded 15 files totalling 3450k, (2) has uploaded nothing, (3) has a ratio of 5:1 files and 15:1 bytes, (4) has 0 files and 146k credit remaining, (5) got the ratio from the MySQL record ("my") and (6) is changing directory from / to /teen. Note that if this module is turned on globally, any user can create a personal ratio area with a .ftpaccess file. One way to prevent this is with: PathDenyFilter "\.ftpaccess$" The authors of this module, this ProFTPD software, and this OS and kernel disclaim all warranties and are not responsible for what random users of this module may do. If you have ideas on how to improve this module, please contact