Skip to content

Commit 8990dac

Browse files
authored
added details around securing MTLS rules
1 parent e537c17 commit 8990dac

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/content/docs/api-shield/security/mtls/configure.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,21 @@ The second expression uses the `http.request.uri.path` field, combined with the
4242

4343
Because the [action](/ruleset-engine/rules-language/actions/) for your rule is *Block*, only requests that present a valid client certificate can access the specified hosts.
4444

45+
For enhanced security, we recommend validating the SHA-256 certificate hash alongside the verified certificate field. This ensures that only requests presenting a valid client certificate with a specific fingerprint are allowed.
46+
47+
You can implement this by using the following expression:
48+
`not (cf.tls_client_auth.cert_verified and cf.tls_client_auth.cert_fingerprint_sha256 eq "253E08C1AB67EB7630C61734D377D75D5DCCDE2F6E69986C221D66E848B64321")`
49+
50+
To retrieve the SHA-256 fingerprint of your client certificate, run the following OpenSSL command:
51+
52+
`openssl x509 -noout -fingerprint -sha256 -inform pem -in mtls.crt | cut -d "=" -f 2 | tr -d ':'`
53+
54+
Example output:
55+
56+
```
57+
253E08C1AB67EB7630C61734D377D75D5DCCDE2F6E69986C221D66E848B64321
58+
```
59+
4560
### Check for revoked certificates
4661

4762
To check for [revoked client certificates](/ssl/client-certificates/revoke-client-certificate/), you can either add a new mTLS rule or add a new expression to the [default rule](#expression-builder). To check for revoked certificates, you must use the Expression Builder.

0 commit comments

Comments
 (0)