Skip to content

Commit 4336b33

Browse files
committed
cert verification updates (ocsp)
1 parent 0164379 commit 4336b33

File tree

6 files changed

+107
-19
lines changed

6 files changed

+107
-19
lines changed

docs/deployments/configuration.md

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ http:
130130
timeout: 120000
131131
```
132132

133-
`mlts` - _Type_: boolean | object; _Default_: false
133+
`mtls` - _Type_: boolean | object; _Default_: false
134134

135135
This can be configured to enable mTLS based authentication for incoming connections. If enabled with default options (by setting to `true`), the client certificate will be checked against the certificate authority specified with `tls.certificateAuthority`. And if the certificate can be properly verified, the connection will authenticate users where the user's id/username is specified by the `CN` (common name) from the client certificate's `subject`, by default.
136136

@@ -142,20 +142,46 @@ This configures a specific username to authenticate as for mTLS connections. If
142142

143143
`required` - _Type_: boolean; _Default_: false
144144

145-
This can be enabled to require client certificates (mTLS) for all incoming MQTT 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.
145+
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.
146+
147+
`certificateVerification` - _Type_: boolean | object; _Default_: true
148+
149+
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.
150+
151+
Set to `false` to disable certificate verification, or configure with an object:
152+
153+
- `timeout` - _Type_: number; _Default_: 5000 - Maximum milliseconds to wait for OCSP response
154+
- `cacheTtl` - _Type_: number; _Default_: 3600000 - Milliseconds to cache verification results (default: 1 hour)
155+
- `failureMode` - _Type_: string; _Default_: 'fail-open' - Behavior when OCSP verification fails:
156+
- `'fail-open'`: Allow connection on verification failure (logs warning)
157+
- `'fail-closed'`: Reject connection on verification failure
158+
159+
Example configurations:
146160

147161
```yaml
162+
# Basic mTLS with default certificate verification
148163
http:
149164
mtls: true
150165
```
151166

152-
or
153-
154167
```yaml
168+
# mTLS with certificate verification disabled (not recommended for production)
155169
http:
156170
mtls:
157171
required: true
158172
user: user-name
173+
certificateVerification: false
174+
```
175+
176+
```yaml
177+
# mTLS with custom verification settings for high-security environments
178+
http:
179+
mtls:
180+
required: true
181+
certificateVerification:
182+
timeout: 10000 # 10 seconds for OCSP response
183+
cacheTtl: 7200000 # Cache results for 2 hours
184+
failureMode: fail-closed # Reject if OCSP check fails
159185
```
160186

161187
---
@@ -683,6 +709,7 @@ Harper's logger supports defining multiple logging configurations for different
683709
`logging.external`
684710

685711
The `logging.external` section can be used to define logging for all external components that use the [`logger` API](../technical-details/reference/globals.md). For example:
712+
686713
```yaml
687714
logging:
688715
external:
@@ -693,15 +720,16 @@ logging:
693720
`http.logging`
694721

695722
This section defines log configuration for HTTP logging. By default, HTTP requests are not logged, but defining this section will enable HTTP logging. Note that there can be substantive overhead to logging all HTTP requests. In addition to the standard logging configuration, the `http.logging` section also allows the following configuration properties to be set:
696-
* `timing` - This will log timing information
697-
* `headers` - This will log the headers in each request (which can be very verbose)
698-
* `id` - This will assign a unique id to each request and log it in the entry for each request. This is assigned as the `request.requestId` property and can be used to by other logging to track a request.
723+
- `timing` - This will log timing information
724+
- `headers` - This will log the headers in each request (which can be very verbose)
725+
- `id` - This will assign a unique id to each request and log it in the entry for each request. This is assigned as the `request.requestId` property and can be used to by other logging to track a request.
699726
Note that the `level` will determine which HTTP requests are logged:
700-
* `info` (or more verbose) - All HTTP requests
701-
* `warn` - HTTP requests with a status code of 400 or above
702-
* `error` - HTTP requests with a status code of 500
727+
- `info` (or more verbose) - All HTTP requests
728+
- `warn` - HTTP requests with a status code of 400 or above
729+
- `error` - HTTP requests with a status code of 500
703730

704731
For example:
732+
705733
```yaml
706734
http:
707735
logging:
@@ -739,7 +767,7 @@ This section defines log configuration for setting up and reading the database f
739767

740768
This section defines log configuration for analytics. This takes the standard logging configuration options of `path` (or `root`), `level`, `tag`, and flag to enable/disable logging to `stdStreams`.
741769

742-
***
770+
---
743771

744772
### `authentication`
745773

@@ -1080,7 +1108,7 @@ This enables access to MQTT through WebSockets. This will handle WebSocket conne
10801108

10811109
This indicates if authentication should be required for establishing an MQTT connection (whether through MQTT connection credentials or mTLS). Disabling this allows unauthenticated connections, which are then subject to authorization for publishing and subscribing (and by default tables/resources do not authorize such access, but that can be enabled at the resource level).
10821110

1083-
`mlts` - _Type_: boolean | object; _Default_: false
1111+
`mtls` - _Type_: boolean | object; _Default_: false
10841112

10851113
This can be configured to enable mTLS based authentication for incoming connections. If enabled with default options (by setting to `true`), the client certificate will be checked against the certificate authority specified in the `tls` section. And if the certificate can be properly verified, the connection will authenticate users where the user's id/username is specified by the `CN` (common name) from the client certificate's `subject`, by default.
10861114

@@ -1098,6 +1126,18 @@ This can be enabled to require client certificates (mTLS) for all incoming MQTT
10981126

10991127
This can define a specific path to use for the certificate authority. By default, certificate authorization checks against the CA specified at `tls.certificateAuthority`, but if you need a specific/distinct CA for MQTT, you can set this.
11001128

1129+
`certificateVerification` - _Type_: boolean | object; _Default_: true
1130+
1131+
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.
1132+
1133+
Set to `false` to disable certificate verification, or configure with an object:
1134+
1135+
- `timeout` - _Type_: number; _Default_: 5000 - Maximum milliseconds to wait for OCSP response
1136+
- `cacheTtl` - _Type_: number; _Default_: 3600000 - Milliseconds to cache verification results (default: 1 hour)
1137+
- `failureMode` - _Type_: string; _Default_: 'fail-open' - Behavior when OCSP verification fails:
1138+
- `'fail-open'`: Allow connection on verification failure (logs warning)
1139+
- `'fail-closed'`: Reject connection on verification failure
1140+
11011141
For example, you could specify that mTLS is required and will authenticate as "user-name":
11021142

11031143
```yaml

docs/developers/clustering/certificate-management.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ Once you generate new certificates, to make Harper start using them you can eith
2828

2929
Since these new certificates can be issued with correct CNs, you should set `insecure` to `false` so that nodes will do full validation of the certificates of the other nodes.
3030

31+
### Certificate Revocation Checking
32+
33+
Harper automatically performs certificate revocation checking using OCSP (Online Certificate Status Protocol) for all cluster connections. This critical security feature ensures that:
34+
35+
- Revoked certificates cannot be used for cluster communication
36+
- Compromised nodes can be quickly isolated by revoking their certificates
37+
- Certificate status is verified in real-time with the Certificate Authority
38+
39+
Certificate verification is enabled by default for cluster connections and follows the same configuration as HTTP mTLS connections. The verification settings can be customized in the HTTP configuration section to balance security requirements with performance considerations.
40+
41+
For production clusters, consider using `failureMode: fail-closed` to ensure maximum security by rejecting connections when OCSP verification cannot be completed.
42+
3143
### Certificate Requirements
3244

3345
- Certificates must have an `Extended Key Usage` that defines both `TLS Web Server Authentication` and `TLS Web Client Authentication` as these certificates will be used to accept connections from other Harper nodes and to make requests to other Harper nodes. Example:

docs/developers/real-time.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ mqtt:
3636
requireAuthentication: true
3737
```
3838
39-
Note that if you are using WebSockets for MQTT, the sub-protocol should be set to "mqtt" (this is required by the MQTT specification, and should be included by any conformant client): `Sec-WebSocket-Protocol: mqtt`. mTLS is also supported by enabling it in the configuration and using the certificate authority from the TLS section of the configuration. See the [configuration documentation for more information](../deployments/configuration.md).
39+
Note that if you are using WebSockets for MQTT, the sub-protocol should be set to "mqtt" (this is required by the MQTT specification, and should be included by any conformant client): `Sec-WebSocket-Protocol: mqtt`.
40+
41+
mTLS is also supported by enabling it in the configuration and using the certificate authority from the TLS section of the configuration. When mTLS is enabled for MQTT, Harper automatically performs certificate revocation checking using OCSP (Online Certificate Status Protocol) to ensure that revoked certificates cannot be used for authentication. See the [configuration documentation for more information](../deployments/configuration.md).
4042

4143
#### Capabilities
4244

docs/developers/replication/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ replication:
7373

7474
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.
7575

76+
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.md#http)).
77+
7678
#### Provide your own certificates
7779

7880
If you want to secure your Harper connections with your own signed certificates, you can easily do so. Whether you have certificates from a public authority (like Let's Encrypt or Digicert) or a corporate certificate authority, you can use them to authenticate nodes securely. You can then allow nodes to authorize each other by checking the certificate against the standard list of root certificate authorities by enabling the `enableRootCAs` option in the config:

docs/developers/security/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22

33
Harper uses role-based, attribute-level security to ensure that users can only gain access to the data they’re supposed to be able to access. Our granular permissions allow for unparalleled flexibility and control, and can actually lower the total cost of ownership compared to other database solutions, since you no longer have to replicate subsets of your data to isolate use cases.
44

5-
- [JWT Authentication](jwt-auth.md)
6-
- [Basic Authentication](basic-auth.md)
7-
- [mTLS Authentication](mtls-auth.md)
8-
- [Configuration](configuration.md)
9-
- [Users and Roles](users-and-roles.md)
5+
## Authentication Methods
6+
7+
- [JWT Authentication](jwt-auth.md) - JSON Web Token based authentication
8+
- [Basic Authentication](basic-auth.md) - Username/password authentication
9+
- [mTLS Authentication](mtls-auth.md) - Certificate-based mutual TLS authentication with automatic certificate revocation checking
10+
11+
## Security Configuration
12+
13+
- [Configuration](configuration.md) - Security-related configuration options
14+
- [Users and Roles](users-and-roles.md) - Managing users and role-based permissions
15+
- [Certificate Management](certificate-management.md) - Managing SSL/TLS certificates

docs/developers/security/mtls-auth.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
11
# mTLS Authentication
22

3-
Harper supports mTLS authentication for incoming connections. When enabled in the [HTTP config settings](../../deployments/configuration.md#http) the client certificate will be checked against the certificate authority specified with `tls.certificateAuthority`. If the certificate can be properly verified, the connection will authenticate users where the user's id/username is specified by the `CN` (common name) from the client certificate's `subject`, by default. The [HTTP config settings](../../deployments/configuration.md#http) allow you to determine if mTLS is required for all connections or optional.
3+
Harper supports mTLS (mutual TLS) authentication for incoming connections, providing certificate-based authentication for enhanced security. When enabled in the [HTTP config settings](../../deployments/configuration.md#http), the client certificate will be checked against the certificate authority specified with `tls.certificateAuthority`. If the certificate can be properly verified, the connection will authenticate users where the user's id/username is specified by the `CN` (common name) from the client certificate's `subject`, by default. The [HTTP config settings](../../deployments/configuration.md#http) allow you to determine if mTLS is required for all connections or optional.
4+
5+
## Certificate Verification
6+
7+
When mTLS is enabled, Harper automatically performs certificate revocation checking using OCSP (Online Certificate Status Protocol). OCSP provides real-time verification that certificates have not been revoked by the Certificate Authority, ensuring that compromised or invalidated certificates cannot be used for authentication.
8+
9+
### How It Works
10+
11+
When a client presents a certificate:
12+
13+
1. Harper validates the certificate against the configured Certificate Authority
14+
2. If validation succeeds, Harper queries the CA's OCSP responder to check revocation status
15+
3. The verification result is cached to minimize performance impact on subsequent connections
16+
4. Based on the configuration, the connection is either allowed or rejected
17+
18+
### Key Features
19+
20+
- **Enabled by default** when mTLS is configured
21+
- **Real-time verification** with the Certificate Authority's OCSP responder
22+
- **Intelligent caching** of verification results (default: 1 hour)
23+
- **Configurable timeout** for OCSP responses (default: 5 seconds)
24+
- **Flexible failure handling** with fail-open or fail-closed modes
25+
- **Unified across all protocols** - HTTP, MQTT, and replication connections
26+
27+
### Configuration
28+
29+
Certificate verification can be disabled or customized through the `certificateVerification` setting. See the [HTTP configuration](../../deployments/configuration.md#http) and [MQTT configuration](../../deployments/configuration.md#mqtt) sections for detailed options.

0 commit comments

Comments
 (0)