Debian Codegraph @

doc/contrib/mod_shaper.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>ProFTPD module mod_shaper</title>
5 </head>
6
7 <body bgcolor=white>
8
9 <hr>
10 <center>
11 <h2><b>ProFTPD module <code>mod_shaper</code></b></h2>
12 </center>
13 <hr><br>
14
15 <p>
16 The <code>mod_shaper</code> module is designed to split overall rates, both
17 download and upload, for the <code>proftpd</code> daemon among all connected
18 FTP clients, shaping each session to use only a portion of the overall rate.
19 <code>mod_shaper</code> shapes both <i>transmitted</i> traffic,
20 <i>e.g.</i> bits being downloaded via the <code>RETR</code> command, and
21 <i>received</i> traffic, <i>e.g.</i> bits being uploaded via the
22 <code>APPE</code>, <code>STOR</code>, and <code>STOU</code> commands.
23
24 <p>
25 This module is contained in the <code>mod_shaper.c</code> file for
26 ProFTPD 1.2.<i>x</i>/1.3.<i>x</i>, and is not compiled by default.
27 Installation instructions are discussed <a href="#Installation">here</a>.
28 Detailed documentation on <code>mod_shaper</code> usage can be found
29 <a href="#Usage">here</a>.
30
31 <p>
32 The most current version of <code>mod_shaper</code> is distributed with the
33 ProFTPD source code.
34
35 <h2>Author</h2>
36 <p>
37 Please contact TJ Saunders &lt;tj <i>at</i> castaglia.org&gt; with any
38 questions, concerns, or suggestions regarding this module.
39
40 <h2>Directives</h2>
41 <ul>
42 <li><a href="#ShaperAll">ShaperAll</a>
43 <li><a href="#ShaperControlsACLs">ShaperControlsACLs</a>
44 <li><a href="#ShaperEngine">ShaperEngine</a>
45 <li><a href="#ShaperLog">ShaperLog</a>
46 <li><a href="#ShaperSession">ShaperSession</a>
47 <li><a href="#ShaperTable">ShaperTable</a>
48 </ul>
49
50 <h2>Control Actions</h2>
51 <ul>
52 <li><a href="#shaper_all"><code>shaper all</code></a>
53 <li><a href="#shaper_info"><code>shaper info</code></a>
54 <li><a href="#shaper_sess"><code>shaper sess</code></a>
55 </ul>
56
57 <p>
58 <hr>
59 <h3><a name="ShaperAll">ShaperAll</a></h3>
60 <strong>Syntax:</strong> ShaperAll <em>[&quot;priority&quot; num] [&quot;rate&quot; num] [&quot;downrate&quot; num] [&quot;uprate&quot; num] [&quot;shares&quot; num] [&quot;downshares&quot; num] [&quot;upshares&quot; num]</em><br>
61 <strong>Default:</strong> ShaperAll priority 10 rate -1.0 shares 5<br>
62 <strong>Context:</strong> server config<br>
63 <strong>Module:</strong> mod_shaper<br>
64 <strong>Compatibility:</strong> 1.2.10rc1 and later
65
66 <p>
67 The <code>ShaperAll</code> directive is used to configure the overall
68 <code>mod_shaper</code> settings: the rate for the entire daemon, the
69 default shares for shaped sessions, and the default priority for shaped
70 sessions. If specified, the <em>priority</em> cannot be a negative number,
71 the <em>rates</em> are in KB/s and must be greater than zero, and the
72 <em>shares</em> must be greater than one. For configuring the priority and
73 shares for individual sessions, use the <code>ShaperSession</code> directive.
74
75 <p>
76 The <em>rate</em> parameter sets both the <em>downrate</em> (<i>i.e.</i>
77 download rate <b>from</b> the server) and the <em>uprate</em> (<i>i.e.</i> the
78 upload rate <b>to</b> the server) at the same time. Use <em>downrate</em> and
79 <em>uprate</em> if you wish to configure different rates for downloads and
80 uploads. Similarly, the <em>shares</em> parameter sets both
81 <em>downshares</em> and <em>upshares</em>.
82
83 <p>
84 The default <em>rate</em> is -1.0, which means that in order for
85 <code>mod_shaper</code> to function properly, a rate, either <em>rate</em>,
86 <em>downrate</em> or <em>uprate</em>, <b>must</b> be specified.
87 The default shares setting is 5, the default priority is 10.
88
89 <p>
90 Examples:
91 <pre>
92 # Change the overall daemon rate to 100 KB/s
93 ShaperAll rate 100
94
95 # Give 20 shares to each session by default, and have an overall rate of 1000
96 ShaperAll rate 1000 shares 20
97
98 # Have a larger number of downshares than upshares
99 ShaperAll rate 1000 downshares 2000 upshares 20
100
101 # Configure separate download and upload rates
102 ShaperAll downrate 1000 uprate 500
103 </pre>
104
105 <p>
106 See also: <a href="#ShaperSession"><code>ShaperSession</code></a>
107
108 <p>
109 <hr>
110 <h3><a name="ShaperControlsACLs">ShaperControlsACLs</a></h3>
111 <strong>Syntax:</strong> ShaperControlsACLs <em>actions|&quot;all&quot; &quot;allow&quot;|&quot;deny&quot; &quot;user&quot;|&quot;group&quot; list</em><br>
112 <strong>Default:</strong> None<br>
113 <strong>Context:</strong> server config<br>
114 <strong>Module:</strong> mod_shaper<br>
115 <strong>Compatibility:</strong> 1.2.10rc1 and later
116
117 <p>
118 The <code>ShaperControlsACLs</code> directive configures access lists of
119 <em>users</em> or <em>groups</em> who are allowed (or denied) the ability to
120 use the <em>actions</em> implemented by <code>mod_shaper</code>. The default
121 behavior is to deny everyone unless an ACL allowing access has been explicitly
122 configured.
123
124 <p>
125 If &quot;allow&quot; is used, then <em>list</em>, a comma-delimited list
126 of <em>users</em> or <em>groups</em>, can use the given <em>actions</em>; all
127 others are denied. If &quot;deny&quot; is used, then the <em>list</em> of
128 <em>users</em> or <em>groups</em> cannot use <em>actions</em> all others are
129 allowed. Multiple <code>ShaperControlsACLs</code> directives may be used to
130 configure ACLs for different control actions, and for both users and groups.
131
132 <p>
133 The <em>actions</em> provided by <code>mod_shaper</code> are &quot;all&quot;,
134 &quot;info&quot;, and &quot;sess&quot;.
135
136 <p>
137 Examples:
138 <pre>
139 # Allow only user root to alter the overall settings
140 ShaperControlsACLs all allow user root
141
142 # Allow the ftpadm group to shape current sessions
143 ShaperControlsACLs sess allow group ftpadm
144
145 # Allow everyone but user bob to see the current shaper stats
146 ShaperControlsACLs info deny user bob
147 </pre>
148
149 <p>
150 <hr>
151 <h3><a name="ShaperEngine">ShaperEngine</a></h3>
152 <strong>Syntax:</strong> ShaperEngine <em>on|off</em><br>
153 <strong>Default:</strong> off<br>
154 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
155 <strong>Module:</strong> mod_shaper<br>
156 <strong>Compatibility:</strong> 1.2.10rc1 and later
157
158 <p>
159 The <code>ShaperEngine</code> directive enables or disables the
160 &quot;shaping&quot; of sessions by <code>mod_shaper</code>. If it is set to
161 <em>off</em> this module does no shaping of transmitted traffic. Use this
162 directive to disable the module instead of commenting out all
163 <code>mod_shaper</code> directives.
164
165 <p>
166 <hr>
167 <h3><a name="ShaperLog">ShaperLog</a></h3>
168 <strong>Syntax:</strong> ShaperLog <em>path|&quot;none&quot;</em><br>
169 <strong>Default:</strong> None<br>
170 <strong>Context:</strong> server config<br>
171 <strong>Module:</strong> mod_shaper<br>
172 <strong>Compatibility:</strong> 1.2.10rc1 and later
173
174 <p>
175 The <code>ShaperLog</code> directive is used to specify a log file for
176 <code>mod_shaper</code> reporting and debugging. The <em>path</em> parameter
177 must be the full path to the file to use for logging. Note that this path must
178 <b>not</b> be to a world-writeable directory and, unless
179 <code>AllowLogSymlinks</code> is explicitly set to <em>on</em>
180 (generally a bad idea), the path must <b>not</b> be a symbolic link.
181
182 <p>
183 If <em>path</em> is &quot;none&quot;, no logging will be done at all.
184
185 <p>
186 <hr>
187 <h3><a name="ShaperSession">ShaperSession</a></h3>
188 <strong>Syntax:</strong> ShaperSession <em>[&quot;priority&quot; num] [&quot;shares&quot; +|-num] [&quot;downshares&quot; +|-num] [&quot;upshares&quot; +|-num]</em><br>
189 <strong>Default:</strong> ShaperSession priority 10<br>
190 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
191 <strong>Module:</strong> mod_shaper<br>
192 <strong>Compatibility:</strong> 1.2.10rc1 and later
193
194 <p>
195 The <code>ShaperSession</code> directive is used to set shaping data on a
196 per-session basis. It is intended to be used within <code>mod_ifsession</code>
197 conditional configuration blocks. If used, the <em>priority</em> must not
198 be a negative number. The <em>shares</em> parameters must start with '+' or
199 '-'; these values <i>adjust</i> the default numbers of shares allotted to a
200 session, increasing or reducing the sessions's shares. The
201 <code>ShaperAll</code> directive is used for configuring overall shaping
202 data.
203
204 <p>
205 The <em>shares</em> parameter sets both the <em>downshares</em> (<i>i.e.</i>
206 shares of the download rate) and the <em>upshares</em> (<i>i.e.</i> shares of
207 the upload rate) at the same time. Use <em>downshares</em> and
208 <em>upshares</em> if you wish to configure different shares for downloads and
209 uploads for the session.
210
211 <p>
212 Example:
213 <pre>
214 # Reward my friends
215 ShaperSession shares +2
216
217 # Punish my enemies
218 ShaperSession shares -4
219
220 # Allow for finer control over downloads by allocating more download
221 # shares than upload shares for this session
222 ShaperSession downshares +3 upshares -1
223
224 # Let &lt;Directory&gt;-level TransferRate directives take priority
225 ShaperSession priority 3
226 </pre>
227
228 <p>
229 See also: <a href="#ShaperAll"><code>ShaperAll</code></a>
230
231 <p>
232 <hr>
233 <h3><a name="ShaperTable">ShaperTable</a></h3>
234 <strong>Syntax:</strong> ShaperTable <em>path</em><br>
235 <strong>Default:</strong> None<br>
236 <strong>Context:</strong> server config<br>
237 <strong>Module:</strong> mod_shaper<br>
238 <strong>Compatibility:</strong> 1.2.10rc1 and later
239
240 <p>
241 The <code>ShaperTable</code> directive configures a <em>path</em> to a file
242 that <code>mod_shaper</code> uses for storing its shaping data. The given
243 <em>path</em> must be an absolute path. <b>Note</b>: this directive is
244 <b>required</b> for <code>mod_shaper</code> to function.
245
246 <p>
247 <hr>
248 <h2>Control Actions</h2>
249
250 <p>
251 <hr>
252 <h3><a name="shaper_all"><code>shaper all</code></a></h3>
253 <strong>Syntax:</strong> ftpdctl shaper all <em>[priority num] [rate num] [downrate num] [uprate num] [shares num] [downshares num] [upshares num]</em><br>
254 <strong>Purpose:</strong> Alter overall mod_shaper settings<br>
255
256 <p>
257 The <code>shaper all</code> action is used to change the overall
258 <code>mod_shaper</code> settings on-the-fly. If specified, the
259 <em>priority</em> cannot be a negative number, the <em>rates</em> are in KB/s
260 and must be greater than zero, and the <em>shares</em> must be greater than
261 one. For changing the priority and shares for individual sessions, use the
262 <code>shaper sess</code> control action.
263
264 <p>
265 The <em>rate</em> parameter sets both the <em>downrate</em> (<i>i.e.</i>
266 download rate <b>from</b> the server) and the <em>uprate</em> (<i>i.e.</i> the
267 upload rate <b>to</b> the server) at the same time. Use <em>downrate</em> and
268 <em>uprate</em> if you wish to configure different rates for downloads and
269 uploads. Similarly, the <em>shares</em> parameter sets both
270 <em>downshares</em> and <em>upshares</em>.
271
272 <p>
273 For example, to set the overall rate for the entire daemon to be 2000 KB/s:
274 <pre>
275 ftpdctl shaper all rate 2000
276 </pre>
277 To give every session 10 shares, both downshares and upshares, by default:
278 <pre>
279 ftpdctl shaper all shares 10
280 </pre>
281 To set the default priority for sessions:
282 <pre>
283 ftpdctl shaper all priority 3
284 </pre>
285 Note that multiple parameters can also be used simultaneously:
286 <pre>
287 ftpdctl shaper all rate 2000 shares 10 priority 3
288 </pre>
289
290 <p>
291 See also: <a href="#shaper_sess"><code>shaper sess</code></a>
292
293 <p>
294 <hr>
295 <h3><a name="shaper_info"><code>shaper info</code></a></h3>
296 <strong>Syntax:</strong> ftpdctl shaper info<br>
297 <strong>Purpose:</strong> Print information about current shaped sessions<br>
298
299 <p>
300 The <code>shaper info</code> control action can be used to view information
301 on currently shaped sessions. This includes the current overall rate, the
302 default number of shares per session, and the total number of currently
303 shaped sessions. It also lists the following for each shaped session:
304 process ID (PID), priority, downshare (&quot;D&quot;) and upshare
305 (&quot;U&quot;) adjustments, and session downrate and uprate.
306
307 <p>
308 Example listing:
309 <pre>
310 # ftpdctl shaper info
311 ftpdctl: Overall Rates: 1000.00 KB/s down, 500.00 KB/s up
312 ftpdctl: Default Shares Per Session: 10 down, 10 up
313 ftpdctl: Default Priority: 2
314 ftpdctl: Number of Shaped Sessions: 2
315 ftpdctl: PID Priority DShares DRate (KB/s) UShares URate (KB/s)
316 ftpdctl: ----- -------- -------------- ------------ -------------- ------------
317 ftpdctl: 21750 2 12/24 (+2) 500.00 7/14 (-3) 250.00
318 ftpdctl: 21753 2 12/24 (+2) 500.00 7/14 (-3) 250.00
319
320 </pre>
321 The &quot;DShares&quot; and &quot;UShares&quot; columns are formatted as:
322 <pre>
323 shares<sub>session</sub>/shares<sub>total</sub> (<i>+|-</i>shares<sub>adjust</sub>)
324 </pre>
325 The <code>+2</code> and <code>-3</code> in the listing above is due to a
326 <code>ShaperSession</code> affecting these sessions:
327 <pre>
328 ShaperSession downshares +2 upshares -3
329 </pre>
330
331 <p>
332 <hr>
333 <h3><a name="shaper_sess"><code>shaper sess</code></a></h3>
334 <strong>Syntax:</strong> ftpdctl shaper sess <em>class|host|user name [priority num] [shares +|-num]</em><br>
335 <strong>Purpose:</strong> Alter specific session's mod_shaper settings<br>
336
337 <p>
338 The <code>shaper sess</code> action is used to change session-specific shaping
339 data on-the-fly. If given, the <em>priority</em> must not be a
340 negative number. The <em>shares</em> parameters must start with '+' or '-';
341 these values adjust the default numbers of shares allotted to a session,
342 increasing or reducing the sessions's shares.
343
344 <p>
345 The <em>shares</em> parameter sets both the <em>downshares</em> (<i>i.e.</i>
346 shares of the download rate) and the <em>upshares</em> (<i>i.e.</i> shares of
347 the upload rate) at the same time. Use <em>downshares</em> and
348 <em>upshares</em> if you wish to configure different shares for downloads and
349 uploads for the session.
350
351 <p>
352 This example gives user <code>alex</code> an additional 10 shares:
353 <pre>
354 ftpdctl shaper sess user alex shares +10
355 </pre>
356 The following sets the priority for host <code>cache.example.com</code> such
357 that <code>TransferRate</code> directives in <code>&lt;Anonymous&gt;</code>
358 sections, <code>&lt;Directory&gt;</code> sections and <code>.ftpacccess</code>
359 files have precedence (see the <a href="#Usage">usage</a> instructions for
360 more details on priority):
361 <pre>
362 ftpdctl shaper sess host cache.example.com priority 2
363 </pre>
364 One can even change the settings on entire Classes of sessions:
365 <pre>
366 ftpdctl shaper sess class proxy downshares -3 priority 1
367 </pre>
368
369 <p>
370 See also: <a href="#shaper_all"><code>shaper all</code></a>
371
372 <p>
373 <hr>
374 <h2><a name="Installation">Installation</a></h2>
375 The <code>mod_shaper</code> module is distributed with ProFTPD. Follow the
376 usual steps for using third-party modules in ProFTPD, making sure to include
377 the <code>--enable-ctrls</code> configure option, which
378 <code>mod_shaper</code> requires:
379 <pre>
380 $ ./configure --enable-ctrls --with-modules=mod_shaper
381 </pre>
382 To build <code>mod_shaper</code> as a DSO module:
383 <pre>
384 $ ./configure --enable-ctrls --enable-dso --with-shared=mod_shaper
385 </pre>
386 Then follow the usual steps:
387 <pre>
388 $ make
389 $ make install
390 </pre>
391
392 <p>
393 Alternatively, if your <code>proftpd</code> was compiled with DSO support, you
394 can use the <code>prxs</code> tool to build <code>mod_shaper</code> as a shared
395 module:
396 <pre>
397 $ prxs -c -i -d mod_shaper.c
398 </pre>
399
400 <p>
401 <hr>
402 <h2><a name="Usage">Usage</a></h2>
403
404 <p>
405 The <code>ShaperTable</code> is used to hold overall rates, both download
406 and upload, for the entire daemon, the default number of shares and the
407 default priority for each session. Then there is a list of shaping data for
408 each particular session. To determine the portion of the overall rate that a
409 session gets, <code>mod_shaper</code> calculates the total number of shares,
410 and divides the overall rate by the total number of shares, resulting in a
411 rate-per-share value:
412 <pre>
413 rate<sub>total</sub> / shares<sub>total</sub> = rate<sub>share</sub>
414 </pre>
415 The rate for a session is then the rate-per-share multiplied by the number
416 of shares for that session:
417 <pre>
418 rate<sub>share</sub> * shares<sub>session</sub> = rate<sub>session</sub>
419 </pre>
420 Whenever a session starts or ends, <code>mod_shaper</code> recalculates the
421 total number of shares and each session's rate, thus always adjusting values
422 for each session so that the total of the session transfer rates never
423 exceeds the overall <code>mod_shaper</code> rate. This means that
424 <code>mod_shaper</code> divides the overall rate among <b>all</b> sessions
425 (unless exempted), not just those sessions that are currently transferring
426 files. Only if all shaped sessions are transferring data simultaneously will
427 the overall rates be reached. Note that this calculation is performed
428 separately for downloads and for uploads; sessions can have different shares
429 of the download and upload rates.
430
431 <p>
432 Also, the transfer rate is calculated at the start of each transfer; the core
433 <code>proftpd</code> engine does not recalculate the rate <i>during</i>
434 the data transfer. This means, for example, that if a session gets 100 KB/s
435 and starts a transfer, then a second session begins and gets 50 KB/s, the first
436 session's transfer will continue to get 100 KB/s, until that transfer ends.
437 The next transfer started by the first session would then get 50 KB/s, just
438 like the second session.
439
440 <p>
441 By default, <code>mod_shaper</code> allots 5 shares for every session.
442 Increasing the default number of shares for a session (using the
443 <code>ShaperAll</code> configuration directive or the <code>shaper all</code>
444 control action) does <b>not</b> increase the rate used by every session. If
445 every session has the same number of shares, then the overall rate is divided
446 evenly among the sessions; a higher default shares value results in a smaller
447 rate-per-share value.
448
449 <p>
450 What is the benefit of increasing the default shares setting, then? It
451 allows for finer-grained tuning of shaped sessions, using the
452 <code>ShaperSession</code> directive and the <code>shaper sess</code>
453 control actions. An example: given an overall rate of 100 KB/s, a default
454 shares of 1, and 4 sessions, the rate-per-share will be 25 KB/s
455 (100 / 4 = 25), and since each session has 1 share, the download rate for
456 each session is 25 KB/s. Now, what if you want to change these setting
457 on-the-fly, allow one of the sessions a higher transfer rate, and reduce the
458 transfer rate for another session? You could add another share to the session
459 for user <code>dave</code>:
460 <pre>
461 ftpdctl sess user dave shares +1
462 </pre>
463 After this, the rate-per-share is 20 KB/s. The session belonging to user
464 <code>dave</code> now has 2 shares, which means it has a download rate of
465 40 KB/s; the other sessions now have download rates of 20 KB/s. What about
466 reducing the rate for one of the other sessions, one belonging to user
467 <code>anonymous</code>? One might think that:
468 <pre>
469 ftpdctl sess user ftp shares -1
470 </pre>
471 would work. It will not. You cannot reduce the number of shares for a
472 given session below 1. <code>mod_shaper</code> rules do not allow this.
473 However, if the default shares setting was higher, like 5 or 10, then the
474 administrator would have enough shares for reducing a session's rate. The
475 more default shares, the smaller the rate-per-share value, and thus the
476 finer control, by adding or removing smaller increments, the administrator
477 has over the shaped sessions.
478
479 <p>
480 <code>mod_shaper</code> uses the same mechanism that the standard
481 <code>proftpd</code> configuration directive, <code>TransferRate</code>, uses
482 for controlling a session's download rate. Using the same mechanism, though,
483 means that <code>mod_shaper</code> may interfere with any
484 <code>TransferRate</code> directives in your <code>proftpd.conf</code>.
485 Which takes priority, <code>mod_shaper</code> or <code>TransferRate</code>?
486 This is handled by assigning a <i>priority</i> to each each shaped
487 session. The priority for <code>TransferRate</code> directives depends on
488 the configuration context in which the directive appears:
489 <p>
490 <b>TransferRate Priority</b><br>
491 <table border=1 summary="TransferRate Priorities">
492 <tr>
493 <td align=left><i>Context</i></td>
494 <td align=left><i>Priority</i></td>
495 </tr>
496 <tr>
497 <td align=left><code>&lt;Global&gt;</code></td>
498 <td align=right>1</td>
499 </tr>
500 <tr>
501 <td align=left>server config</td>
502 <td align=right>2</td>
503 </tr>
504 <tr>
505 <td align=left><code>&lt;VirtualHost&gt;</code></td>
506 <td align=right>2</td>
507 </tr>
508 <tr>
509 <td align=left><code>&lt;Anonymous&gt;</code></td>
510 <td align=right>3</td>
511 </tr>
512 <tr>
513 <td align=left><code>&lt;Directory&gt;</code></td>
514 <td align=right>4</td>
515 </tr>
516 <tr>
517 <td align=left><code>.ftpaccess</code></td>
518 <td align=right>5</td>
519 </tr>
520 </table>
521 <p>
522 The default priority assigned to <code>mod_shaper</code> sessions is 10.
523 This means that <code>mod_shaper</code> takes precedence over
524 <code>TransferRate</code>. However, if the site administrator needs
525 <code>&lt;Directory&gt;</code>-level or <code>.ftpaccess</code>-level
526 <code>TransferRate</code> directives to take priority, then the
527 <code>ShaperSession</code> directive and <code>shaper sess</code> control
528 action can be used to assign a priority to shaped sessions that is lower
529 than that for <code>&lt;Directory&gt;</code> and <code>.ftpaccess</code>.
530
531 <p>
532 <b>Configuring <code>mod_shaper</code></b><br>
533 Now that you know how the module works, it's time to see how to construct
534 a <code>proftpd.conf</code> that enforces the desired shaper policy.
535 Configuration directives that affect the shaping of sessions have control
536 action equivalents, <i>i.e.</i> <a href="#ShaperAll"><code>ShaperAll</code></a>
537 and <a href="#shaper_all"><code>shaper all</code></a>,
538 <a href="#ShaperSession"><code>ShaperSession</code></a> and
539 <a href="#shaper_sess"><code>shaper sess</code></a>.
540
541 <p>
542 This example <code>mod_shaper</code> configuration uses the defaults and
543 shapes all sessions:
544 <pre>
545 &lt;IfModule mod_shaper.c&gt;
546 ShaperEngine on
547 ShaperLog /var/log/ftpd/shaper.log
548 ShaperTable /var/log/ftpd/shaper.tab
549
550 # An overall rate (in KB/s) <b>must</b> be set. This line explicitly
551 # sets both the download and upload rates to be the same.
552 ShaperAll downrate 1500 uprate 1500
553
554 # Allow all system users to see shaper info
555 ShaperControlsACLs info allow user *
556
557 # Allow FTP admins to alter settings both overall and per-session
558 ShaperControlsACLs all,sess allow group ftpadm
559 &lt;/IfModule&gt;
560 </pre>
561
562 <p>
563 To exclude some user from having their sessions shaped by
564 <code>mod_shaper</code>, use <code>mod_ifsession</code> for a configuration
565 that adds the following:
566 <pre>
567 &lt;IfModule mod_shaper.c&gt;
568 &lt;IfUser lucky&gt;
569 ShaperEngine off
570 &lt;/IfUser&gt;
571 &lt;/IfModule&gt;
572 </pre>
573 which says &quot;If <code>mod_shaper</code> is present, and if the user logging
574 in is named 'lucky', then disable <code>mod_shaper</code> for this
575 session.&quot; Note that sessions that are not shaped by
576 <code>mod_shaper</code> cannot be shaped once the user has logged in. Normal
577 <code>TransferRate</code> directives will still apply to non-shaped sessions.
578
579 <p>
580 Similarly, you may wish to have a user that should have a greater portion
581 of the overall download rate available to them:
582 <pre>
583 &lt;IfModule mod_shaper.c&gt;
584 &lt;IfUser lucky&gt;
585 ShaperSession downshares +5
586 &lt;/IfUser&gt;
587 &lt;/IfModule&gt;
588 </pre>
589 This gives user <code>lucky</code> an additional 5 shares of the download rate,
590 on top of the default number of shares for a session. Users can likewise have
591 their default number of shares reduced, if necessary:
592 <pre>
593 &lt;IfModule mod_shaper.c&gt;
594 &lt;IfGroup anonftp&gt;
595 ShaperSession downshares -3
596 &lt;/IfUser&gt;
597 &lt;/IfModule&gt;
598 </pre>
599 The control actions supported by <code>mod_shaper</code> can also be used,
600 while the daemon and sessions are running, to set the desired shaping values.
601
602 <p>
603 <hr>
604 <font size=2><b><i>
605 &copy; Copyright 2004-2017 TJ Saunders<br>
606 All Rights Reserved<br>
607 </i></b></font>
608 <hr>
609
610 </body>
611 </html>