-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mojaloop/#3264): tls cert reload issue (#454)
* fix: issue with tls cert reloading * chore: updated docker stack * feat: added pm4ml tests * fix: container names * chore: update deps * fix: integration tests * fix: cert generation * fix: tests * fix: issues * chore(snapshot): 23.1.0-snapshot.0
- Loading branch information
Showing
35 changed files
with
6,410 additions
and
1,566 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
version: '3.7' | ||
|
||
services: | ||
|
||
sdk-scheme-adapter-api-svc: | ||
env_file: ./modules/api-svc/test/config/integration-pm4ml.env | ||
depends_on: | ||
- mock-management-svc | ||
command: yarn nx run modules-api-svc:start | ||
|
||
mock-management-svc: | ||
networks: | ||
- mojaloop-net | ||
image: mojaloop/sdk-scheme-adapter:local | ||
build: | ||
context: ./ | ||
dockerfile: ./Dockerfile | ||
ports: | ||
- "4005:4005" | ||
- "5005:5005" | ||
command: yarn nx run modules-api-svc:test:pm4ml-run-mock-servers | ||
user: root # Set Root so we can install Curl for Healthchecks | ||
healthcheck: | ||
test: ["CMD-SHELL", "nc localhost 4005"] | ||
interval: 5s | ||
timeout: 10s | ||
retries: 3 | ||
|
||
hubsimulator: | ||
networks: | ||
- mojaloop-net | ||
image: haproxy:2.8.1-alpine | ||
depends_on: | ||
- ml-testing-toolkit | ||
links: | ||
- ml-testing-toolkit:ml-testing-toolkit | ||
volumes: | ||
- ./docker/haproxy/certs:/usr/local/etc/haproxy/certs | ||
- ./docker/haproxy/tls:/usr/local/etc/haproxy/tls | ||
- ./docker/haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg | ||
ports: | ||
- "8443:8443" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
## TODOs | ||
# - Add Redis Insights | ||
|
||
version: '3.7' | ||
networks: | ||
mojaloop-net: | ||
|
@@ -59,9 +56,11 @@ services: | |
|
||
ml-testing-toolkit: | ||
networks: | ||
- mojaloop-net | ||
mojaloop-net: | ||
aliases: | ||
- ttkbackendsim | ||
- ttkhubsim | ||
image: mojaloop/ml-testing-toolkit:v15.0.0 | ||
container_name: ml-testing-toolkit | ||
volumes: | ||
- "./docker/ml-testing-toolkit/spec_files:/opt/app/spec_files" | ||
- "./docker/ml-testing-toolkit/secrets:/opt/app/secrets" | ||
|
@@ -88,36 +87,28 @@ services: | |
- sh | ||
- /usr/share/nginx/start.sh | ||
|
||
zookeeper: | ||
networks: | ||
- mojaloop-net | ||
image: docker.io/bitnami/zookeeper:3.8 | ||
container_name: zookeeper | ||
ports: | ||
- 2181:2181 | ||
environment: | ||
- ALLOW_ANONYMOUS_LOGIN=yes | ||
|
||
kafka: | ||
networks: | ||
- mojaloop-net | ||
image: docker.io/bitnami/kafka:3.2 | ||
image: docker.io/bitnami/kafka:3.4.0 | ||
container_name: kafka | ||
ports: | ||
- "9092:9092" | ||
environment: | ||
# BITNAMI_DEBUG: "yes" | ||
ALLOW_PLAINTEXT_LISTENER: "yes" | ||
KAFKA_ADVERTISED_HOST_NAME: kafka | ||
KAFKA_LISTENERS: LISTENER_DOCKER://kafka:29092,LISTENER_INTERN://kafka:9093,LISTENER_EXTERN://0.0.0.0:9092 | ||
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER://kafka:29092,LISTENER_INTERN://kafka:9093,LISTENER_EXTERN://127.0.0.1:9092 | ||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER:PLAINTEXT,LISTENER_INTERN:PLAINTEXT,LISTENER_EXTERN:PLAINTEXT | ||
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_INTERN | ||
KAFKA_CFG_LISTENERS: CONTROLLER://:9093,LISTENER_DOCKER://:29092,LISTENER_EXTERN://:9092 | ||
KAFKA_CFG_ADVERTISED_LISTENERS: LISTENER_DOCKER://kafka:29092,LISTENER_EXTERN://localhost:9092 | ||
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,LISTENER_DOCKER:PLAINTEXT,LISTENER_EXTERN:PLAINTEXT | ||
KAFKA_CFG_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER | ||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | ||
KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper:2181 | ||
KAFKA_CFG_MESSAGE_MAX_BYTES: 200000000 | ||
KAFKA_ENABLE_KRAFT: "no" | ||
depends_on: | ||
- zookeeper | ||
KAFKA_CFG_NODE_ID: 1 | ||
KAFKA_CFG_PROCESS_ROLES: broker,controller | ||
KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER | ||
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: [email protected]:9093 | ||
KAFKA_ENABLE_KRAFT: "true" | ||
healthcheck: | ||
test: ["CMD" ,"/opt/bitnami/kafka/bin/kafka-broker-api-versions.sh","--bootstrap-server","kafka:9092"] | ||
timeout: 20s | ||
|
@@ -161,19 +152,17 @@ services: | |
init-kafka: | ||
networks: | ||
- mojaloop-net | ||
image: docker.io/bitnami/kafka:3.2 | ||
image: docker.io/bitnami/kafka:3.4.0 | ||
depends_on: | ||
- kafka | ||
entrypoint: [ '/bin/sh', '-c' ] | ||
command: | | ||
" | ||
# blocks until kafka is reachable | ||
kafka-topics.sh --bootstrap-server kafka:9093 --list | ||
kafka-topics.sh --bootstrap-server kafka:29092 --list | ||
echo -e 'Creating kafka topics' | ||
kafka-topics.sh --bootstrap-server kafka:9093 --create --if-not-exists --topic topic-sdk-outbound-command-events --replication-factor 1 --partitions 1 | ||
kafka-topics.sh --bootstrap-server kafka:9093 --create --if-not-exists --topic topic-sdk-outbound-domain-events --replication-factor 1 --partitions 1 | ||
kafka-topics.sh --bootstrap-server kafka:29092 --create --if-not-exists --topic topic-sdk-outbound-command-events --replication-factor 1 --partitions 1 | ||
kafka-topics.sh --bootstrap-server kafka:29092 --create --if-not-exists --topic topic-sdk-outbound-domain-events --replication-factor 1 --partitions 1 | ||
echo -e 'Successfully created the following topics:' | ||
kafka-topics.sh --bootstrap-server kafka:9093 --list | ||
kafka-topics.sh --bootstrap-server kafka:29092 --list | ||
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
global | ||
log 127.0.0.1 local0 | ||
log 127.0.0.1 local1 debug | ||
#log loghost local0 info | ||
maxconn 4096 | ||
tune.ssl.default-dh-param 2048 | ||
#chroot /usr/share/haproxy | ||
#daemon | ||
#debug | ||
#quiet | ||
|
||
defaults | ||
log global | ||
mode http | ||
option httplog | ||
option dontlognull | ||
retries 3 | ||
option redispatch | ||
maxconn 2000 | ||
timeout connect 5000 | ||
timeout client 50000 | ||
timeout server 50000 | ||
|
||
frontend localnodes | ||
mode http | ||
# bind *:8443 ssl crt /usr/local/etc/haproxy/certs/server/server.pem ca-file /usr/local/etc/haproxy/certs/ca/ca.pem verify required | ||
bind *:8443 ssl crt /usr/local/etc/haproxy/tls/hub_server_cert.pem ca-file /usr/local/etc/haproxy/tls/hub_cacert.pem verify required | ||
# bind *:8443 ssl crt /usr/local/etc/haproxy/tls/hub_server_cert.pem ca-file /usr/local/etc/haproxy/tls/hub_cacert.pem | ||
default_backend nodes | ||
|
||
backend nodes | ||
mode http | ||
balance roundrobin | ||
option forwardfor | ||
http-request set-header X-Forwarded-Port %[dst_port] | ||
http-request add-header X-Forwarded-Proto https if { ssl_fc } | ||
http-request set-header X-SSL %[ssl_fc] | ||
http-request set-header X-SSL-Client-Verify %[ssl_c_verify] | ||
http-request set-header X-SSL-Client-DN %{+Q}[ssl_c_s_dn] | ||
http-request set-header X-SSL-Client-CN %{+Q}[ssl_c_s_dn(cn)] | ||
http-request set-header X-SSL-Issuer %{+Q}[ssl_c_i_dn] | ||
http-request set-header X-SSL-Client-NotBefore %{+Q}[ssl_c_notbefore] | ||
http-request set-header X-SSL-Client-NotAfter %{+Q}[ssl_c_notafter] | ||
server server1 ml-testing-toolkit:4040 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
OUTPUT_DIR="." | ||
setopt +o nomatch | ||
rm *.key | ||
rm *.pem | ||
rm *.csr | ||
rm *.crt | ||
rm *.srl | ||
|
||
##################### | ||
|
||
## Generating Hub CA certificate | ||
openssl req -x509 -config openssl-hub-ca.cnf -newkey rsa:4096 -sha256 -nodes -out hub_cacert.pem -outform PEM | ||
|
||
## Generating DFSP CA certificate | ||
openssl req -x509 -config openssl-dfsp-ca.cnf -newkey rsa:4096 -sha256 -nodes -out dfsp_cacert.pem -outform PEM | ||
|
||
##################### | ||
|
||
## Generate Hub server csr | ||
openssl req -config openssl-hub-server.cnf -newkey rsa:4096 -sha256 -nodes -out hub_server.csr -outform PEM | ||
|
||
## Sign Hub server cert with DFSP CA | ||
openssl ca -batch -config openssl-dfsp-ca.cnf -policy signing_policy -extensions signing_req -out hub_server_cert.pem -infiles hub_server.csr | ||
|
||
## Append ca cert to PEM file | ||
cat dfsp_cacert.pem >> hub_server_cert.pem | ||
|
||
## Append key to PEM file | ||
cat hub_server_key.key >> hub_server_cert.pem | ||
|
||
##################### | ||
|
||
## Generate client csr | ||
openssl req -config openssl-dfsp-client.cnf -newkey rsa:4096 -sha256 -nodes -out dfsp_client.csr -outform PEM | ||
|
||
## Sign DFSP client cert with Hub CA | ||
openssl ca -batch -config openssl-hub-ca.cnf -policy signing_policy -extensions signing_req -out dfsp_client_cert.crt -infiles dfsp_client.csr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
V 260401125934Z 09 unknown /C=US/ST=MD/L=Baltimore/O=Hub Client/OU=Payments/CN=dfspclient | ||
V 260402082307Z 0A unknown /C=US/ST=MD/L=Baltimore/O=Hub Client/OU=Payments/CN=dfspclient | ||
V 260402082703Z 0B unknown /C=US/ST=MD/L=Baltimore/O=Test Server, Limited/OU=Payments/CN=hubsimulator | ||
V 260402082705Z 0C unknown /C=US/ST=MD/L=Baltimore/O=Hub Client/OU=Payments/CN=dfspclient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
unique_subject = no |
Oops, something went wrong.