Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mongodb): add extended config options for MongoDB #831

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Tests include code coverage via istanbul. See the test/ folder for testing scrip
If you want to run integration tests in a repetitive manner, you can startup the test containers using `docker-compose`, login to running `central-ledger` container like so:

```bash
docker-compose -f docker-compose.yml -f docker-compose.integration.yml up kafka mysql central-ledger
docker-compose -f docker-compose.yml -f docker-compose.integration.yml up kafka mysql objstore central-ledger

#in a new shell
docker exec -it cl_central-ledger sh
Expand Down
30 changes: 25 additions & 5 deletions audit-resolve.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@
},
"1500|@mojaloop/central-services-shared>widdershins>yargs>yargs-parser": {
"decision": "ignore",
"madeAt": 1613868373740,
"expiresAt": 1616460368344
"madeAt": 1617153555520,
"expiresAt": 1619745500071
},
"1594|@mojaloop/central-services-health>@mojaloop/central-services-shared>axios": {
"decision": "ignore",
Expand All @@ -112,8 +112,8 @@
},
"1500|@mojaloop/central-services-health>@mojaloop/central-services-shared>widdershins>yargs>yargs-parser": {
"decision": "ignore",
"madeAt": 1613868373740,
"expiresAt": 1616460368344
"madeAt": 1617153555520,
"expiresAt": 1619745500071
},
"1640|@mojaloop/central-services-health>@mojaloop/central-services-shared>widdershins>urijs": {
"decision": "ignore",
Expand All @@ -129,8 +129,28 @@
"decision": "ignore",
"madeAt": 1615756857121,
"expiresAt": 1618348850367
},
"1654|@mojaloop/central-services-health>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>yargs>y18n": {
"decision": "fix",
"madeAt": 1617153524610
},
"1654|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>yargs>y18n": {
"decision": "fix",
"madeAt": 1617153524610
},
"1654|@mojaloop/event-sdk>grpc>protobufjs>yargs>y18n": {
"decision": "fix",
"madeAt": 1617153524610
},
"1654|@mojaloop/central-services-health>@mojaloop/central-services-shared>widdershins>yargs>y18n": {
"decision": "fix",
"madeAt": 1617153540236
},
"1654|@mojaloop/central-services-shared>widdershins>yargs>y18n": {
"decision": "fix",
"madeAt": 1617153540236
}
},
"rules": {},
"version": 1
}
}
6 changes: 5 additions & 1 deletion config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@
},
"MONGODB": {
"DISABLED": true,
"URI": "mongodb://localhost:27017/mlos"
"URI": "mongodb://localhost:27017/mlos",
"OPTIONS": {
"ssl": false,
"sslValidate": false
}
},
"ERROR_HANDLING": {
"includeCauseExtension": true,
Expand Down
6 changes: 5 additions & 1 deletion docker-compose.integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ services:
ports:
- "3001:3001"
volumes:
- ./docker/central-ledger/default.json:/opt/central-ledger/config/default.json
- ./test/integration-config.json:/opt/central-ledger/config/default.json
- ./test:/opt/central-ledger/test
- ./src:/opt/central-ledger/src
# Only mount in node_modules if you want to update dependencies on the fly
# This comes with it's own issues... so beware
# - ./node_modules:/opt/central-ledger/node_modules
environment:
- CLEDG_SIDECAR__DISABLED=true
- CLEDG_MONGODB__DISABLED=true
- CSL_LOG_TRANSPORT=console
- LOG_LEVEL=info
command:
- tail
- -f
Expand Down
10 changes: 7 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ services:
ports:
- "2181:2181"
- "9092:9092"
- "29092:29092"
environment:
- ZOO_LOG4J_PROP=WARN
networks:
Expand All @@ -136,9 +137,12 @@ services:
objstore:
image: mongo:latest
container_name: cl_objstore
# Disable logging as it is far too verbose for debugging locally
logging:
driver: none
# Allows TLS without requiring client to provide certs
# lets us test both with TLS and non-TLS connections
command: --tlsMode allowTLS --tlsCertificateKeyFile /etc/ssl/test-server1.pem --tlsCAFile /etc/ssl/test-ca.pem --tlsAllowConnectionsWithoutCertificates
volumes:
- ./docker/objstore/test-server1.pem:/etc/ssl/test-server1.pem
- ./docker/objstore/test-ca.pem:/etc/ssl/test-ca.pem
ports:
- "27017:27017"
networks:
Expand Down
11 changes: 11 additions & 0 deletions docker/objstore/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# objstore docker-compose config


We generate the files `test-ca.pem` and `test-server1.pem` for us to test out MongoDB's TLS settings.

These keys should NOT be used in production. They are for integration test purposes only.

References:
1. https://docs.mongodb.com/manual/appendix/security/appendixA-openssl-ca/
2. https://docs.mongodb.com/manual/appendix/security/appendixB-openssl-server/

67 changes: 67 additions & 0 deletions docker/objstore/openssl-test-ca.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# NOT FOR PRODUCTION USE. OpenSSL configuration file for testing.

# For the CA policy
[ policy_match ]
countryName = match
stateOrProvinceName = match
organizationName = match
organizationalUnitName = optional
commonName = supplied
emailAddress = optional

[ req ]
default_bits = 4096
default_keyfile = myTestCertificateKey.pem ## The default private key file name.
default_md = sha256 ## Use SHA-256 for Signatures
distinguished_name = req_dn
req_extensions = v3_req
x509_extensions = v3_ca # The extentions to add to the self signed cert

[ v3_req ]
subjectKeyIdentifier = hash
basicConstraints = CA:FALSE
keyUsage = critical, digitalSignature, keyEncipherment
nsComment = "OpenSSL Generated Certificate for TESTING only. NOT FOR PRODUCTION USE."
extendedKeyUsage = serverAuth, clientAuth

[ req_dn ]
countryName = Country Name (2 letter code)

countryName_default = AU

countryName_min = 2
countryName_max = 2

stateOrProvinceName = State or Province Name (full name)

stateOrProvinceName_default = TestCertificateStateName

stateOrProvinceName_max = 64

localityName = Locality Name (eg, city)

localityName_default = TestCertificateLocalityName

localityName_max = 64

organizationName = Organization Name (eg, company)

organizationName_default = TestCertificateOrgName

organizationName_max = 64

organizationalUnitName = Organizational Unit Name (eg, section)

organizationalUnitName_default = TestCertificateOrgUnitName

organizationalUnitName_max = 64

commonName = Common Name (eg, YOUR name)
commonName_max = 64

[ v3_ca ]
# Extensions for a typical CA

subjectKeyIdentifier=hash
basicConstraints = critical,CA:true
authorityKeyIdentifier=keyid:always,issuer:always
63 changes: 63 additions & 0 deletions docker/objstore/openssl-test-server.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# NOT FOR PRODUCTION USE. OpenSSL configuration file for testing.


[ req ]
default_bits = 4096
default_keyfile = myTestServerCertificateKey.pem ## The default private key file name.
default_md = sha256
distinguished_name = req_dn
req_extensions = v3_req

[ v3_req ]
subjectKeyIdentifier = hash
basicConstraints = CA:FALSE
keyUsage = critical, digitalSignature, keyEncipherment
nsComment = "OpenSSL Generated Certificate for TESTING only. NOT FOR PRODUCTION USE."
extendedKeyUsage = serverAuth, clientAuth
subjectAltName = @alt_names

[ alt_names ]

DNS.1 = objstore ##TODO: Enter the DNS names. The DNS names should match the server names.

DNS.2 = localhost ##TODO: Enter the DNS names. The DNS names should match the server names.

# IP.1 = ##TODO: Enter the IP address. SAN matching by IP address is available starting in MongoDB 4.2

# IP.2 = ##TODO: Enter the IP address. SAN matching by IP address is available starting in MongoDB 4.2


[ req_dn ]
countryName = Country Name (2 letter code)

countryName_default = AU

countryName_min = 2
countryName_max = 2

stateOrProvinceName = State or Province Name (full name)

stateOrProvinceName_default = TestServerCertificateState

stateOrProvinceName_max = 64

localityName = Locality Name (eg, city)

localityName_default = TestServerCertificateLocality

localityName_max = 64

organizationName = Organization Name (eg, company)

organizationName_default = TestServerCertificateOrg

organizationName_max = 64

organizationalUnitName = Organizational Unit Name (eg, section)

organizationalUnitName_default = TestServerCertificateOrgUnit

organizationalUnitName_max = 64

commonName = Common Name (eg, YOUR name)
commonName_max = 64
78 changes: 78 additions & 0 de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