Small utility to help test TLS support in MonetDB MAPI clients.
493
Small utility to help test TLS support in MonetDB MAPI clients.
Configured with a base port, it opens up a number of sockets on other ports, most of them TLS ports with various certificates. Clients can use this to check that they are actually correctly validating the certificate host name etc.
If the TLS handshake succeeds, the server performs a simulated MAPI
handshake ending in the error message
Sorry, this is not a real MonetDB server.
On each run, tlstester.py generates a number of secret keys and certificates:
Note: unless mentioned otherwise, all MAPI ports will refuse connection attempts when TLS version less than 1.3 is used. TLS 1.2 just doesn't make sense for a protocol introduced in 2023.
tlstest.py runs a small http server (not https).
On / it serves a text file with each line containing a
«port name»:«port number» pair.
It also serves all the above keys and certificates, as /server1.crt,
etc. This includes the private keys.
The client must know the hostname and base port on which tlstester.py is running. It can then retrieve the portmap to find the other ports. Before each test the client should probably first make a raw TCP connection to the socket to verify that it is reachable.
A succesful TLS connection is a connection where we can perform a MAPI dialogue
over the TLS connection. When using the built-in MAPI simulator, the MAPI
exchange will end in an error message but it is still a succes from the
perspective of the TLS connection. The succesful error can be recognized by the
distinctive phrase Sorry, this is not a real MonetDB server.
The script is also shipped as a Docker image, monetdb/tlstester. This is convenient for tests running on GitHub Actions, because they can access it as a service container.
The container can be configured using the following environment variables:
Example:
docker run --rm -i -t -e TLSTEST_DOMAIN=localhost.localdomain -p 127.0.0.1:4300-4350:4300-4350 monetdb/tlstester:0.2.0
If the source code of the client library is on GitHub, configure the test to run in a container, and run tlstester as a "service container". This will make it accessible with a real hostname and because the tests themselves run in a container they can install ca3.crt in the system root certificate store.
This is sufficient for pymonetdb and also for monetdb-java which is mirrored on GitHub.
Libmapi/mclient/ODBC need to be tested through Mtest. We should probably just include tlstester.py into the source tree and manually keep it synchronized with this repository. This is not a huge problem because tlstester.py should rarely change. The system certificate test cannot be run because Mtest is often run on systems that are not ephemeral. As an alternative, we could run the MAPI simulator behind a TLS proxy on a publically reachable host name, say mapitest.monetdb.org. The Mtest could then first verify if that host resolves and is reachable and only then try to make a TLS connection and have a MAPI exchange.
Content type
Image
Digest
sha256:36438886b…
Size
32.6 MB
Last updated
over 2 years ago
docker pull monetdb/tlstester:0.3.1