Skip to content

Commit 442c3ce

Browse files
committed
feat: add README to test it with master express
Ticket: WP-4352
1 parent 1a36767 commit 442c3ce

File tree

5 files changed

+169
-205
lines changed

5 files changed

+169
-205
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
dist/
1+
dist/
2+
node_modules/

LICENSE

Lines changed: 0 additions & 202 deletions
This file was deleted.

README.md

Lines changed: 120 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,120 @@
1-
# enclaved-bitgo-express
2-
Enclaved BitGo Express for Advanced Key Management
1+
# Enclaved Express
2+
3+
Enclaved Express is a secure signer implementation for cryptocurrency operations. It's designed to run in a secure enclave environment with flexible security options.
4+
5+
## Overview
6+
7+
This module provides a lightweight, dedicated signing server with these features:
8+
9+
- Focused on signing operations only - no BitGo API dependencies
10+
- Optional TLS security for secure connections
11+
- Client certificate validation when operating in mTLS mode
12+
- Simple configuration and deployment
13+
14+
## Supported Operations
15+
16+
Currently, the following operations are supported:
17+
18+
- `/ping` - Health check endpoint
19+
20+
## Configuration
21+
22+
Configuration is done via environment variables:
23+
24+
### Network Settings
25+
26+
- `PORT` - Port to listen on (default: 3080)
27+
- `BIND` - Address to bind to (default: localhost)
28+
- `TIMEOUT` - Request timeout in milliseconds (default: 305000)
29+
30+
### TLS Settings
31+
32+
- `MASTER_BITGO_EXPRESS_KEYPATH` - Path to server key file (required for TLS)
33+
- `MASTER_BITGO_EXPRESS_CRTPATH` - Path to server certificate file (required for TLS)
34+
- `MTLS_ENABLED` - Enable mTLS mode (default: false)
35+
- `MTLS_REQUEST_CERT` - Whether to request client certificates (default: false)
36+
- `MTLS_REJECT_UNAUTHORIZED` - Whether to reject unauthorized connections (default: false)
37+
- `MTLS_ALLOWED_CLIENT_FINGERPRINTS` - Comma-separated list of allowed client certificate fingerprints (optional)
38+
39+
### Other Settings
40+
41+
- `LOGFILE` - Path to log file (optional)
42+
- `DEBUG` - Debug namespaces to enable (e.g., 'enclaved:*')
43+
44+
## Running Enclaved Express
45+
46+
### Basic Setup (HTTP only)
47+
48+
```bash
49+
yarn start --port 3080
50+
```
51+
52+
### TLS Setup (with mTLS)
53+
54+
For testing purposes, you can use self-signed certificates with relaxed verification:
55+
56+
```bash
57+
MASTER_BITGO_EXPRESS_KEYPATH=./test-ssl-key.pem \
58+
MASTER_BITGO_EXPRESS_CRTPATH=./test-ssl-cert.pem \
59+
MTLS_ENABLED=true \
60+
MTLS_REQUEST_CERT=true \
61+
MTLS_REJECT_UNAUTHORIZED=false \
62+
yarn start --port 3080
63+
```
64+
65+
### Connecting from Regular Express
66+
67+
To connect to Enclaved Express from the regular Express server:
68+
69+
```bash
70+
yarn start --port 4000 \
71+
--enclavedExpressUrl='https://localhost:3080' \
72+
--enclavedExpressSSLCert='./test-ssl-cert.pem' \
73+
--disableproxy \
74+
--debug
75+
```
76+
77+
## Understanding mTLS Configuration
78+
79+
### Server Side (Enclaved Express)
80+
- Uses both certificate and key files
81+
- The key file (`test-ssl-key.pem`) is used to prove the server's identity
82+
- The certificate file (`test-ssl-cert.pem`) is what the server presents to clients
83+
84+
### Client Side (Regular Express)
85+
- For testing, only needs the server's certificate
86+
- `rejectUnauthorized: false` allows testing without strict certificate verification
87+
- In production, proper client certificates should be used
88+
89+
## Security Considerations
90+
91+
- The testing configuration (`MTLS_REJECT_UNAUTHORIZED=false`) should only be used in development
92+
- In production:
93+
- Use proper CA-signed certificates
94+
- Enable strict certificate verification
95+
- Use client certificate allowlisting
96+
- Keep private keys secure
97+
- Regularly rotate certificates
98+
99+
## Troubleshooting
100+
101+
### Common Issues
102+
103+
1. **Certificate Errors**
104+
- Ensure paths to certificate files are correct
105+
- Check file permissions on certificate files
106+
- Verify certificate format is correct
107+
108+
2. **Connection Issues**
109+
- Verify ports are not in use
110+
- Check firewall settings
111+
- Ensure URLs are correct (including https:// prefix)
112+
113+
3. **mTLS Errors**
114+
- Verify mTLS is enabled on both sides
115+
- Check certificate configuration
116+
- Ensure client certificate is trusted by server
117+
118+
## License
119+
120+
MIT

test-ssl-cert.pem

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIDCTCCAfGgAwIBAgIUYN0EUBLwq7uoLwDuTx7gDW0HS2UwDQYJKoZIhvcNAQEL
3+
BQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTI1MDUxNDIxMTUzMVoXDTI2MDUx
4+
NDIxMTUzMVowFDESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEF
5+
AAOCAQ8AMIIBCgKCAQEAmxdCF7xCJcE6yyG+wrdhHMwRiQxbhDLW/hiKQcO/nn7z
6+
QMM9LAV04+WG5LCmm0ygocbfXXhfWn5D6SSSESKTb8dbSj6AJbLSmYjA5vDSzh9R
7+
rO9GzNTDCDne+epo+rN4BOjGh7K83naLei/bEfmklMp7x+TyoBC8Ps/3Eq4HOJfd
8+
UzgV2L3oC/4dCbAnkgK2zanL8KEaH6aM0HytIaqMFYLBs2t8s7HHHcSEadHfjlJu
9+
GwTmTS0nVhJBWYJvF6Pv/SwLFuSo93TJybaMMUSF3oJK35NEYXg6EtibJLUC9RvX
10+
FVLytRA5z+x7FBnGBdi4ctMseecokV4u15ePCB3MXwIDAQABo1MwUTAdBgNVHQ4E
11+
FgQUxHrQZFFBfTfuXeOOoXmHZQ8E6rswHwYDVR0jBBgwFoAUxHrQZFFBfTfuXeOO
12+
oXmHZQ8E6rswDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAj0hy
13+
bwWh2B26cR0ADhuDC0MtGPBH0BrHypJEZ96nUPTY4oxRrjZusgdq60ooqsNyIW6k
14+
cZHkajC/O0V6hnV4yMhLE8ZwA+31iyQakonpT5N1OON4Ddv9Bfvx8xOn75x/+RP+
15+
GlAa31XxivryIi/5y7MEI0PwU34T/6bbMWdBaFRQtbuIXJ/90AZ0fBwIV0vJWjaO
16+
1DriZAJe7hl63ZUw6CsfutpoyKkanF5GQB2CpolR3t1oeHwuDbZ550p1g2XFB6UI
17+
9W+zlggQFeAnthzMoi3erO4sQ3j2b15QLZbk1HXHZcn3+89QcvdUcpG0u51bZdFW
18+
SJ+bnT3TZ9H+szoa1w==
19+
-----END CERTIFICATE-----

test-ssl-key.pem

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
-----BEGIN PRIVATE KEY-----
2+
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCbF0IXvEIlwTrL
3+
Ib7Ct2EczBGJDFuEMtb+GIpBw7+efvNAwz0sBXTj5YbksKabTKChxt9deF9afkPp
4+
JJIRIpNvx1tKPoAlstKZiMDm8NLOH1Gs70bM1MMIOd756mj6s3gE6MaHsrzedot6
5+
L9sR+aSUynvH5PKgELw+z/cSrgc4l91TOBXYvegL/h0JsCeSArbNqcvwoRofpozQ
6+
fK0hqowVgsGza3yzsccdxIRp0d+OUm4bBOZNLSdWEkFZgm8Xo+/9LAsW5Kj3dMnJ
7+
towxRIXegkrfk0RheDoS2JsktQL1G9cVUvK1EDnP7HsUGcYF2Lhy0yx55yiRXi7X
8+
l48IHcxfAgMBAAECggEAAft4dHXgi+ZTX7iiXTobe1MUakxbzcMZ7QzX6jfxTA+o
9+
APeTNuvURFFxDvKUaT8VJ9wzNgOi3F+UHffCB4a0nGTPmDxXm6O/KLKPHKSOso8Y
10+
ln2cdGPHy7l0TdIe3g113EI0FL9GcLrSf5D7Bi4gWhKDJdlETKLKH9dn+2IkD3zE
11+
VM+7pwqYV6XZu2GuZ1om1JE+Hx2D5YLIuRCON0RKpzCLikmM7VErA7sjy7LsCSh9
12+
ty5n1s9GoNtF+YuOD9WeMWGDonMyJdYWTsmFYoT+LF7W+GHoEwvYm9595QuNnxVx
13+
KQ4P5oKm/EfcSiBhCC8BdCIGch9tQPT7c/syVhHG4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