########################################################################
##  OpenFTPD TLS Support                                              ##
########################################################################

90% of the TLS specific code in OpenFTPD (and this document) is work done by
the author of ftpd-tls.  Thank him, and thank god for open source.

BUGS:

* No encrypted data only control
* Mostly hardcoded options, needs to be replaced with reg keys

Registry keys:

* force_tls: yes or no

The ftpd server tries to use these TLS related files by default:

* ftpd-rsa.pem		RSA certificate, may include private key
* ftpd-rsa-key.pem	RSA private key
* ftpd-dsa.pem		DSA certificate, may include private key
* ftpd-dh-key.pem		DH private key
* ftpd-crl.pem		Certificate Revokation List
* ftpd-dhparam.pem	DH Parameters (a set of DH params is compiled in)

These files is searched for in the following directorys (in this order):

o  Current working directory of the process.
o  Specified by the `X509_get_default_cert_dir_env()` environment variable
   (usually $SSL_CERT_DIR).
o  `X509_get_default_cert_dir()`, usually (openssl-dir)/certs.
o  `X509_get_default_private_dir()`, usually (openssl-dir/private.

Default CRL directory for the proftpd server is (openssl-dir)/crl.

To create a cert use Hoe's script in the misc dir. 

Default cipher list is hardcoded to "ALL:!EXP" in src/ftps/tlsutils.c.
This should be changed to read cipher list from a registry key soon.

How to put together a  'cipher list string':
  Key Exchange Algorithms:
    "kRSA"      RSA key exchange
    "kDHr"      Diffie-Hellman key exchange (key from RSA cert)
    "kDHd"      Diffie-Hellman key exchange (key from DSA cert)
    "kEDH'      Ephemeral Diffie-Hellman key exchange (temporary key)

  Authentication Algorithm:
    "aNULL"     No authentication
    "aRSA"      RSA authentication
    "aDSS"      DSS authentication
    "aDH"       Diffie-Hellman authentication

  Cipher Encoding Algorithm:
    "eNULL"     No encodiing
    "DES"       DES encoding
    "3DES"      Triple DES encoding
    "RC4"       RC4 encoding
    "RC2"       RC2 encoding
    "IDEA"      IDEA encoding

  MAC Digest Algorithm:
    "MD5"       MD5 hash function
    "SHA1"      SHA1 hash function
    "SHA"       SHA hash function (should not be used)

  Aliases:
    "ALL"       all ciphers
    "SSLv2"     all SSL version 2.0 ciphers (should not be used)
    "SSLv3"     all SSL version 3.0 ciphers
    "EXP"       all export ciphers (40-bit)
    "EXPORT56"  all export ciphers (56-bit)
    "LOW"       all low strength ciphers (no export)
    "MEDIUM"    all ciphers with 128-bit encryption
    "HIGH"      all ciphers using greater than 128-bit encryption
    "RSA"       all ciphers using RSA key exchange
    "DH"        all ciphers using Diffie-Hellman key exchange
    "EDH"       all ciphers using Ephemeral Diffie-Hellman key exchange
    "ADH"       all ciphers using Anonymous Diffie-Hellman key exchange
    "DSS"       all ciphers using DSS authentication
    "NULL"      all ciphers using no encryption

Each item in the list may include a prefix modifier:

    "+"         move cipher(s) to the current location in the list
    "-"         remove cipher(s) from the list (may be added again by
                a subsequent list entry)
    "!"         kill cipher from the list (it may not be added again
                by a subsequent list entry)

If no modifier is specified the entry is added to the list at the current 
position.  "+" may also be used to combine tags to specify entries such as 
"RSA+RC4" describes all ciphers that use both RSA and RC4.

For example, all available ciphers not including ADH key exchange:

  ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP

All algorithms including ADH and export but excluding patented algorithms: 

  HIGH:MEDIUM:LOW:EXPORT56:EXP:ADH:!kRSA:!aRSA:!RC4:!RC2:!IDEA

The OpenSSL command 

  openssl ciphers -v <list of ciphers> 

may be used to list all of the ciphers and the order described by a specific
<list of ciphers>.

