Debian Codegraph @

contrib/README.ratio

raw
1 mod_ratio.c - Ratio system module for ProFTPD - README
2
3 Copyright (c) 2002 James Dogopoulos <[email protected]>
4 Portions Copyright (c) 1998-1999 Johnie Ingram. <[email protected]>
5
6 -----------------------------------------------------------------------
7
8 LATEST CHANGES:
9
10 * 2002-05-24: v3.3: Fixed numerous bugs and compatibility issues with
11 changing code within ProFTPD. In other words, it /works/ again!
12 Added default AnonRatio support (AnonRatio * ...).
13
14 -- See mod_ratio.c for previous version changes.
15
16
17 NOTES:
18
19 SaveRatios, RatioFile, RatioTempFile:
20
21 In order to have SaveRatios working properly, you must point
22 RatioFile and RatioTempFile to files that are read/writable for all
23 users that you wish to have ratios saved. If there is a problem
24 accessing the files, ProFTPD will revert back to the old per session
25 ratio method (u/l d/l stats will be forgotten on disconnect).
26
27 touch and chmod both files to allow r/w from all users whos ratios
28 will be saved. Enable ratios, users are added to the ratios file as
29 they log in and stat tracking begins.
30
31 If you are using DefaultRoot along with this command, the Ratio files
32 will need to be stored within the Root directory. One easy way is to
33 create a sub-directory off of DefaultRoot that is rwx by all users
34 and then restrict ALL access to these directorys within ProFTPD...
35
36 <Directory /workdir>
37 <Limit ALL>
38 Deny ALL
39 </Limit>
40 HideNoAccess
41 </Directory>
42
43
44 INSTALLATION:
45
46 To install, cconfigure it with ProFTPD like so,
47 ./configure --with-modules=mod_ratio
48
49 This module is inactive unless configured, which can be done with an
50 Anonymous, Directory, or VirtualHost block in proftpd.conf, or with a
51 .ftpaccess file. (Ratios must be turned on elsewhere for a directive in
52 .ftpaccess to take effect.)
53
54 If compiled with -DMOD_MYSQL_RATIOS, this module can get and set session
55 stats using mod_mysql, so the only directive needed is "Ratios on". This
56 acts like a weak "UserRatio" -- any directive described below can override
57 it. It also makes multiple concurrent uploads/downloads possible, with
58 persistent credits. See mod_mysql docs for setup details. Most ratio
59 directives take four numbers: file ratio, initial file credit, byte ratio,
60 and initial byte credit. Setting either ratio to 0 disables that check:
61 FooRatio bar [frate] [fcred] [brate] [bcred] The directives are HostRatio
62 (matches FQDN -- wildcards are allowed in this one), AnonRatio (matches
63 password entered in an anon login, usually an email address), UserRatio
64 (accepts "*" for 'any user'), and GroupRatio. Matches are looked for in
65 that order. Some examples:
66
67 Ratios on # enable module
68
69 SaveRatios on # Save ratios in plain text.
70 READ Above.
71
72 RatioFile "/path/tofile" # Required for SaveRatios
73 RatioTempFile "/path/tofile" # Required for SaveRatios
74
75 CwdRatioMsg "Please Upload!" # Displayed after every directory
76 change.
77
78 UserRatio ftp 0 0 0 0
79 HostRatio master.debian.org 0 0 0 0 # leech access (default)
80
81 GroupRatio proftpd 100 10 5 100000 # 100:1 files, 10 file cred 5:1
82 bytes, 100k byte cred
83
84 AnonRatio [email protected] 1 0 1 0 # 1:1 ratio, no credits
85 UserRatio * 5 5 5 5000 # special default case
86
87 FileRatioErrMsg "Come on you can send more files than that...."
88 ByteRatioErrMsg "This file is %i big, you know...."
89 LeechRatioMsg "Access: Unlimited"
90
91
92 UserRatio Directive Examples:
93
94 The UserRatio command controls the initial ratios and credits for all
95 users on the system. The format is:
96
97 UserRatio username FILERATIO FILECREDITS BYTERATIO BYTECREDITS(kB)
98
99 So "UserRatio * 0 0 3 10000" would give all users the default of
100 10000k bytes credit (9.7mb) and a 1:3 byte ratio, which will give the
101 user 3 bytes of creadit for every 1 byte uploaded.
102
103 Specifying a ratio as a negative number will swap the ratio, for
104 instance... "UserRatio jd 0 0 -3 0" would give the user jd a 3:1 byte
105 ratio, requiring jd to upload 3 bytes for every 1 byte he downloads.
106
107 Here's a multi-user anonymous ratio example:
108
109 AnonRatio [email protected] 0 0 3 50000
110 AnonRatio * 0 0 3 10000
111
112 If someone logs in with anonymous and gives the e-mail address of
113 [email protected], they will get 48MB credit. Everyone else will get 9MB.
114 It's important to put the individual users BEFORE the global "*" command
115 directive or else they will not take effect.
116
117
118
119 MORE Notes:
120
121 Setting "Ratios on" without configuring anything else will enable leech
122 mode: it logs activity and sends status messages to the ftp client, but
123 doesn't restrict traffic. Ratio module activity is recorded to syslog at
124 DEBUG0; it usually shows up in /var/log/debug, like this: foo in /: CWD
125 /foo :-15/3450 +0/0 (my 5 15 5 15000) =0/146 [NO F] This example is
126 for someone who (1) has downloaded 15 files totalling 14mb, (2) has
127 uploaded nothing, (3) has a ratio of 5:1 files and 15:1 bytes, (4) has
128 0 files and 146k credit remaining, (5) got the ratio from the MySQL
129 record ("my") and (6) is changing directory from / to /foo. Note that
130 if this module is turned on globally, any user can create a personal
131 ratio area with a .ftpaccess file. One way to prevent this is with:
132 PathDenyFilter "\.ftpaccess$"
133
134
135 DISCLAIMER:
136
137 The authors of this module, this ProFTPD software, and this OS and
138 kernel disclaim all warranties and are not responsible for what random
139 users of this module may do.
140