rabbitmq-server/deps/trust_store_http
Loïc Hoguin aa43139192
Fix OTP-27 Dialyzer errors in trust_store_http
2024-09-30 12:35:42 +02:00
..
rel Fold trust_store_http into this repo 2022-07-28 15:15:36 +04:00
src Fix OTP-27 Dialyzer errors in trust_store_http 2024-09-30 12:35:42 +02:00
BUILD.bazel Bump version to 4.0 in a few places 2024-07-19 01:21:30 -04:00
Makefile make: Restrict Erlang.mk plugin inclusion 2024-08-29 15:19:50 +02:00
README.md Fold trust_store_http into this repo 2022-07-28 15:15:36 +04:00
app.bzl Replace globs in bazel with explicit lists of files 2023-04-25 17:29:12 +02:00
relx.config Fold trust_store_http into this repo 2022-07-28 15:15:36 +04:00

README.md

Example Trust Store HTTP Server for RabbitMQ

This tiny HTTP server serves CA certificates from a user-specified local directory. It is meant to be used with RabbitMQ trust store plugin in its test suite and as an example.

Endpoints

  • /: serves a list of certificates in JSON. The format is {"certificates":[{"id": <id>, "path": <path>}, ...]}
  • /certs/<file_name>: access for PEM encoded certificate files
  • /invlid: serves invalid JSON, to be used in integration tests
<id> = <file_name>:<file_modification_date>
<path> = /certs/<file_name>
<file_name> = name of a PEM file in the listed directory

Usage

To rebuild and run a release (requires Erlang to be installed):

gmake run CERT_DIR="/my/cacert/directory" PORT=8080

To run from the pre-built escript (requires Erlang to be installed):

gmake
CERT_DIR="/my/cacert/directory" PORT=8080 ./_rel/trust_store_http_release/bin/trust_store_http_release console

HTTPS

To start an HTTPS server, you should provide ssl options. It can be done via Erlang .config file format:

[{trust_store_http,
    [{ssl_options, [{cacertfile,"/path/to/testca/cacert.pem"},
                    {certfile,"/path/to/server/cert.pem"},
                    {keyfile,"/path/to/server/key.pem"},
                    {verify,verify_peer},
                    {fail_if_no_peer_cert,false}]}]}]

This configuration can be added to rel/sys.config if you're running the application from source make run

Or it can be specified as an environment variable:

CERT_DIR="/my/cacert/directory" PORT=8443 CONFIG_FILE=my_config.config ./_rel/trust_store_http_release/bin/trust_store_http_release console

Port and directory can be also set via config file:

[{trust_store_http,
    [{directory, "/tmp/certs"},
     {port, 8081},
     {ssl_options, [{cacertfile,"/path/to/testca/cacert.pem"},
                    {certfile,"/path/to/server/cert.pem"},
                    {keyfile,"/path/to/server/key.pem"},
                    {verify,verify_peer},
                    {fail_if_no_peer_cert,false}]}]}]