@@ -27,6 +27,7 @@ Configuration is managed through environment variables:
2727### Network Settings
2828
2929- ` BIND ` - Address to bind to (default: localhost)
30+ - ` IPC ` - IPC socket file path (optional)
3031- ` TIMEOUT ` - Request timeout in milliseconds (default: 305000)
3132- ` KEEP_ALIVE_TIMEOUT ` - Keep-alive timeout (optional)
3233- ` HEADERS_TIMEOUT ` - Headers timeout (optional)
@@ -45,8 +46,6 @@ Configuration is managed through environment variables:
4546- ` BITGO_CUSTOM_ROOT_URI ` - Custom BitGo API root URI (optional)
4647- ` BITGO_CUSTOM_BITCOIN_NETWORK ` - Custom Bitcoin network (optional)
4748- ` ADVANCED_WALLET_MANAGER_URL ` - Advanced Wallet Manager URL (required)
48- - ` ADVANCED_WALLET_MANAGER_CERT ` - Path to Advanced Wallet Manager certificate (required)
49- - ` AWM_SERVER_CERT_ALLOW_SELF_SIGNED ` - Allow self-signed certificates from Advanced Wallet Manager (default: false)
5049
5150### TLS/mTLS Configuration
5251
@@ -56,37 +55,46 @@ Both modes use the same TLS configuration variables:
5655
5756- ` TLS_MODE ` - Set to either "mtls" or "disabled" (defaults to "mtls" if not set)
5857
59- #### Certificate Configuration (required when TLS_MODE=mtls )
58+ #### mTLS Server Configuration (for incoming connections )
6059
61- ** Option 1: Certificate Files**
60+ - ` SERVER_TLS_KEY_PATH ` - Path to the private key for the mTLS server
61+ - ` SERVER_TLS_CERT_PATH ` - Path to the certificate for the mTLS server
62+ - ` SERVER_TLS_KEY ` - The private key as a string (alternative to ` _PATH ` )
63+ - ` SERVER_TLS_CERT ` - The certificate as a string (alternative to ` _PATH ` )
6264
63- - ` TLS_KEY_PATH ` - Path to private key file (used for both inbound mTLS server and outbound mTLS client to KMS)
64- - ` TLS_CERT_PATH ` - Path to certificate file (used for both inbound mTLS server and outbound mTLS client to KMS)
65+ #### mTLS Client Authentication Settings (for incoming connections)
6566
66- ** Option 2: Environment Variables**
67+ - ` ALLOW_SELF_SIGNED ` - Allow self-signed certificates (default: false)
68+ - ` MTLS_ALLOWED_CLIENT_FINGERPRINTS ` - Comma-separated list of allowed client certificate fingerprints (optional)
6769
68- - ` TLS_KEY ` - Private key content (PEM format, used for both inbound and outbound)
69- - ` TLS_CERT ` - Certificate content (PEM format, used for both inbound and outbound)
70+ #### Outbound mTLS to AWM (Master Express Mode only)
7071
71- #### mTLS Settings (when TLS_MODE=mtls)
72+ - ` AWM_CLIENT_TLS_KEY_PATH ` - Path to the client key that Master Express presents to the AWM
73+ - ` AWM_CLIENT_TLS_CERT_PATH ` - Path to the client cert that Master Express presents to the AWM
74+ - ` AWM_CLIENT_TLS_KEY ` - The client key as a string (alternative to ` _PATH ` )
75+ - ` AWM_CLIENT_TLS_CERT ` - The client cert as a string (alternative to ` _PATH ` )
76+ - ` AWM_SERVER_CA_CERT_PATH ` - Path to the CA certificate to verify the AWM server (required when TLS_MODE=mtls)
77+ - ` AWM_SERVER_CA_CERT ` - The CA certificate as a string (alternative to ` _PATH ` )
78+ - ` AWM_SERVER_CERT_ALLOW_SELF_SIGNED ` - Allow self-signed certificates from the AWM (default: false)
79+ - ** Required:** Client certificates must be explicitly provided for outbound mTLS connections
7280
73- - ` MTLS_REQUEST_CERT ` - Request client certificates (default: true)
74- - ` CLIENT_CERT_ALLOW_SELF_SIGNED ` - Allow self-signed certificates for incoming client connections (default: false)
75- - ` MTLS_ALLOWED_CLIENT_FINGERPRINTS ` - Comma-separated list of allowed fingerprints for incoming client connections (optional)
81+ #### Outbound mTLS to KMS (AWM Mode only)
7682
77- #### Outbound mTLS to KMS
78-
79- - When ` TLS_MODE=mtls ` , outbound mTLS to KMS is enabled by default.
80- - The same ` TLS_CERT ` and ` TLS_KEY ` are used as the client certificate and key for outbound mTLS requests to KMS.
81- - ` KMS_TLS_CERT_PATH ` - Path to the CA certificate to verify the KMS server (required when outbound mTLS is enabled).
82- - If ` TLS_MODE=disabled ` , outbound mTLS to KMS is also disabled by default.
83+ - ` KMS_CLIENT_TLS_KEY_PATH ` - Path to the client key that AWM presents to the KMS
84+ - ` KMS_CLIENT_TLS_CERT_PATH ` - Path to the client cert that AWM presents to the KMS
85+ - ` KMS_CLIENT_TLS_KEY ` - The client key as a string (alternative to ` _PATH ` )
86+ - ` KMS_CLIENT_TLS_CERT ` - The client cert as a string (alternative to ` _PATH ` )
87+ - ` KMS_SERVER_CA_CERT_PATH ` - Path to the CA certificate to verify the KMS server (required when TLS_MODE=mtls)
88+ - ` KMS_SERVER_CA_CERT ` - The CA certificate as a string (alternative to ` _PATH ` )
8389- ` KMS_SERVER_CERT_ALLOW_SELF_SIGNED ` - Allow self-signed certificates from the KMS (default: false)
84-
85- > ** Note:** If you want to use a different client certificate for KMS, you will need to extend the configuration. By default, the same cert/key is used for both inbound and outbound mTLS.
90+ - ** Required:** Client certificates must be explicitly provided for outbound mTLS connections
8691
8792### Logging and Debug
8893
8994- ` HTTP_LOGFILE ` - Path to HTTP request log file (optional, used by Morgan for HTTP access logs)
95+ - ` NODE_ENV ` - Node environment (development, production, test)
96+ - ` LOG_LEVEL ` - Log level (silent, error, warn, info, http, debug)
97+ - ` RECOVERY_MODE ` - Enable recovery mode (default: false)
9098
9199## Quick Start
92100
@@ -107,31 +115,31 @@ openssl req -new -x509 -key server.key -out server.crt -days 365 -subj "/CN=loca
107115``` bash
108116export APP_MODE=advanced-wallet-manager
109117export KMS_URL=https://your-kms-service
110- export KMS_TLS_CERT_PATH =./server.crt
118+ export KMS_SERVER_CA_CERT_PATH =./server.crt
111119export KMS_SERVER_CERT_ALLOW_SELF_SIGNED=true
112- export TLS_KEY_PATH =./server.key
113- export TLS_CERT_PATH =./server.crt
120+ export SERVER_TLS_KEY_PATH =./server.key
121+ export SERVER_TLS_CERT_PATH =./server.crt
114122export CLIENT_CERT_ALLOW_SELF_SIGNED=true
115123npm start
116124```
117125
118- ### 4 . Start Master Express
126+ ### 3 . Start Master Express
119127
120128In a separate terminal:
121129
122130``` bash
123131export APP_MODE=master-express
124132export BITGO_ENV=test
125- export TLS_KEY_PATH =./server.key
126- export TLS_CERT_PATH =./server.crt
133+ export SERVER_TLS_KEY_PATH =./server.key
134+ export SERVER_TLS_CERT_PATH =./server.crt
127135export ADVANCED_WALLET_MANAGER_URL=https://localhost:3080
128- export ADVANCED_WALLET_MANAGER_CERT =./server.crt
136+ export AWM_SERVER_CA_CERT_PATH =./server.crt
129137export AWM_SERVER_CERT_ALLOW_SELF_SIGNED=true
130138export CLIENT_CERT_ALLOW_SELF_SIGNED=true
131139npm start
132140```
133141
134- ### 5 . Test the Connection
142+ ### 4 . Test the Connection
135143
136144Test that Master Express can communicate with Advanced Wallet Manager:
137145
@@ -157,28 +165,35 @@ curl -k -X POST https://localhost:3081/ping/advancedWalletManager
157165``` bash
158166export APP_MODE=advanced-wallet-manager
159167export KMS_URL=https://production-kms.example.com
160- export TLS_KEY_PATH=/secure/path/advanced-wallet-manager.key
161- export TLS_CERT_PATH=/secure/path/advanced-wallet-manager.crt
162- export MTLS_REQUEST_CERT=true
168+ export SERVER_TLS_KEY_PATH=/secure/path/awm-server.key
169+ export SERVER_TLS_CERT_PATH=/secure/path/awm-server.crt
170+ export KMS_CLIENT_TLS_KEY_PATH=/secure/path/awm-kms-client.key
171+ export KMS_CLIENT_TLS_CERT_PATH=/secure/path/awm-kms-client.crt
172+ export KMS_SERVER_CA_CERT_PATH=/secure/path/kms-ca.crt
163173export CLIENT_CERT_ALLOW_SELF_SIGNED=false
164174export MTLS_ALLOWED_CLIENT_FINGERPRINTS=ABC123...,DEF456...
165175npm start
166176```
167177
178+ ** Note:** Client certificates for outbound connections must be separate from server certificates for security reasons.
179+
168180#### Master Express (Production)
169181
170182``` bash
171183export APP_MODE=master-express
172184export BITGO_ENV=prod
173- export TLS_KEY_PATH=/secure/path/master.key
174- export TLS_CERT_PATH=/secure/path/master.crt
185+ export SERVER_TLS_KEY_PATH=/secure/path/master-server.key
186+ export SERVER_TLS_CERT_PATH=/secure/path/master-server.crt
187+ export AWM_CLIENT_TLS_KEY_PATH=/secure/path/master-awm-client.key
188+ export AWM_CLIENT_TLS_CERT_PATH=/secure/path/master-awm-client.crt
175189export ADVANCED_WALLET_MANAGER_URL=https://advanced-wallet-manager.internal.example.com:3080
176- export ADVANCED_WALLET_MANAGER_CERT=/secure/path/advanced-wallet-manager.crt
177- export MTLS_REQUEST_CERT=true
190+ export AWM_SERVER_CA_CERT_PATH=/secure/path/awm-ca.crt
178191export CLIENT_CERT_ALLOW_SELF_SIGNED=false
179192npm start
180193```
181194
195+ ** Note:** Client certificates for outbound connections must be separate from server certificates for security reasons.
196+
182197## Container Deployment with Podman
183198
184199First, build the container image:
@@ -201,8 +216,8 @@ podman run -d \
201216 -e APP_MODE=advanced-wallet-manager \
202217 -e BIND=0.0.0.0 \
203218 -e TLS_MODE=mtls \
204- -e TLS_KEY_PATH =/app/certs/advanced-wallet-manager-key.pem \
205- -e TLS_CERT_PATH =/app/certs/advanced-wallet-manager-cert.pem \
219+ -e SERVER_TLS_KEY_PATH =/app/certs/advanced-wallet-manager-key.pem \
220+ -e SERVER_TLS_CERT_PATH =/app/certs/advanced-wallet-manager-cert.pem \
206221 -e KMS_URL=host.containers.internal:3000 \
207222 -e NODE_ENV=development \
208223 -e CLIENT_CERT_ALLOW_SELF_SIGNED=true \
@@ -221,10 +236,10 @@ podman run -d \
221236 -e APP_MODE=master-express \
222237 -e BIND=0.0.0.0 \
223238 -e TLS_MODE=mtls \
224- -e TLS_KEY_PATH =/app/certs/test-ssl-key.pem \
225- -e TLS_CERT_PATH =/app/certs/test-ssl-cert.pem \
239+ -e SERVER_TLS_KEY_PATH =/app/certs/test-ssl-key.pem \
240+ -e SERVER_TLS_CERT_PATH =/app/certs/test-ssl-cert.pem \
226241 -e ADVANCED_WALLET_MANAGER_URL=https://host.containers.internal:3080 \
227- -e ADVANCED_WALLET_MANAGER_CERT =/app/certs/advanced-wallet-manager-cert.pem \
242+ -e AWM_SERVER_CA_CERT_PATH =/app/certs/advanced-wallet-manager-cert.pem \
228243 -e CLIENT_CERT_ALLOW_SELF_SIGNED=true \
229244 bitgo-onprem-express
230245
@@ -295,9 +310,8 @@ openssl x509 -in certificate.crt -text -noout
295310``` bash
296311# Check that required variables are set
297312env | grep -E " (APP_MODE|KMS_URL|ADVANCED_WALLET_MANAGER|TLS_)"
298- ` `
313+ ```
299314
300315## License
301316
302317MIT
303- ```
0 commit comments