Skip to content

Commit d258bc2

Browse files
authored
Merge pull request #103 from BitGo/WP-5522-allow-self-signed-cert
chore: update allowSelfSigned configs
2 parents 6c2c6e2 + 86d140f commit d258bc2

33 files changed

+84
-68
lines changed

README.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Configuration is managed through environment variables:
4646
- `BITGO_CUSTOM_BITCOIN_NETWORK` - Custom Bitcoin network (optional)
4747
- `ADVANCED_WALLET_MANAGER_URL` - Advanced Wallet Manager URL (required)
4848
- `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)
4950

5051
### TLS/mTLS Configuration
5152

@@ -70,15 +71,16 @@ Both modes use the same TLS configuration variables:
7071
#### mTLS Settings (when TLS_MODE=mtls)
7172

7273
- `MTLS_REQUEST_CERT` - Request client certificates (default: true)
73-
- `ALLOW_SELF_SIGNED` - Allow self-signed certificates (default: false)
74-
- `MTLS_ALLOWED_CLIENT_FINGERPRINTS` - Comma-separated list of allowed client certificate fingerprints (optional)
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)
7576

7677
#### Outbound mTLS to KMS
7778

7879
- When `TLS_MODE=mtls`, outbound mTLS to KMS is enabled by default.
7980
- The same `TLS_CERT` and `TLS_KEY` are used as the client certificate and key for outbound mTLS requests to KMS.
8081
- `KMS_TLS_CERT_PATH` - Path to the CA certificate to verify the KMS server (required when outbound mTLS is enabled).
8182
- If `TLS_MODE=disabled`, outbound mTLS to KMS is also disabled by default.
83+
- `KMS_SERVER_CERT_ALLOW_SELF_SIGNED` - Allow self-signed certificates from the KMS (default: false)
8284

8385
> **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.
8486
@@ -105,10 +107,11 @@ openssl req -new -x509 -key server.key -out server.crt -days 365 -subj "/CN=loca
105107
```bash
106108
export APP_MODE=advanced-wallet-manager
107109
export KMS_URL=https://your-kms-service
110+
export KMS_TLS_CERT_PATH=./server.crt
111+
export KMS_SERVER_CERT_ALLOW_SELF_SIGNED=true
108112
export TLS_KEY_PATH=./server.key
109113
export TLS_CERT_PATH=./server.crt
110-
export MTLS_REQUEST_CERT=true
111-
export ALLOW_SELF_SIGNED=true
114+
export CLIENT_CERT_ALLOW_SELF_SIGNED=true
112115
npm start
113116
```
114117

@@ -123,8 +126,8 @@ export TLS_KEY_PATH=./server.key
123126
export TLS_CERT_PATH=./server.crt
124127
export ADVANCED_WALLET_MANAGER_URL=https://localhost:3080
125128
export ADVANCED_WALLET_MANAGER_CERT=./server.crt
126-
export MTLS_REQUEST_CERT=false
127-
export ALLOW_SELF_SIGNED=true
129+
export AWM_SERVER_CERT_ALLOW_SELF_SIGNED=true
130+
export CLIENT_CERT_ALLOW_SELF_SIGNED=true
128131
npm start
129132
```
130133

@@ -141,7 +144,7 @@ curl -k -X POST https://localhost:3081/ping/advancedWalletManager
141144
### Security Best Practices
142145

143146
1. **Use CA-signed certificates** instead of self-signed
144-
2. **Set `ALLOW_SELF_SIGNED=false`** in production
147+
2. **Set `CLIENT_CERT_ALLOW_SELF_SIGNED=false`** in production
145148
3. **Configure client certificate allowlisting** with `MTLS_ALLOWED_CLIENT_FINGERPRINTS`
146149
4. **Use separate certificates** for each service
147150
5. **Regularly rotate certificates**
@@ -157,7 +160,7 @@ export KMS_URL=https://production-kms.example.com
157160
export TLS_KEY_PATH=/secure/path/advanced-wallet-manager.key
158161
export TLS_CERT_PATH=/secure/path/advanced-wallet-manager.crt
159162
export MTLS_REQUEST_CERT=true
160-
export ALLOW_SELF_SIGNED=false
163+
export CLIENT_CERT_ALLOW_SELF_SIGNED=false
161164
export MTLS_ALLOWED_CLIENT_FINGERPRINTS=ABC123...,DEF456...
162165
npm start
163166
```
@@ -172,7 +175,7 @@ export TLS_CERT_PATH=/secure/path/master.crt
172175
export ADVANCED_WALLET_MANAGER_URL=https://advanced-wallet-manager.internal.example.com:3080
173176
export ADVANCED_WALLET_MANAGER_CERT=/secure/path/advanced-wallet-manager.crt
174177
export MTLS_REQUEST_CERT=true
175-
export ALLOW_SELF_SIGNED=false
178+
export CLIENT_CERT_ALLOW_SELF_SIGNED=false
176179
npm start
177180
```
178181

@@ -202,7 +205,7 @@ podman run -d \
202205
-e TLS_CERT_PATH=/app/certs/advanced-wallet-manager-cert.pem \
203206
-e KMS_URL=host.containers.internal:3000 \
204207
-e NODE_ENV=development \
205-
-e ALLOW_SELF_SIGNED=true \
208+
-e CLIENT_CERT_ALLOW_SELF_SIGNED=true \
206209
bitgo-onprem-express
207210

208211
# View logs
@@ -222,7 +225,7 @@ podman run -d \
222225
-e TLS_CERT_PATH=/app/certs/test-ssl-cert.pem \
223226
-e ADVANCED_WALLET_MANAGER_URL=https://host.containers.internal:3080 \
224227
-e ADVANCED_WALLET_MANAGER_CERT=/app/certs/advanced-wallet-manager-cert.pem \
225-
-e ALLOW_SELF_SIGNED=true \
228+
-e CLIENT_CERT_ALLOW_SELF_SIGNED=true \
226229
bitgo-onprem-express
227230

228231
# View logs
@@ -276,7 +279,7 @@ openssl x509 -in certificate.crt -text -noout
276279
#### 2. mTLS Authentication Failures
277280

278281
- Verify client certificates are provided
279-
- Check `ALLOW_SELF_SIGNED` setting matches certificate type
282+
- Check `CLIENT_CERT_ALLOW_SELF_SIGNED` setting matches certificate type
280283
- Confirm client certificate fingerprints are in allowlist
281284
- Ensure both services use compatible TLS settings
282285

src/__tests__/api/advancedWalletManager/kmsClient.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('postMpcV2Key', () => {
3030
httpLoggerFile: '',
3131
kmsUrl: kmsUrl,
3232
tlsMode: TlsMode.DISABLED,
33-
allowSelfSigned: true,
33+
clientCertAllowSelfSigned: true,
3434
};
3535

3636
// app setup

src/__tests__/api/advancedWalletManager/mpcFinalize.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('MPC Finalize', () => {
2929
httpLoggerFile: '',
3030
kmsUrl: kmsUrl,
3131
tlsMode: TlsMode.DISABLED,
32-
allowSelfSigned: true,
32+
clientCertAllowSelfSigned: true,
3333
};
3434

3535
app = enclavedApp(cfg);

src/__tests__/api/advancedWalletManager/mpcInitialize.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('MPC Initialize', () => {
3030
httpLoggerFile: '',
3131
kmsUrl: kmsUrl,
3232
tlsMode: TlsMode.DISABLED,
33-
allowSelfSigned: true,
33+
clientCertAllowSelfSigned: true,
3434
};
3535

3636
// configStub = sinon.stub(configModule, 'initConfig').returns(cfg);

src/__tests__/api/advancedWalletManager/nonRecovery.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('Non Recovery', () => {
1818
timeout: 60000,
1919
tlsMode: TlsMode.DISABLED,
2020
httpLoggerFile: '',
21-
allowSelfSigned: true,
21+
clientCertAllowSelfSigned: true,
2222
kmsUrl: 'kms.example.com',
2323
};
2424

src/__tests__/api/advancedWalletManager/postIndependentKey.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('postIndependentKey', () => {
3636
httpLoggerFile: '',
3737
kmsUrl: kmsUrl,
3838
tlsMode: TlsMode.DISABLED,
39-
allowSelfSigned: true,
39+
clientCertAllowSelfSigned: true,
4040
};
4141

4242
// app setup

src/__tests__/api/advancedWalletManager/postMpcV2Key.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('postMpcV2Key', () => {
3838
httpLoggerFile: '',
3939
kmsUrl: kmsUrl,
4040
tlsMode: TlsMode.DISABLED,
41-
allowSelfSigned: true,
41+
clientCertAllowSelfSigned: true,
4242
};
4343

4444
configStub = sinon.stub(configModule, 'initConfig').returns(cfg);

src/__tests__/api/advancedWalletManager/recoveryMpcV2.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('recoveryMpcV2', async () => {
6262
kmsUrl: kmsUrl,
6363
httpLoggerFile: '',
6464
tlsMode: TlsMode.DISABLED,
65-
allowSelfSigned: true,
65+
clientCertAllowSelfSigned: true,
6666
recoveryMode: true,
6767
};
6868

src/__tests__/api/advancedWalletManager/recoveryMultisigTransaction.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('UTXO recovery', () => {
2020
timeout: 60000,
2121
httpLoggerFile: '',
2222
tlsMode: TlsMode.DISABLED,
23-
allowSelfSigned: true,
23+
clientCertAllowSelfSigned: true,
2424
kmsUrl: 'kms.example.com',
2525
recoveryMode: true,
2626
};

src/__tests__/api/advancedWalletManager/recoveryMusigEth.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('recoveryMultisigTransaction', () => {
3939
httpLoggerFile: '',
4040
kmsUrl: kmsUrl,
4141
tlsMode: TlsMode.DISABLED,
42-
allowSelfSigned: true,
42+
clientCertAllowSelfSigned: true,
4343
recoveryMode: true,
4444
};
4545

0 commit comments

Comments
 (0)