You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mtls certification verification updates and added CRL info (#335)
* mtls certification verification updates and added CRL info
* more clarification and better notes around mtls cert verification and replication auth handling
@@ -146,50 +146,97 @@ You can also define specific mTLS options by specifying an object for mtls with
146
146
147
147
`user` - _Type_: string; _Default_: Common Name
148
148
149
-
This configures a specific username to authenticate as for mTLS connections. If a `user` is defined, any authorized mTLS connection (that authorizes against the certificate authority) will be authenticated as this user. This can also be set to `null`, which indicates that no authentication is performed based on the mTLS authorization. When combined with `required: true`, this can be used to enforce that users must have authorized mTLS _and_ provide credential-based authentication.
149
+
This configures a specific username to authenticate as for HTTP mTLS connections. If a `user` is defined, any authorized mTLS connection (that authorizes against the certificate authority) will be authenticated as this user. This can also be set to `null`, which indicates that no authentication is performed based on the mTLS authorization. When combined with `required: true`, this can be used to enforce that users must have authorized mTLS _and_ provide credential-based authentication.
150
+
151
+
**Note:** MQTT has its own `mqtt.network.mtls.user` setting (see [MQTT configuration](#mqtt)).
150
152
151
153
`required` - _Type_: boolean; _Default_: false
152
154
153
-
This can be enabled to require client certificates (mTLS) for all incoming connections. If enabled, any connection that doesn't provide an authorized certificate will be rejected/closed. By default, this is disabled, and authentication can take place with mTLS _or_ standard credential authentication.
155
+
This can be enabled to require client certificates (mTLS) for all incoming HTTP connections. If enabled, any connection that doesn't provide an authorized certificate will be rejected/closed. By default, this is disabled, and authentication can take place with mTLS _or_ standard credential authentication.
**Note:** MQTT has its own `mqtt.network.mtls.required` setting (see [MQTT configuration](#mqtt)). Replication uses node-based authentication via certificates or IP addresses, with credential-based fallback (see [Securing Replication Connections](../developers/replication/#securing-connections)).
156
158
157
-
When mTLS is enabled, Harper verifies the revocation status of client certificates using OCSP (Online Certificate Status Protocol). This ensures that revoked certificates cannot be used for authentication.
Set to `false` to disable certificate verification, or configure with an object:
161
+
When mTLS is enabled, Harper can verify the revocation status of client certificates using CRL (Certificate Revocation List) and/or OCSP (Online Certificate Status Protocol). This ensures that revoked certificates cannot be used for authentication.
160
162
161
-
- `timeout` - _Type_: number; _Default_: 5000 - Maximum milliseconds to wait for OCSP response
**Certificate verification is disabled by default** and must be explicitly enabled for production environments where certificate revocation checking is required.
164
+
165
+
Set to `true` to enable with defaults, `false` to disable, or configure with an object:
166
+
167
+
**Global Settings:**
168
+
169
+
- `failureMode` - _Type_: string; _Default_: 'fail-closed' - Global behavior when verification fails:
164
170
- `'fail-open'`: Allow connection on verification failure (logs warning)
165
-
- `'fail-closed'`: Reject connection on verification failure
171
+
- `'fail-closed'`: Reject connection on verification failure (recommended)
172
+
173
+
**CRL Configuration:** (enabled by default when certificateVerification is enabled)
Harper uses a CRL-first strategy with OCSP fallback. When a client certificate is presented:
191
+
192
+
1. Check CRL if available (fast, cached locally)
193
+
2. Fall back to OCSP if CRL is not available or fails
194
+
3. Apply the configured failure mode if both methods fail
166
195
167
196
Example configurations:
168
197
169
198
```yaml
170
-
# Basic mTLS with default certificate verification
199
+
# Basic mTLS without certificate verification (certificate revocation not checked)
171
200
http:
172
201
mtls: true
173
202
```
174
203
175
204
```yaml
176
-
# mTLS with certificate verification disabled (not recommended for production)
205
+
# mTLS with certificate verification enabled (recommended for production)
206
+
http:
207
+
mtls:
208
+
certificateVerification: true # Uses all defaults (CRL + OCSP, fail-closed)
209
+
```
210
+
211
+
```yaml
212
+
# Require mTLS for all connections + certificate verification
177
213
http:
178
214
mtls:
179
-
required: true
180
-
user: user-name
181
-
certificateVerification: false
215
+
required: true # Reject connections without valid client certificate
216
+
certificateVerification: true
182
217
```
183
218
184
219
```yaml
185
220
# mTLS with custom verification settings for high-security environments
186
221
http:
187
222
mtls:
188
-
required: true
189
223
certificateVerification:
190
-
timeout: 10000 # 10 seconds for OCSP response
191
-
cacheTtl: 7200000 # Cache results for 2 hours
192
-
failureMode: fail-closed # Reject if OCSP check fails
224
+
failureMode: fail-closed # Global setting
225
+
crl:
226
+
timeout: 15000 # 15 seconds for CRL download
227
+
cacheTtl: 43200000 # Cache CRLs for 12 hours
228
+
gracePeriod: 86400000 # 24 hour grace period
229
+
ocsp:
230
+
timeout: 8000 # 8 seconds for OCSP response
231
+
cacheTtl: 7200000 # Cache results for 2 hours
232
+
```
233
+
234
+
```yaml
235
+
# mTLS with CRL only (no OCSP fallback)
236
+
http:
237
+
mtls:
238
+
certificateVerification:
239
+
ocsp: false # Disable OCSP, CRL remains enabled
193
240
```
194
241
195
242
---
@@ -302,6 +349,68 @@ The port to use for secure replication connections.
302
349
303
350
When true, Harper will verify certificates against the Node.js bundled CA store. The bundled CA store is a snapshot of the Mozilla CA store that is fixed at release time.
304
351
352
+
`mtls` - _Type_: object;
353
+
354
+
Configures mTLS settings for replication connections. **mTLS is always required for replication** and cannot be disabled (for security reasons). You can configure certificate verification settings:
When enabled, Harper will verify the revocation status of replication peer certificates using CRL and/or OCSP. This follows the same configuration structure as [HTTP certificate verification](#http) documented above.
365
+
366
+
**Important:** mTLS itself is always enabled for replication connections and cannot be disabled. This setting only controls whether certificate revocation checking (CRL/OCSP) is performed.
367
+
368
+
Example configurations:
369
+
370
+
```yaml
371
+
# Replication with mTLS but no certificate verification (default)
372
+
replication:
373
+
hostname: server-one
374
+
routes:
375
+
- server-two
376
+
# mTLS is always enabled, certificate verification is optional
377
+
```
378
+
379
+
```yaml
380
+
# Replication with certificate verification enabled (recommended for production)
381
+
replication:
382
+
hostname: server-one
383
+
routes:
384
+
- server-two
385
+
mtls:
386
+
certificateVerification: true # Uses CRL and OCSP with defaults
387
+
```
388
+
389
+
```yaml
390
+
# Replication with custom certificate verification settings
391
+
replication:
392
+
hostname: server-one
393
+
routes:
394
+
- server-two
395
+
mtls:
396
+
certificateVerification:
397
+
crl:
398
+
timeout: 15000
399
+
cacheTtl: 43200000
400
+
ocsp:
401
+
timeout: 8000
402
+
```
403
+
404
+
Certificate verification can also be configured via environment variables:
Copy file name to clipboardExpand all lines: docs/developers/replication/index.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,9 +75,12 @@ replication:
75
75
76
76
### Securing Connections
77
77
78
-
Harper supports the highest levels of security through public key infrastructure based security and authorization. Depending on your security configuration, you can configure Harper in several different ways to build a connected cluster.
78
+
Harper supports the highest levels of security through public key infrastructure based security and authorization. Replication connections use WebSocket protocol and support multiple authentication methods depending on your security configuration:
79
79
80
-
When using certificate-based authentication, Harper automatically performs OCSP (Online Certificate Status Protocol) verification to check if certificates have been revoked. This ensures that compromised certificates cannot be used for replication connections. Certificate verification settings follow the same configuration as HTTP mTLS connections (see [certificate verification configuration](../../deployments/configuration#http)).
80
+
- **Certificate-based authentication** (recommended for production): Nodes are identified by the certificate's common name (CN) or Subject Alternative Names (SANs)
81
+
- **IP-based authentication** (for development/testing): Nodes are identified by their IP address when using insecure connections (see [Insecure Connection IP-based Authentication](#insecure-connection-ip-based-authentication) below)
82
+
83
+
When using certificate-based authentication, Harper can automatically perform CRL (Certificate Revocation List) and OCSP (Online Certificate Status Protocol) verification to check if certificates have been revoked. This ensures that compromised certificates cannot be used for replication connections. OCSP and CRL verification works automatically with certificates from public certificate authorities (like Let's Encrypt or DigiCert) when `enableRootCAs` is enabled, as these certificates include the necessary OCSP responder URLs and CRL distribution points. For self-signed certificates or private CAs that don't support OCSP/CRL, you can use Harper's manual certificate revocation feature (see [Revoking Certificates](#revoking-certificates) below). Certificate verification settings follow the same configuration as HTTP mTLS connections (see [certificate verification configuration](../../deployments/configuration#http)).
Copy file name to clipboardExpand all lines: docs/developers/security/certificate-management.md
+79Lines changed: 79 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,6 +55,85 @@ tls:
55
55
...
56
56
```
57
57
58
+
### Certificate Revocation Checking
59
+
60
+
When using mTLS, you may also want to enable certificate revocation checking to ensure that revoked certificates cannot be used for authentication, even if they're still within their validity period. Harper supports two industry-standard methods for checking certificate revocation status:
61
+
62
+
**CRL (Certificate Revocation List)**
63
+
64
+
- A digitally signed list of revoked certificates published by the Certificate Authority
65
+
- Downloaded and cached locally for fast verification
66
+
- Updated periodically (typically daily)
67
+
- Best for: High-volume verification, offline scenarios, predictable bandwidth usage
68
+
69
+
**OCSP (Online Certificate Status Protocol)**
70
+
71
+
- Real-time query to check individual certificate status
72
+
- Provides immediate revocation status
73
+
- Requires network connection for each check (with caching)
74
+
- Best for: Real-time revocation status, certificates without CRL distribution points
75
+
76
+
**Harper's Approach: CRL-First with OCSP Fallback**
77
+
78
+
Harper uses a CRL-first strategy for optimal performance:
79
+
80
+
1. Checks CRL if available (fast, cached locally for 24 hours by default)
81
+
2. Falls back to OCSP if CRL is not available or fails (cached for 1 hour by default)
82
+
3. Applies the configured failure mode if both methods fail
83
+
84
+
This strategy provides the best balance of performance, reliability, and security.
85
+
86
+
**Enabling Certificate Verification**
87
+
88
+
Certificate revocation checking is disabled by default and must be explicitly enabled:
89
+
90
+
```yaml
91
+
http:
92
+
mtls:
93
+
required: true
94
+
certificateVerification: true # Enable with defaults
95
+
```
96
+
97
+
For production environments with high-security requirements, you can customize the verification settings:
98
+
99
+
```yaml
100
+
http:
101
+
mtls:
102
+
required: true
103
+
certificateVerification:
104
+
failureMode: fail-closed # Reject connections on verification failure
105
+
crl:
106
+
timeout: 15000 # 15 seconds to download CRL
107
+
cacheTtl: 43200000 # Cache for 12 hours
108
+
ocsp:
109
+
timeout: 8000 # 8 seconds for OCSP response
110
+
cacheTtl: 7200000 # Cache for 2 hours
111
+
```
112
+
113
+
**Performance Considerations**
114
+
115
+
- **CRL caching**: CRLs are cached locally, so subsequent verifications are very fast (no network requests)
116
+
- **OCSP caching**: Successful OCSP responses are cached (1 hour by default), errors cached for 5 minutes
117
+
- **Background refresh**: CRLs are refreshed in the background before expiration to avoid blocking requests
0 commit comments