]> Pileus Git - ~andy/fetchmail/blob - README.SSL
44f0c1950fa7ddf6c8e88ce29494d50817f4c3af
[~andy/fetchmail] / README.SSL
1 Fetchmail SSL support
2 =====================
3
4 NOTE: This text is maybe not explanatory enough, so a little knowledge about
5 public-key-cryptography and associated topics is required.
6
7 Using the fetchmail ssl option, you can have the data transferred between you
8 and the server in an encrypted form, so that eavesdropping should become
9 practically impossible.
10
11 This works as following: the server has a key pair (a secret and a public key),
12 and it sends the client it's public key. Messages encrypted with the public key
13 can be decrypted using the private one and vice versa.
14 A symmetric session key (symmetric means that the same key is used for
15 encryption and decryption) can now be agreed upon by the two parties using
16 the secure channel the key pair builds. The session key is now used to encrypt
17 the traffic.
18
19 In the fetchmail case, the client can now authenticate itself to the server by
20 using the usual POP/IMAP/whatever authentication mechanisms.
21
22 However, so called man-in-the-middle attacks are still possible: in such a
23 setting, an attacker imposes the server, and thus can e.g. get your
24 authentication information if you don't use a challenge based authentication
25 mechanism (because he is thought to be the real server, fetchmail will try to
26 authenticate against it by telling it your password).
27
28 So, not only you need to prove your identity to the server, the server likewise
29 needs to prove it's to you.
30 In the standard setting, the server has a certificate (the client can have a
31 certificate too to prove its identity, but this is not covered by this
32 document). This certificate contains the server's public key, some data about
33 the server, and a digital signature and data about the signer.
34 Digital signatures can also be made using a key pair as described earlier.
35
36 To check this certificate, you may use the new option sslcertck. When it is
37 specified, the signature of server certificate is checked against local trusted
38 certificates to see whether the owner of one of the ceritificates has signed
39 that server certificate, and if so, whether the signature is valid.
40 So, if the server certificate is signed by a Certification Authority (CA),
41 you put the CA's certificate into a directory where you keep trusted
42 certificates, and point fetchmail to it. Fetchmail will then accept certificates
43 signed by the owner of that certificate with the private key belonging to the
44 public key in the certificate.
45 You can specifiy this path using the sslcertpath option.
46 The idea is that the CA only gives certificates to entities of which it has
47 checked and verified the identity of (and in this case, that the server name you
48 specify does belong to it). So, if you chose the intentions and the thoroughness
49 of a CA, you can be reasonably sure that if a certificate is signed by the CA,
50 it really belongs to the server and owner that it claims to.
51
52 Certificates are only valid in a certain time window, so your system clock
53 should be reasonably accurate when checking certificates.
54
55 Additionally, CAs keep Certificate Revocation Lists (CRLs) in which they note
56 the certificates that are to be treated as invalid (e.g. because the server
57 name has changed, another ceritifcate was granted, or even because the
58 certificate was not granted to the rightful owner).
59
60 The really paranoid (who chose to not trust a CA) can check the fingerprint of
61 the public key that is used by the server. The fingerprint is a hash of that
62 key that (hopefully) has few collisions and is hard to attack using a "birthday
63 attack", i.e. nobody can generate a second key that hashes to the same value
64 of the original key in reasonable time. So, if the fingerprint matches, you
65 can be reasonable sure that you talk to the original server, because only that
66 knows the secret key, and it is very hard to generate a matching secret key from
67 the public key. If it doesn't, it might be an attack, but keep in mind that the
68 server key may also have changed legitimately before panicing ;)
69
70 fetchmail will present the fingerprint to you. Another mode, that strictly
71 checks the fingerprint, is available (using the sslfingerprint option, and
72 giving the desired fingerprint as an argument). If you want to check finger-
73 prints, you should use that option, because otherwise, it may be too late
74 to cancel if you see the fingerprint (your password may already have been
75 transmitted)!
76
77 The certificate directory must be hashed in a way OpenSSL expects it: each
78 time you modify a file in that directory or add a file to it, you need
79 to use the c_rehash perl script that comes with OpenSSL (in the tools/
80 subdirectory, in case that it isn't installed). Additionally, you might
81 need to convert the ceriticates to different formats (the PEM format is expected
82 and usually is available, DER is another one; you can convert between
83 both using the openssl(1) utility).
84
85 The fingerprints fetchmail uses are MD5 sums. You can generate them e.g. useing
86 the openssl(1) "x509 -fingerprint" command. The format is a hexadecimal string
87 with a ":" separating two byes (i.e. a ":" every two hex "digits"). The letter
88 hex digits must be in upper case!
89
90 *CAVEAT*: OpenSSL seems to be unable to check CRLs at the moment!
91
92         - Thomas Moestl <tmoestl@gmx.net>