Testsuite: syslog testcase
[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
1d543e88
PP
39If you pick a location shared amongst various local packages, such as
40`/usr/local` on Linux, then the new OpenSSL will be used by all of those
41packages. If that's what you want, great! If instead you want to
42ensure that only software you explicitly set to use the newer OpenSSL
43will try to use the new OpenSSL, then stick to something like
44`/opt/openssl`.
45
8d3bb6f5
PP
46 ./config --prefix=/opt/openssl --openssldir=/etc/ssl \
47 -L/opt/openssl/lib -Wl,-R/opt/openssl/lib \
3709254f 48 enable-ssl-trace shared
2eec84ca
PP
49 make
50 make install
51
ab3b76ce
PP
52On some systems, the linker uses `-rpath` instead of `-R`; on such systems,
53replace the parameter starting `-Wl` with: `-Wl,-rpath,/opt/openssl/lib`.
54There are more variations on less common systems.
55
2eec84ca
PP
56You now have an installed OpenSSL under /opt/openssl which will not be
57used by any system programs.
58
59When you copy `src/EDITME` to `Local/Makefile` to make your build edits,
60choose the pkg-config approach in that file, but also tell Exim to add
61the relevant directory into the rpath stamped into the binary:
62
1922a912
PP
63 PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig
64
2eec84ca
PP
65 SUPPORT_TLS=yes
66 USE_OPENSSL_PC=openssl
1922a912 67 LDFLAGS+=-ldl -Wl,-rpath,/opt/openssl/lib
2eec84ca 68
3324ab3f 69The -ldl is needed by OpenSSL 1.0.2+ on Linux and is not needed on most
1922a912
PP
70other platforms. The LDFLAGS is needed because `pkg-config` doesn't know
71how to emit information about RPATH-stamping, but we can still leverage
72`pkg-config` for everything else.
2eec84ca 73
1922a912 74Then build Exim:
2eec84ca 75
2eec84ca
PP
76 make
77 sudo make install
78
79
80Confirming
81----------
82
83Run:
84
85 exim -d-all+expand --version
86
87and look for the `Library version: OpenSSL:` lines.
88
89To look at the libraries _probably_ found by the linker, use:
90
91 ldd $(which exim) # most platforms
92 otool -L $(which exim) # MacOS
93
4c04137d 94although that does not correctly handle restrictions imposed upon
2eec84ca
PP
95executables which are setuid.
96
97If the `chrpath` package is installed, then:
98
99 chrpath -l $(which exim)
100
101will show the DT_RPATH stamped into the binary.
102
8d3bb6f5
PP
103Your `binutils` package should come with `readelf`, so an alternative
104is to run:
105
106 readelf -d $(which exim) | grep RPATH
107
1d543e88
PP
108It is important to use `RPATH` and not `RUNPATH`!
109
110The gory details about `RUNPATH` (skip unless interested):
111The OpenSSL library might be opened indirectly by some other library
112which Exim depends upon. If the executable does have `RUNPATH` then
113that will inhibit using either of `RPATH` or `RUNPATH` from the
114executable for finding the OpenSSL library when that other library tries
115to load it.
116In fact, if the intermediate library has a `RUNPATH` stamped into it,
117then this will block `RPATH` too, and will create problems with Exim.
118If you're in such a situation, and those libraries were supplied to you
119instead of built by you, then you're reaching the limits of sane
120repairability and it's time to prioritize rebuilding your mail-server
121hosts to be a current OS release which natively pulls in an
122upstream-supported OpenSSL, or stick to the OS releases of Exim.
123
2eec84ca
PP
124
125Very Advanced
126-------------
127
128You can not use $ORIGIN for portably packing OpenSSL in with Exim with
129normal Exim builds, because Exim is installed setuid which causes the
130runtime linker to ignore $ORIGIN in DT_RPATH.
131
132_If_ following the steps for a non-setuid Exim, _then_ you can use:
133
134 EXTRALIBS_EXIM=-ldl '-Wl,-rpath,$$ORIGIN/../lib'
135
136The doubled `$$` is needed for the make(1) layer and the quotes needed
137for the shell invoked by make(1) for calling the linker.
138
139Note that this is sufficiently far outside normal that the build-system
140doesn't support it by default; you'll want to drop a symlink to the lib
141directory into the Exim release top-level directory, so that lib exists
142as a sibling to the build-$platform directory.
143