fix example command-line
[exim.git] / doc / doc-txt / openssl.txt
CommitLineData
2eec84ca
PP
1OpenSSL
2=======
3
4The OpenSSL Project documents their supported releases at
5<https://www.openssl.org/policies/releasestrat.html>. The Exim
6Maintainers are unwilling to try to support Exim built with a
7version of a critical security library which is unmaintained.
8
9Thus as versions of OpenSSL become unsupported by OpenSSL, they become
10unsupported by Exim. Exim might build with older releases of OpenSSL,
11but that's risky behaviour.
12
13If your operating system vendor continues to ship an older version of
14OpenSSL and is diligently backporting security fixes, and they support
15Exim, then they will be backporting fixes to their packages of Exim too.
16If you wish to stick purely to packages of OpenSSL, then stick to
17packages of Exim too.
18
19If someone maintains "backports", that is worth exploring too.
20
21Note that a number of OSes use Exim with GnuTLS, not OpenSSL.
22
23Otherwise, assuming that your operating system has old OpenSSL, and you
24wish to use current Exim with OpenSSL, then you need to build and
25install your own, without interfering with the system libraries.
26Fortunately, this is easy.
27
28So this only applies if you build Exim yourself.
29
30
31Build
32-----
33
34Extract the current source of OpenSSL. Change into that directory.
35
36This assumes that `/opt/openssl` is not in use. If it is, pick
37something else. `/opt/exim/openssl` perhaps.
38
c9169e67 39 ./config --prefix=/opt/openssl --openssldir=/etc/ssl enable-ssl-trace
2eec84ca
PP
40 make
41 make install
42
43You now have an installed OpenSSL under /opt/openssl which will not be
44used by any system programs.
45
46When you copy `src/EDITME` to `Local/Makefile` to make your build edits,
47choose the pkg-config approach in that file, but also tell Exim to add
48the relevant directory into the rpath stamped into the binary:
49
50 SUPPORT_TLS=yes
51 USE_OPENSSL_PC=openssl
52 EXTRALIBS_EXIM=-ldl -Wl,-rpath,/opt/openssl/lib
53
54The -ldl is needed by OpenSSL 1.1+ on Linux and is not needed on most
55other platforms.
56
57Then tell pkg-config how to find the configuration files for your new
58OpenSSL install, and build Exim:
59
60 export PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig
61 make
62 sudo make install
63
64
65Confirming
66----------
67
68Run:
69
70 exim -d-all+expand --version
71
72and look for the `Library version: OpenSSL:` lines.
73
74To look at the libraries _probably_ found by the linker, use:
75
76 ldd $(which exim) # most platforms
77 otool -L $(which exim) # MacOS
78
4c04137d 79although that does not correctly handle restrictions imposed upon
2eec84ca
PP
80executables which are setuid.
81
82If the `chrpath` package is installed, then:
83
84 chrpath -l $(which exim)
85
86will show the DT_RPATH stamped into the binary.
87
88
89Very Advanced
90-------------
91
92You can not use $ORIGIN for portably packing OpenSSL in with Exim with
93normal Exim builds, because Exim is installed setuid which causes the
94runtime linker to ignore $ORIGIN in DT_RPATH.
95
96_If_ following the steps for a non-setuid Exim, _then_ you can use:
97
98 EXTRALIBS_EXIM=-ldl '-Wl,-rpath,$$ORIGIN/../lib'
99
100The doubled `$$` is needed for the make(1) layer and the quotes needed
101for the shell invoked by make(1) for calling the linker.
102
103Note that this is sufficiently far outside normal that the build-system
104doesn't support it by default; you'll want to drop a symlink to the lib
105directory into the Exim release top-level directory, so that lib exists
106as a sibling to the build-$platform directory.
107