Debian Codegraph @

src/test/ssl/README

raw
1 src/test/ssl/README
2
3 SSL regression tests
4 ====================
5
6 This directory contains a test suite for SSL support. It tests both
7 client-side functionality, i.e. verifying server certificates, and
8 server-side functionality, i.e. certificate authorization.
9
10 CAUTION: The test server run by this test is configured to listen for
11 TCP connections on localhost. Any user on the same host is able to
12 log in to the test server while the tests are running. Do not run this
13 suite on a multi-user system where you don't trust all local users!
14
15 Running the tests
16 =================
17
18 NOTE: You must have given the --enable-tap-tests argument to configure.
19 Also, to use "make installcheck", you must have built and installed
20 contrib/sslinfo in addition to the core code.
21
22 Run
23 make check PG_TEST_EXTRA=ssl
24 or
25 make installcheck PG_TEST_EXTRA=ssl
26 You can use "make installcheck" if you previously did "make install".
27 In that case, the code in the installation tree is tested. With
28 "make check", a temporary installation tree is built from the current
29 sources and then tested.
30
31 Either way, this test initializes, starts, and stops a test Postgres
32 cluster that is accessible to other local users!
33
34 See src/test/perl/README for more info about running these tests.
35
36 Certificates
37 ============
38
39 The test suite needs a set of public/private key pairs and certificates to
40 run:
41
42 root_ca
43 root CA, use to sign the server and client CA certificates.
44
45 server_ca
46 CA used to sign server certificates.
47
48 client_ca
49 CA used to sign client certificates.
50
51 server-cn-only
52 server-cn-and-alt-names
53 server-single-alt-name
54 server-multiple-alt-names
55 server-no-names
56 server certificates, with small variations in the hostnames present
57 in the certificate. Signed by server_ca.
58
59 server-password
60 same as server-cn-only, but password-protected.
61
62 client
63 a client certificate, for user "ssltestuser". Signed by client_ca.
64
65 client-revoked
66 like "client", but marked as revoked in the client CA's CRL.
67
68 In addition, there are a few files that combine various certificates together
69 in the same file:
70
71 both-cas-1
72 Contains root_ca.crt, client_ca.crt and server_ca.crt, in that order.
73
74 both-cas-2
75 Contains root_ca.crt, server_ca.crt and client_ca.crt, in that order.
76
77 root+server_ca
78 Contains root_crt and server_ca.crt. For use as client's "sslrootcert"
79 option.
80
81 root+client_ca
82 Contains root_crt and client_ca.crt. For use as server's "ssl_ca_file".
83
84 client+client_ca
85 Contains client.crt and client_ca.crt in that order. For use as client's
86 certificate chain.
87
88 There are also CRLs for each of the CAs: root.crl, server.crl and client.crl.
89
90 For convenience, all of these keypairs and certificates are included in the
91 ssl/ subdirectory. The Makefile also contains a rule, "make sslfiles", to
92 recreate them if you need to make changes. "make sslfiles-clean" is required
93 in order to recreate the full set of keypairs and certificates. To rebuild
94 separate files, touch (or remove) the files in question and run "make sslfiles".
95 This step requires at least OpenSSL 1.1.1.
96
97 Note
98 ====
99
100 These certificates are also used in other tests, e.g. the LDAP tests.
101
102 TODO
103 ====
104
105 * Allow the client-side of the tests to be run on different host easily.
106 Currently, you have to manually set up the certificates for the right
107 hostname, and modify the test file to skip setting up the server. And you
108 have to modify the server to accept connections from the client host.
109
110 * Test having multiple server certificates, so that the private key chooses
111 the certificate to present to clients. (And the same in the client-side.)