~ubuntu-branches/ubuntu/trusty/proftpd-dfsg/trusty

« back to all changes in this revision

Viewing changes to doc/howto/TLS.html

  • Committer: Bazaar Package Importer
  • Author(s): Francesco Paolo Lovergine
  • Date: 2011-10-06 12:57:29 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20111006125729-wiq6d3yzf2ensafj
Tags: 1.3.4~rc3-1
* New upstream pre-release.
* Refreshed all patches.
* Changed patch xferstats.holger-preiss to fix a few warnings and use
  Getopt::Std instead of the old getopts.pl which will be removed soon or
  later in perl5. Thanks lintian.
* Policy bumped to 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!-- $Id: TLS.html,v 1.27 2011/03/25 01:24:12 castaglia Exp $ -->
 
1
<!-- $Id: TLS.html,v 1.30 2011/05/11 16:09:24 castaglia Exp $ -->
2
2
<!-- $Source: /cvsroot/proftp/proftpd/doc/howto/TLS.html,v $ -->
3
3
 
4
4
<html>
26
26
from SourceForge.
27
27
 
28
28
<p>
29
 
Example <a href="http://www.castaglia.org/proftpd/modules/mod_tls.html"><code>mod_tls</code></a> configuration:
 
29
Example <a href="../contrib/mod_tls.html"><code>mod_tls</code></a> configuration:
30
30
<pre>
 
31
  &lt;IfModule mod_dso.c&gt;
 
32
    <font color=green># If mod_tls was built as a shared/DSO module, load it
 
33
    LoadModule mod_tls.c
 
34
  &lt;/IfModule&gt;
 
35
 
31
36
  &lt;IfModule mod_tls.c&gt;
32
37
    TLSEngine on
33
38
    TLSLog /var/ftpd/tls.log
327
332
 
328
333
<p><a name="TLSProtection">
329
334
<font color=red>Question</font>: Does FTPS protect both the control connection
330
 
<i>and</i> the data connections?<br>
 
335
<b>and</b> the data connections?<br>
331
336
<font color=blue>Question</font>: Short answer: yes.
332
337
 
333
338
<p>
581
586
security requirements you have configured on the server.
582
587
 
583
588
<p>
 
589
The following may also appear in the <code>TLS</code> for any data
 
590
transfers (which include directory listings):
 
591
<pre>
 
592
  client did not reuse SSL session, rejecting data connection (see the NoSessionReuseRequired TLSOptions parameter
 
593
</pre>
 
594
This message appears because an additional security restriction that was
 
595
added in ProFTPD 1.3.3rc1.  The <a href="../contrib/mod_tls.html#TLSOptions"><code>TLSOptions</code></a> documentation for this "NoSessionReuseRequired" option
 
596
describes the situation in more detail.
 
597
 
 
598
<p>
584
599
You may also see the following appear in the <code>TLSLog</code> on occasion:
585
600
<pre>
586
601
  PROT: unwilling to accept security parameter (C), declining
590
605
with a security parameter of <code>C</code>, meaning &quot;Clear&quot;,
591
606
which effectively tells the server not to protect data transfers.  The
592
607
<code>mod_tls</code> module will refuse the <code>C</code> security parameter
593
 
if, like above, there is &quot;TLSRequired on&quot in your
 
608
if, like above, there is &quot;TLSRequired on&quot; in your
594
609
<code>proftpd.conf</code>.  This case also indicates a disagreement between
595
610
the client's security expectations and the security policy you have configured
596
611
on the server.
597
612
 
 
613
<p><a name="TLSErrorAfterLargeUpload">
 
614
<font color=red>Question</font>: Using FTPS, after uploading a very large file,
 
615
my next directory listing fails:
 
616
<pre>
 
617
  425 Unable to build data connection: Operation not permitted
 
618
</pre>
 
619
The <code>TLSLog</code> contains:
 
620
<pre>
 
621
  client did not reuse SSL session, rejecting data connection (see the NoSessionReuseRequired TLSOptions parameter
 
622
</pre>
 
623
but I do <i>not</i> want to use that option, and would like to rely on the
 
624
additional security protection provided by requring SSL session reuse.
 
625
And my FTPS client is correctly reusing SSL session IDs (as earlier data
 
626
transfers were working properly).  So why is my data transfer failing after
 
627
the upload of a very large file?<br>
 
628
<font color=blue>Answer</font>: The answer involves SSL session caching
 
629
on the server side (<i>i.e.</i> <code>mod_tls</code>), cache timeouts, and
 
630
session renegotiations.
 
631
 
 
632
<p>
 
633
By default, <code>mod_tls</code> uses OpenSSL's "internal" session cache,
 
634
which is an in-memory caching of SSL session IDs.  And by default, OpenSSL's
 
635
internal session cache has a cache timeout of 5 minutes; after that amount
 
636
of time in the internal session cache, a cached SSL session ID is considered
 
637
stale and is available for reuse.
 
638
 
 
639
<p>
 
640
This means that 5 minutes or more into an FTPS session, even if your FTPS
 
641
client reused an SSL session ID, the OpenSSL internal session cache will
 
642
time out that SSL session ID.  The next time your FTPS client goes to reuse
 
643
that session ID for a data transfer, <code>mod_tls</code> won't find it in
 
644
the OpenSSL internal session cache, and will think that your FTPS client is
 
645
not reusing the SSL session ID as is required, and fail the transfer.
 
646
 
 
647
<p>
 
648
Fixing this situation requires two parts: <i>a)</i> the ability to change
 
649
the cache timeout used for the OpenSSL internal session cache, and <i>b)</i>
 
650
renegotiating the SSL session ID with the FTPS client periodically, to keep
 
651
the SSL session ID up-to-date in the session cache.
 
652
 
 
653
<p>
 
654
The first part, configuring the session cache timeout for the OpenSSL internal
 
655
session cache, is only possible in ProFTPD 1.3.4rc2 and later (see
 
656
<a href="http://bugs.proftpd.org/show_bug.cgi?id=3580">Bug#3580</a>).  The
 
657
<a href="../contrib/mod_tls.html#TLSSessionCache"><code>TLSSessionCache</code></a> directive was modified to allow a configuration such as:
 
658
<pre>
 
659
  TLSSessionCache internal: 1800
 
660
</pre>
 
661
(Unfortunately, the ':' after "internal" <i>is</i> necessary.)  This configures
 
662
<code>mod_tls</code> such that the OpenSSL internal session cache uses
 
663
a cache timeout of 1800 seconds (30 minutes), rather than the default of 300
 
664
seconds (5 minutes).
 
665
 
 
666
<p>
 
667
No matter how long you configure the cache timeout, eventually you will have
 
668
a session which lasts longer than that timeout.  Which brings us to the second
 
669
part of the solution: renegotiating a new SSL session ID periodically, which
 
670
keeps it fresh in the session cache.  The
 
671
<a href="../contrib/mod_tls.html#TLSRenegotiate"><code>TLSRenegotiate</code></a>
 
672
directive is needed for this.  For example, the following configuration
 
673
should address the issue of failed data transfers after very large uploads:
 
674
<pre>
 
675
  TLSRenegotiate ctrl 1500 timeout 300
 
676
  TLSSessionCache internal: 1800
 
677
</pre>
 
678
This tells <code>mod_tls</code> to request a renegotiation of the SSL session
 
679
on the control channel every 1500 seconds (25 minutes), and to allow
 
680
300 seconds (5 minutes) for the client to perform the renegotiation.  It also
 
681
tells <code>mod_tls</code> to cache the SSL session data for 1800 seconds
 
682
(30 minutes), <i>i.e.</i> longer than the renegotiation time of 1500 seconds.
 
683
 
 
684
<p>
 
685
This way, as long as your client supports renegotiations and is updating the
 
686
SSL session ID properly for data transfers, when a data transfer is requested,
 
687
the SSL session ID presented by the client should always be fresh and in the
 
688
session cache.
 
689
 
598
690
<p><a name="TLSBuildErrors">
599
691
<font color=red>Question</font>: Why would I see the following errors while attempting to build <code>proftpd</code> with <code>mod_tls</code>?
600
692
<pre>
821
913
 - mod_tls/2.2: compiled using OpenSSL version 'OpenSSL 0.9.7i 14 Oct 2005'
822
914
headers, but linked to OpenSSL version 'OpenSSL 0.9.7l 28 Sep 2006' library
823
915
</pre>
824
 
<font color=blue>Answer</font>: That message is a warning, not an error.  It
825
 
is telling you that the OpenSSL headers on your system don't match the OpenSSL
826
 
library version.  In most cases, this is not a problem.  However, there
827
 
can be inexplicable errors if the difference in header versus library versions
828
 
is too large.
 
916
What does this mean?<br>
 
917
<font color=blue>Answer</font>: That is an informational/warning message.
 
918
 
 
919
<p>
 
920
Some systems are badly maintained by their admins (and/or by the packages
 
921
installed on the systems), such that the OpenSSL headers can become quite badly
 
922
out of sync with the OpenSSL libraries.  If this discrepancy becomes bad
 
923
enough, you can see strange behavior from OpenSSL, ranging from random behavior
 
924
to segfaults.  So <code>mod_tls</code> tries to let the admin know about the
 
925
system's mismatched OpenSSL header/library versions.
 
926
 
 
927
<p>
 
928
Usually a minor OpenSSL version difference like the example above is OK,
 
929
but it really depends on exactly what changed in OpenSSL, and how.
 
930
 
 
931
<p>
 
932
If you see the above message, it is not a <i>requirement</i> that you recompile
 
933
<code>proftpd</code> against the OpenSSL headers of the same version as the
 
934
OpenSSL libraries.  However, the version discrepancy <em>is</em> a possible
 
935
source of trouble.
829
936
 
830
937
<p>
831
938
This header/library version check was added recently, hence why older
908
1015
file configured for the server certificate might also be badly formatted,
909
1016
which would result in the same error.
910
1017
 
911
 
<p><a name="TLSOpenSSLVersionMismatch">
912
 
<font color=red>Question</font>: When I start <code>proftpd</code>, I
913
 
see warnings that look like this:
 
1018
<p>
 
1019
<font color=red>Question</font>: Is there a way to require TLS (FTPS) for
 
1020
remote clients <b>only</b>, and allow simple FTP (without TLS) for local
 
1021
clients (<i>i.e.</i> for clients in networks which we will be able to define
 
1022
as "local")?<br>
 
1023
<font color=blue>Answer</font>: Yes.
 
1024
 
 
1025
<p>
 
1026
To do this, you would use a combination of
 
1027
<a href="Classes.html"><code>&lt;Class&gt;</code></a> sections and
 
1028
<a href="../contrib/mod_ifsession.html">mod_ifsession</a>'s
 
1029
<code>&lt;IfClass&gt;</code>, <i>e.g.</i>:
914
1030
<pre>
915
 
  - mod_tls/2.4.1: compiled using OpenSSL version 'OpenSSL 0.9.8n 24 Mar 2010' headers, but linked to OpenSSL version 'OpenSSL 0.9.8q 2 Dec 2010' library
 
1031
  &lt;Class local&gt;
 
1032
    From ...
 
1033
  &lt;/Class&gt;
 
1034
 
 
1035
  &lt;IfModule mod_tls.c&gt;
 
1036
    # Normal mod_tls configuration here
 
1037
 
 
1038
    &lt;IfClass local&gt;
 
1039
      # Don't require FTPS from local clients
 
1040
      TLSRequired off
 
1041
    &lt;/IfClass&gt;
 
1042
 
 
1043
    &lt;IfClass !local&gt;
 
1044
      # Require FTPS from remote/non-local clients
 
1045
      TLSRequired on
 
1046
    &lt;/IfClass&gt;
 
1047
 
 
1048
  &lt;/IfModule&gt;
916
1049
</pre>
917
 
What does this mean?<br>
918
 
<font color=blue>Answer</font>: That is an informational/warning message.
919
 
 
920
 
<p>
921
 
Some systems are badly maintained by their admins (and/or by the packages
922
 
installed on the systems), such that the OpenSSL headers can become quite badly
923
 
out of sync with the OpenSSL libraries.  If this discrepancy becomes bad
924
 
enough, you can see strange behavior from OpenSSL, ranging from random behavior
925
 
to segfaults.  So <code>mod_tls</code> tries to let the admin know about the
926
 
system's mismatched OpenSSL header/library versions.
927
 
 
928
 
<p>
929
 
Usually a minor OpenSSL version difference like the example above is OK,
930
 
but it really depends on exactly what changed in OpenSSL, and how.
931
 
 
932
 
<p>
933
 
If you see the above message, it is not a <i>requirement</i> that you recompile
934
 
<code>proftpd</code> against the OpenSSL headers of the same version as the
935
 
OpenSSL libraries.  However, the version discrepancy <em>is</em> a possible 
936
 
source of trouble.
937
1050
 
938
1051
<p>
939
1052
<hr>
940
 
Last Updated: <i>$Date: 2011/03/25 01:24:12 $</i><br>
 
1053
Last Updated: <i>$Date: 2011/05/11 16:09:24 $</i><br>
941
1054
<hr>
942
1055
 
943
1056
</body>