forked from Castaglia/proftpd-mod_proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod_proxy.html
1753 lines (1534 loc) · 64.1 KB
/
mod_proxy.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<title>ProFTPD module mod_proxy</title>
</head>
<body bgcolor=white>
<hr>
<center>
<h2><b>ProFTPD module <code>mod_proxy</code></b></h2>
</center>
<hr><br>
<p>
The purpose of the <code>mod_proxy</code> module is to provide FTP proxying
capabilities in <code>proftpd</code>, both <em>reverse</em> (or "gateway")
proxying and <em>forward</em> proxying.
<p>
Installation instructions are discussed <a href="#Installation">here</a>.
<b>Note</b> that <code>mod_proxy</code> requires ProFTPD 1.3.6rc2 or later.
Detailed notes on best practices for using this module are
<a href="#Usage">here</a>.
<p>
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/).
<p>
This product includes cryptographic software written by Eric Young (eay@cryptsoft.com).
<p>
The most current version of <code>mod_proxy</code> can be found at:
<pre>
<a href="https://github.com/Castaglia/proftpd-mod_proxy.git">https://github.com/Castaglia/proftpd-mod_proxy.git</a>
</pre>
<h2>Author</h2>
<p>
Please contact TJ Saunders <tj <i>at</i> castaglia.org> with any
questions, concerns, or suggestions regarding this module.
<h2>Thanks</h2>
<p>
<i>2015-08-24</i>: Thanks to Michael Toth <mtoth <i>at</i> queldor.net>
for helping test multiple iterations of <code>mod_proxy</code> with IIS
servers.
<h2>Directives</h2>
<ul>
<li><a href="#ProxyDataTransferPolicy">ProxyDataTransferPolicy</a>
<li><a href="#ProxyDatastore">ProxyDatastore</a>
<li><a href="#ProxyEngine">ProxyEngine</a>
<li><a href="#ProxyForwardEnabled">ProxyForwardEnabled</a>
<li><a href="#ProxyForwardMethod">ProxyForwardMethod</a>
<li><a href="#ProxyForwardTo">ProxyForwardTo</a>
<li><a href="#ProxyLog">ProxyLog</a>
<li><a href="#ProxyOptions">ProxyOptions</a>
<li><a href="#ProxyReverseConnectPolicy">ProxyReverseConnectPolicy</a>
<li><a href="#ProxyReverseServers">ProxyReverseServers</a>
<li><a href="#ProxyRetryCount">ProxyRetryCount</a>
<li><a href="#ProxyRole">ProxyRole</a>
<li><a href="#ProxySourceAddress">ProxySourceAddress</a>
<li><a href="#ProxyTables">ProxyTables</a>
<li><a href="#ProxyTimeoutConnect">ProxyTimeoutConnect</a>
<li><a href="#ProxyTimeoutLinger">ProxyTimeoutLinger</a>
<li><a href="#ProxyTLSCACertificateFile">ProxyTLSCACertificateFile</a>
<li><a href="#ProxyTLSCACertificatePath">ProxyTLSCACertificatePath</a>
<li><a href="#ProxyTLSCARevocationFile">ProxyTLSCARevocationFile</a>
<li><a href="#ProxyTLSCARevocationPath">ProxyTLSCARevocationPath</a>
<li><a href="#ProxyTLSCertificateFile">ProxyTLSCertificateFile</a>
<li><a href="#ProxyTLSCertificateKeyFile">ProxyTLSCertificateKeyFile</a>
<li><a href="#ProxyTLSCipherSuite">ProxyTLSCipherSuite</a>
<li><a href="#ProxyTLSEngine">ProxyTLSEngine</a>
<li><a href="#ProxyTLSOptions">ProxyTLSOptions</a>
<li><a href="#ProxyTLSPreSharedKey">ProxyTLSPreSharedKey</a>
<li><a href="#ProxyTLSProtocol">ProxyTLSProtocol</a>
<li><a href="#ProxyTLSTimeoutHandshake">ProxyTLSTimeoutHandshake</a>
<li><a href="#ProxyTLSTransferProtectionPolicy">ProxyTLSTransferProtectionPolicy</a>
<li><a href="#ProxyTLSVerifyServer">ProxyTLSVerifyServer</a>
</ul>
<p>
<hr>
<h3><a name="ProxyDataTransferPolicy">ProxyDataTransferPolicy</a></h3>
<strong>Syntax:</strong> ProxyDataTransferPolicy <em>client|active|passive|pasv|epsv|port|eprt</em><br>
<strong>Default:</strong> ProxyDataTransferPolicy client<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc1 and later
<p>
The <code>ProxyDataTransferPolicy</code> directive configures the data
transfer <em>policy</em> that <code>mod_proxy</code> uses when performing
data transfers (<i>e.g.</i> file uploads/downloads, directory listings) with
the backend/destination server.
<p>
The currently supported policies are:
<ul>
<li><code>client</code>
<p>
This policy indicates that <code>mod_proxy</code> will use whatever
the connected client uses. Thus if the client sends <code>PORT</code>,
<code>mod_proxy</code> will send <code>PORT</code> to the
backend/destination server.
<p>
This is the <em>recommended policy</em> in most cases.
</li>
<p>
<li><code>active</code>
<p>
Regardless of the commands sent by the client, <code>mod_proxy</code>
will use only <em>active</em> data transfers (<i>i.e.</i> using
<code>PORT</code> commands) with the backend/destination server.
</li>
<p>
<li><code>passive</code>
<p>
Regardless of the commands sent by the client, <code>mod_proxy</code>
will use only <em>passive</em> data transfers (<i>i.e.</i> using
<code>PASV</code> commands) with the backend/destination server.
</li>
<p>
<li><code>PASV</code>
<p>
Regardless of the commands sent by the client, <code>mod_proxy</code>
will use only <code>PASV</code> commands with the backend/destination
server.
</li>
<p>
<li><code>PORT</code>
<p>
Regardless of the commands sent by the client, <code>mod_proxy</code>
will use only <code>PORT</code> commands with the backend/destination
server.
</li>
<p>
<li><code>EPSV</code>
<p>
Regardless of the commands sent by the client, <code>mod_proxy</code>
will use only <code>EPSV</code> commands with the backend/destination
server.
</li>
<p>
<li><code>EPRT</code>
<p>
Regardless of the commands sent by the client, <code>mod_proxy</code>
will use only <code>EPRT</code> commands with the backend/destination
server.
</li>
</ul>
<p>
<hr>
<h3><a name="ProxyDatastore">ProxyDatastore</a></h3>
<strong>Syntax:</strong> ProxyDatastore <em>type [info]</em><br>
<strong>Default:</strong> ProxyDatastore SQLite<br>
<strong>Context:</strong> server config<br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc1 and later
<p>
The <code>ProxyDatastore</code> directive configures the <em>type</em> of
datastore that <code>mod_proxy</code> uses for persistence. The currently
supported datastore <em>types</em> are:
<ul>
<li>Redis
<li>SQLite
</ul>
<p>
<b>Note</b> that the Redis <em>type</em> also requires the <em>info</em>
paramter, namely a prefix for all of the Redis keys. This prefix <b>must</b>
be different/unique among all of your <code>mod_proxy</code> servers using
that Redis server/cluster; the prefix is used to keep all of the data
<i>for this server</i> separate from all other servers. For example:
<pre>
<IfModule mod_proxy.c>
...
<IfModule mod_redis.c>
# Use our IP address as our prefix
ProxyDatastore Redis 1.2.3.4.
</IfModule>
</IfModule>
</pre>
<p>
<hr>
<h3><a name="ProxyEngine">ProxyEngine</a></h3>
<strong>Syntax:</strong> ProxyEngine <em>on|off</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc1 and later
<p>
The <code>ProxyEngine</code> directive toggles the support for proxying by
<code>mod_proxy</code>. This is usually used inside a
<code><VirtualHost></code> section to enable proxying of FTP sessions for
a particular virtual host. By default <code>mod_proxy</code> is disabled for
both the main server and all configured virtual hosts.
<p>
<hr>
<h3><a name="ProxyForwardEnabled">ProxyForwardEnabled</a></h3>
<strong>Syntax:</strong> ProxyForwardEnabled <em>on|off</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> <code><Class></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc2 and later
<p>
The <code>ProxyForwardEnabled</code> directive determines whether a client
can use <code>mod_proxy</code> for forward proxying, based on that client's
<a href="http://www.proftpd.org/docs/howto/Classes.html">class</a>.
<p>
By default, <code>mod_proxy</code> rejects any forward proxy request from
<b>any</b> client, with the exception of clients connecting from
<a href="http://www.faqs.org/rfcs/rfc1918.html">RFC 1918</a> addresses:
<pre>
192.168.0.0/16
172.16.0.0/12
10.0.0.0/8
</pre>
This is done as a security measure: <b>open/unrestricted proxy servers are
dangerous both to your network and to the Internet at large</b>. Thus to make
it possible for clients to use your server for forward proxying, they <b>must
be explicitly</b> enabled to do so.
<p>
Example:
<pre>
<Class forward-proxy>
From 1.2.3.4/12
# Allow clients from this class to use FTP forward proxying
ProxyForwardEnabled on
</Class>
</pre>
<p>
See also: <a href="#ProxyForwardTo"><code>ProxyForwardTo</code></a>
<p>
<hr>
<h3><a name="ProxyForwardMethod">ProxyForwardMethod</a></h3>
<strong>Syntax:</strong> ProxyForwardMethod <em>method</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc1 and later
<p>
The <code>ProxyForwardMethod</code> directive configures the <em>method</em>
that clients can use for requesting forward proxying. Some methods require
that the client authenticate <em>to the proxy first</em>, and then separately
authenticate to the destination server; these methods differ on just when
the client specifies the destination server. Other methods do not require
proxy authentication. There are many variations on a theme with these methods.
<p>
The currently supported methods are:
<ul>
<li><code>proxyuser,user@host</code>
<p>
This method indicates that proxy authentication is <b>required</b>. The
client first authenticates to the proxy via <code>USER/PASS</code> commands:
<pre>
USER <em>proxy-user</em>
PASS <em>proxy-passwd</em>
</pre>
Then the client authenticates <i>again</i>, this time including the
address (and optionally port) of the destination server as part of the
second <code>USER</code> command:
<pre>
USER <em>real-user</em>@ftp.example.com
PASS <em>real-passwd</em>
</pre>
The <code>mod_proxy</code> module will remove the destination address
portion of the second <code>USER</code> command before proxying it to
the destination server.
</li>
<p>
<li><code>proxyuser@host,user</code>
<p>
This method indicates that proxy authentication is <b>required</b>. The
client first authenticates to the proxy via <code>USER/PASS</code> commands;
note that the destination address (and optionally port) is included as part
of the first <code>USER</code> command:
<pre>
USER <em>proxy-user</em>@ftp.example.com
PASS <em>proxy-passwd</em>
</pre>
Then the client authenticates <i>again</i>, this time sending the
<code>USER/PASS</code> commands to authenticate to the destination server:
<pre>
USER <em>real-user</em>
PASS <em>real-passwd</em>
</pre>
</li>
<p>
<li><code>user@host</code>
<p>
This methods indicates that <i>no proxy authentication</i> is used. The
client indicates the destination address (and optionally port) of the
server as part of the <code>USER</code> command:
<pre>
USER <em>real-user</em>@ftp.example.com
PASS <em>real-passwd</em>
</pre>
The <code>mod_proxy</code> module will remove the destination address
portion of the <code>USER</code> command before proxying it to the
destination server.
</li>
</ul>
<p>
Configuring the FTP client's proxy settings to match the above methods varies
greatly, depending on the FTP client.
<p>
<hr>
<h3><a name="ProxyForwardTo">ProxyForwardTo</a></h3>
<strong>Syntax:</strong> ProxyForwardTo <em>[!]pattern [flags]</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc1 and later
<p>
The <code>ProxyForwardTo</code> directive is used to restrict which
hosts/domains can be requested for forward proxying. The destination host/port
for forward proxying <b>must</b> match the configured <em>pattern</em>
regular expression, or the forward proxying request will fail.
<p>
The optional <em>flags</em> parameter, if present, modifies how the given
<em>pattern</em> will be evaludated. The supported flags are:
<ul>
<li><b>nocase|NC</b> (<b>n</b>o <b>c</b>ase)<br>
This makes the <em>pattern</em> case-insensitive, <i>i.e.</i> there is
no difference between 'A-Z' and 'a-z' when <em>pattern</em> is matched
against the path
</li>
</ul>
<p>
<code>ProxyForwardTo</code> limits the destination hosts <b>to</b> which
clients can request forward proxying; by contrast,
<a href="#ProxyForwardEnabled"><code>ProxyForwardEnabled</code></a> controls
forward proxying based on where clients connect <b>from</b>.
<p>
<hr>
<h3><a name="ProxyLog">ProxyLog</a></h3>
<strong>Syntax:</strong> ProxyLog <em>path|"none"</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc1 and later
<p>
The <code>ProxyLog</code> directive is used to specify a log file for
<code>mod_proxy</code>'s reporting on a per-server basis. The <em>path</em>
parameter given must be the full path to the file to use for logging.
<p>
Note that this path must <b>not</b> be to a world-writable directory and,
unless <code>AllowLogSymlinks</code> is explicitly set to <em>on</em>
(generally a bad idea), the path must <b>not</b> be a symbolic link.
<p>
<hr>
<h3><a name="ProxyOptions">ProxyOptions</a></h3>
<strong>Syntax:</strong> ProxyOptions <em>opt1 ...</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc1 and later
<p>
The <code>ProxyOptions</code> directive is used to configure various optional
behavior of <code>mod_proxy</code>. For example:
<pre>
ProxyOptions UseProxyProtocol
</pre>
<p>
The currently implemented options are:
<ul>
<li><code>ShowFeatures</code><br>
<p>
When reverse proxing, <code>mod_proxy</code> defaults to not responding to
the FTP <code>FEAT</code> command, which is used to determine the supported
features/capabilities of the FTP server; this is done to prevent leaking
of information about internal FTP servers to the outside world. However,
some clients rely on the <code>FEAT</code> data. For such clients/use
cases, use this option to tell <code>mod_proxy</code> to proxy the
<code>FEAT</code> command/response to the backend server.
</li>
<p>
<li><code>UseDirectDataTransfers</code><br>
<p>
The <code>mod_proxy</code> module will, by default, proxy all data transfers
through the proxy server. Some sites may wish to have the FTP data
transfers occur directly between the frontend client and the backend server,
to avoid the latency/overhead of the proxying. Use this option to
enable these direct data transfers (akin to <b>D</b>irect <b>S</b>erver
<b>R</b>eturn, or DSR), for both forward and reverse proxy roles:
<pre>
# Enable data transfers directly from frontend client to/from backend server
ProxyOptions UseDirectDataTransfers
</pre>
</li>
<p>
<li><code>UseProxyProtocol</code><br>
<p>
When <code>mod_proxy</code> connects to the backend/destination server,
use the <a href="http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt"><code>PROXY</code></a> protocol, sending the human-readable <code>PROXY</code>
command to the destination server. This allows backend servers to implement
access controls/logging, based on the IP address of the connecting client.
The <a href="https://github.com/Castaglia/proftpd-mod_proxy_protocol"><code>mod_proxy_protocol</code></a>
ProFTPD module can be used to handle the <code>PROXY</code> command on
the receiving side, <i>i.e.</i> when using <code>proftpd</code> as the
backend/destination server.
<p>
<b>Note</b>: do <b>not</b> use this option unless the backend server
<em>does</em> support the <code>PROXY</code> protocol. Otherwise, the
<code>PROXY</code> protocol message will only confuse the backend server,
possibly leading to connection/login failures.
</li>
<p>
<li><code>UseReverseProxyAuth</code><br>
<p>
When reverse proxying, <code>mod_proxy</code> delegates user authentication
to the selected backend server. However, there are some sites which need
to centralize user authentication in the proxy; use this option to require
proxy authentication for such cases. <b>Note</b> that this option
<b>only</b> pertains to reverse proxy connections; proxy authentication
when forward proxying is determined by the <code>ProxyForwardMethod</code>
directive.
</li>
</ul>
<p>
<hr>
<h3><a name="ProxyRetryCount">ProxyRetryCount</a></h3>
<strong>Syntax:</strong> ProxyRetryCount <em>count</em><br>
<strong>Default:</strong> ProxyRetryCount 5<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc1 and later
<p>
The <code>ProxyRetryCount</code> directive configures the number of times
<code>mod_proxy</code> will attempt to connect to the backend/destination
server. The default is <em>5</em> attempts.
<p>
<hr>
<h3><a name="ProxyReverseConnectPolicy">ProxyReverseConnectPolicy</a></h3>
<strong>Syntax:</strong> ProxyReverseConnectPolicy <em>policy</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc1 and later
<p>
The <code>ProxyReverseConnectPolicy</code> directive configures the
<em>policy</em> that <code>mod_proxy</code> will use for selecting the backend
server when reverse proxying.
<p>
The currently supported policies are:
<ul>
<li><code>LeastConns</code>
<p>
Select the backend server with the lowest number of proxied connections.
</li>
<p>
<li><code>LeastResponseTime</code>
<p>
Select the backend server with the least response time; this is determined
based on the connect time to the backend server, and its number of
current connections.
</li>
<p>
<li><code>PerGroup</code>
<p>
Select a backend server based on the primary group of the authenticated
<code>USER</code> name used by the connecting client; any future
connections using that same <code>USER</code> name will be routed to the
same backend server.
<p>
<b>Note</b>: use of this <code>ProxyReverseConnectPolicy</code> also
<b>requires</b> use of the <code>UseReverseProxyAuth</code>
<code>ProxyOption</code>, as authenticating the given <code>USER</code>
name is required for discovering the primary group of that user.
</li>
<p>
<li><code>PerHost</code>
<p>
Select a backend server based on the IP address of the connecting client;
any future connections from that IP address will be routed to the same
backend server.
</li>
<p>
<li><code>PerUser</code>
<p>
Select a backend server based on the <code>USER</code> name used by the
connecting client; any future connections using that same <code>USER</code>
name will be routed to the same backend server.
</li>
<p>
<li><code>Random</code>
<p>
Randomly select any of the backend servers.
</li>
<p>
<li><code>RoundRobin</code>
<p>
Select the next backend server in the list.
</li>
<p>
<li><code>Shuffle</code>
<p>
Similar to the <code>Random</code> policy, except the selection happens
from the not-yet-chosed backend servers. This means that <b>all</b>
backend servers will eventually be used evenly, just in a random order.
</li>
</ul>
<p>
<hr>
<h3><a name="ProxyReverseServers">ProxyReverseServers</a></h3>
<strong>Syntax:</strong> ProxyReverseServers <em>servers</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc1 and later
<p>
The <code>ProxyReverseServers</code> directive configures the list of servers
to be used as the backend servers for reverse proxying.
<p>
Each server <b>must</b> be configured as a <i>URL</i>. Only the "ftp" scheme
is currently supported. If not specified, the port will be 21. IPv6 addresses
<b>must</b> be enclosed within square brackets. Thus, for example, the
following are all valid URLs:
<pre>
ftp://<em>ftp1.example.com:2121</em>
ftp://<em>1.2.3.4</em>
ftp://<em>[::ffff:6.7.8.9]:2121</em>
</pre>
And using them all in the configuration would look like:
<pre>
ProxyReverseServers ftp://ftp1.example.com:2121 ftp://1.2.3.4 ftp://[::ffff:6.7.8.9]:2121
</pre>
<p>
The backend servers can <i>also</i> be contained in a list in a JSON file,
<i>e.g.</i>:
<pre>
[
"ftp://ftp1.example.com:2121",
"ftp://[::ffff:6.7.8.9]:2121"
]
</pre>
You then only need to configure the path to that JSON file:
<pre>
ProxyReverseServers file:/path/to/backends.json
</pre>
<p>
The backend servers can <i>also</i> be provided from an external SQL database,
queried by <code>mod_proxy</code> via <a href="http://www.proftpd.org/docs/contrib/mod_sql.html#SQLNamedQuery"><code>SQLNamedQuery</code></a>. For example,
<i>assuming</i> a schema such as this:
<pre>
CREATE TABLE proxy_user_servers (
user_name TEXT,
url TEXT
);
CREATE INDEX proxy_user_servers_name_idx ON proxy_user_servers (user_name);
</pre>
where <em>url</em> contains URLs, <i>e.g.</i> "ftp://1.2.3.4:21". Then you
would configure <code>mod_proxy</code> to query for those per-user backend URLs
using <code>ProxyReverseServers</code> like this:
<pre>
<IfModule mod_sql.c>
...
SQLNamedQuery get-user-servers SELECT "url FROM proxy_user_servers WHERE user_name = %{0}"
</IfModule>
ProxyRole reverse
ProxyReverseConnectPolicy PerUser
ProxyReverseServers sql:/get-user-servers
</pre>
<p>
Given that <code>mod_proxy</code> uses SQLite, does that mean that the table
used for storing these per-user URLs <b>must</b> be SQLite? <b>No</b>. The
use of <code>SQLNamedQuery</code> means that <b>any database</b>, supported
by <code>mod_sql</code>, can be used.
<p>
<hr>
<h3><a name="ProxyRole">ProxyRole</a></h3>
<strong>Syntax:</strong> ProxyRole <em>role</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc1 and later
<p>
The <code>ProxyRole</code> directive configures whether <code>mod_proxy</code>
will perform forward or reverse proxying. The list of supported <em>roles</em>
are thus:
<ul>
<li><code>forward</code>
<p>
Perform forward proxying.
</li>
<p>
<li><code>reverse</code>
<p>
Perform reverse proxying.
</li>
</ul>
<p>
<b>Note</b> that the <code>ProxyRole</code> directive is <b>required</b>
for <code>mod_proxy</code> to function. If this directive is not configured,
connections to <code>mod_proxy</code> will fail.
<p>
<hr>
<h3><a name="ProxySourceAddress">ProxySourceAddress</a></h3>
<strong>Syntax:</strong> ProxySourceAddress <em>address</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc1 and later
<p>
The <code>ProxySourceAddress</code> directive configures the <em>address</em>
(or <em>device name</em>) of a network interface on the host machine, to
be used when connecting to the backend/destination server. This directive
is most useful on a multi-homed (or DMZ) host; frontend connections can
be received on one network interface, and the backend connections can use
a different network interface. Imagine <i>e.g.</i> separate WAN/LAN interfaces
on a proxying host.
<p>
<hr>
<h3><a name="ProxyTables">ProxyTables</a></h3>
<strong>Syntax:</strong> ProxyTables <em>table-info</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config<br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc1 and later
<p>
The <code>ProxyTables</code> directive is used to specify a directory that
<code>mod_proxy</code> will use for storing its database files; these files
are used for tracking the various load balancing/healthcheck statistics used
for proxying.
<p>
<b>Note</b> that the <code>ProxyTables</code> directive is <b>required</b>
for <code>mod_proxy</code> to function. If this directive is not configured,
connections to <code>mod_proxy</code> will fail.
<p>
<hr>
<h3><a name="ProxyTimeoutConnect">ProxyTimeoutConnect</a></h3>
<strong>Syntax:</strong> ProxyTimeoutConnect <em>timeout</em><br>
<strong>Default:</strong> ProxyTimeoutConnect 5sec<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc1 and later
<p>
The <code>ProxyTimeoutConnect</code> directive configures the amount of time
that <code>mod_proxy</code> will wait for the backend/destination server to
accept a TCP connection, before giving up.
<p>
Note that if there are many different backend/destination servers to try
(due to <i>e.g.</i> <code>ProxyRetryCount</code>), <i>and</i> if those
backend servers are slow, the connecting client might itself see connection
timeouts to <code>mod_proxy</code>. To guard against such slow backend
servers, a more aggressively short timeout can be used:
<pre>
ProxyTimeoutConnect 1sec
</pre>
<p>
<hr>
<h3><a name="ProxyTimeoutLinger">ProxyTimeoutLinger</a></h3>
<strong>Syntax:</strong> ProxyTimeoutLinger <em>timeout</em><br>
<strong>Default:</strong> ProxyTimeoutLinger 3sec<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc1 and later
<p>
The <code>ProxyTimeoutLinger</code> directive configures the amount of time
that <code>mod_proxy</code> will wait (<em>lingering</em>), after receiving
all of the data on the data transfer connection to the backend server, for the
explicit "end of transfer" response from the backend server, before giving up.
<p>
<hr>
<h3><a name="ProxyTLSCACertificateFile">ProxyTLSCACertificateFile</a></h3>
<strong>Syntax:</strong> ProxyTLSCACertificateFile <em>path</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc2 and later
<p>
The <code>ProxyTLSCACertificateFile</code> directive configures one file where
you can assemble the certificates of Certification Authorities (CA) which will
be used to verify the servers' certificates. Such a file is merely the
concatenation of the various PEM-encoded CA certificates. This directive can
be used in addition to, or as an alternative for,
<code>ProxyTLSCACertificatePath</code>.
<p>
Example:
<pre>
ProxyTLSCACertificateFile /etc/ftpd/cacerts.pem
</pre>
<p>
<b>Note</b> that the location of CA certificates is <b>required</b> for
<code>mod_proxy</code>'s TLS support; verification of server certificates
is required for secure connections to backend/destination servers. For
this reason, <code>mod_proxy</code> ships with its own default
<code>ProxyTLSCACertificateFile</code>, which is generated using <code>libcurl</code>'s <code>mk-ca-bundle.pl</code> script:
<pre>
$ lib/mk-ca-bundle.pl -u cacerts.pem
</pre>
<p>
<hr>
<h3><a name="ProxyTLSCACertificatePath">ProxyTLSCACertificatePath</a></h3>
<strong>Syntax:</strong> ProxyTLSCACertificatePath <em>directory</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc2 and later
<p>
The <code>ProxyTLSCACertificatePath</code> directive sets the directory for the
certificates of Certification Authorities (CAs); these are used to verify the
server certificates presented. This directive may be used in addition to, or
as alternative for, <code>ProxyTLSCACertificateFile</code>.
<p>
The files in the configured directory have to be PEM-encoded, and are accessed
through hash filenames. This means one cannot simply place the CA certificates
there: one also has to create symbolic links named <i>hash-value</i>.N. The
<code>c_rehash</code> utility that comes with OpenSSL can be used to create
the necessary symlinks.
<p>
Example:
<pre>
ProxyTLSCACertificatePath /etc/ftpd/cacerts/
</pre>
<p>
<hr>
<h3><a name="ProxyTLSCARevocationFile">ProxyTLSCARevocationFile</a></h3>
<strong>Syntax:</strong> ProxyTLSCACertificateFile <em>path</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc2 and later
<p>
The <code>ProxyTLSCARevocationFile</code> directive configures one file that can
contain the Certificate Revocation Lists (CRL) of Certification Authorities
(CA); these CRLs are used during the verification of server certificates. Such
a file is merely the concatenation of the various PEM-encoded CRL files. This
directive can be used in addition to, or as an alternative for,
<code>ProxyTLSCARevocationPath</code>.
<p>
Example:
<pre>
ProxyTLSCARevocationFile /etc/ftpd/cacrls.pem
</pre>
<p>
<hr>
<h3><a name="ProxyTLSCARevocationPath">ProxyTLSCARevocationPath</a></h3>
<strong>Syntax:</strong> ProxyTLSCARevocationPath <em>directory</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc2 and later
<p>
The <code>ProxyTLSCARevocationPath</code> directive sets the directory for the
Certificate Revocation Lists (CRL) of Certification Authorities (CAs); these
are used during the verification of server certificates. This directive may
be used in addition to, or as alternative for,
<code>ProxyTLSCARevocationFile</code>.
<p>
The files in the configured directory have to be PEM-encoded, and are accessed
through hash filenames. This means one cannot simply place the CRLs there:
one also has to create symbolic links named <i>hash-value</i>.N. The
<code>c_rehash</code> utility that comes with OpenSSL can be used to create
the necessary symlinks.
<p>
Example:
<pre>
ProxyTLSCARevocationPath /etc/ftpd/cacrls/
</pre>
<p>
<hr>
<h3><a name="ProxyTLSCertificateFile">ProxyTLSCertificateFile</a></h3>
<strong>Syntax:</strong> ProxyTLSCertificateFile <em>path</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc2 and later
<p>
The <code>ProxyTLSCertificateFile</code> directive points to the PEM-encoded
file containing the <em>client</em> certificate file, and optionally also
the corresponding private key. <em>Note</em> that this directive is only
needed for backend/target FTPS servers which require client authentication.
<p>
Example:
<pre>
ProxyTLSCertificateFile /etc/ftpd/client-cert.pem
</pre>
<p>
<hr>
<h3><a name="ProxyTLSCertificateKeyFile">ProxyTLSCertificateKeyFile</a></h3>
<strong>Syntax:</strong> ProxyTLSCertificateKeyFile <em>path</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc2 and later
<p>
The <code>ProxyTLSCertificateKeyFile</code> directive points to the PEM-encoded
file containing the <em>client</em> certificate file, and optionally also
<p>
The <code>ProxyTLSCertificateKeyFile</code> directive points to the PEM-encoded
private key file for the client certificate indicated by
<code>ProxyTLSCertificateFile</code>. If the private key is not combined with
the certificate in the <code>ProxyTLSCertificateFile</code>, use this additional
directive to point to the file with the standalone private key. When
<code>ProxyTLSCertificateFile</code> is used and the file contains both the
certificate and the private key, this directive need not be used. <b>However,
this practice is strongly discouraged</b>. Instead we recommend you to separate
the certificate and the private key.
<p>
<hr>
<h3><a name="ProxyTLSCipherSuite">ProxyTLSCipherSuite</a></h3>
<strong>Syntax:</strong> ProxyTLSCipherSuite <em>cipher-list</em><br>
<strong>Default:</strong> ProxyTLSCipherSuite DEFAULT:!ADH:!EXPORT:!DES<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc2 and later
<p>
The <code>ProxyTLSCipherSuite</code> directive configures the list of
acceptable SSL/TLS ciphersuites to use for backend SSL/TLS connections. The
syntax is that of the OpenSSL <code>ciphers</code> command, <i>e.g.</i>:
<pre>
$ openssl ciphers -v <em><cipher-list></em>
</pre>
may be used to list all of the ciphers and the order described by a specific
<em><cipher-list></em>.
<p>
<hr>
<h3><a name="ProxyTLSEngine">ProxyTLSEngine</a></h3>
<strong>Syntax:</strong> ProxyTLSEngine <em>on|off|auto</em><br>
<strong>Default:</strong> ProxyTLSEngine auto<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc2 and later
<p>
The <code>ProxyTLSEngine</code> directive configures the use of SSL/TLS for
<em>backend</em> FTP connections. The supported values are:
<ul>
<li><em>on</em>
<p>
Use of SSL/TLS is <b>required</b>; backend servers which do not support
SSL/TLS <b>or</b> which fail the SSL/TLS handshake will cause the proxied
session to be closed.
</li>
<p>
<li><em>off</em>
<p>
Use of SSL/TLS is <b>disabled</b>; backend servers which do support SSL/TLS
will be ignored, and only FTP will be used.
</li>
<p>
<li><em>auto</em>
<p>
Use of SSL/TLS will be <b>automatically</b> used if the backend server
supports SSL/TLS (via <code>AUTH TLS</code> in its <code>FEAT</code>
response). If the SSL/TLS handshake fails, the backend connection will
proceed using plain FTP.
<p>
<b>Note</b>: this is the default behavior in <code>mod_proxy</code>.
</li>
</ul>
<p>
<hr>
<h3><a name="ProxyTLSOptions">ProxyTLSOptions</a></h3>
<strong>Syntax:</strong> ProxyTLSOptions <em>options</em><br>
<strong>Default:</strong> None<br>
<strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> 1.3.6rc2 and later
<p>
The <code>ProxyTLSOptions</code> directive is used to configure various
optional SSL/TLS behavior of <code>mod_proxy</code>.
<p>
Example:
<pre>
ProxyTLSOptions EnableDiags
</pre>
<p>
The currently implemented options are:
<ul>
<li><code>EnableDiags</code>
<p>
Sets callbacks in the OpenSSL library such that <b>a lot</b> of
SSL/TLS protcol information is logged to the
<a href="#ProxyLog"><code>ProxyLog</code></a> file. This option is
<b>very</b> useful when debugging strange interactions with FTPS servers.
</li>
<p>
<li><code>NoSessionCache</code>
<p>
By default, when using SSL/TLS, <code>mod_proxy</code> will <em>cache</em>
the negotiated SSL sessions in its local database, for reuse in enabling
SSL session resumption in future connections to those hosts. Use this
option to <b>disable</b> use of session caching if/when needed.
</li>
<p>
<li><code>NoSessionTickets</code>
<p>
By default, when using SSL/TLS, <code>mod_proxy</code> will <em>cache</em>
any <a href="http://www.faqs.org/rfcs/rfc5077.html">session tickets</a>
offered by the server in its local database, for reuse in enabling