Skip to content

Commit b902327

Browse files
lfranckeclaude
andauthored
Clarify documentation with an actual example for Server verification (#860)
* Clarify documentation with an actual example for Server verification * Use k8sSearch backend for CA-only server verification The autoTls backend always issues and signs per-pod certificates and therefore requires the CA private key (ca.key); it cannot be used to just publish an existing CA certificate. Use the k8sSearch backend instead, which mounts the ca.crt from a labeled Secret into the Pod. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 9730bd6 commit b902327

3 files changed

Lines changed: 50 additions & 4 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: openldap-tls-ca
6+
labels:
7+
secrets.stackable.tech/class: openldap-tls-ca # <1>
8+
stringData:
9+
ca.crt: | # <2>
10+
-----BEGIN CERTIFICATE-----
11+
...
12+
-----END CERTIFICATE-----
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
apiVersion: secrets.stackable.tech/v1alpha1
3+
kind: SecretClass
4+
metadata:
5+
name: openldap-tls-ca # <1>
6+
spec:
7+
backend:
8+
k8sSearch:
9+
searchNamespace:
10+
pod: {} # <2>

modules/concepts/pages/tls-server-verification.adoc

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,40 @@ This can be useful when you e.g. use public AWS S3 or other public available ser
3838
include::example$tls-server-verification-webpki.yaml[]
3939
----
4040

41-
This example will use TLS and verify the server using the provided ca certificate.
42-
For this to work you need to create a xref:secret-operator:secretclass.adoc[] that - at least - contains the ca certificate.
43-
Note that a SecretClass does not need to have a key but can also work with just a ca cert.
44-
So if you were provided with a ca cert but do not have access to the key you can still use this method.
41+
This example will use TLS and verify the server using the provided CA certificate.
42+
The product CRD references a SecretClass that provides the CA certificate to verify the server against:
4543

4644
[source,yaml]
4745
----
4846
include::example$tls-server-verification-custom-ca.yaml[]
4947
----
5048

49+
The referenced `openldap-tls-ca` SecretClass does not exist yet, you have to create it.
50+
For server verification you only need to make the CA certificate available to the product as-is, so you use the xref:secret-operator:secretclass.adoc#backend-k8ssearch[`k8sSearch` backend], which mounts the contents of a Kubernetes Secret into the Pod.
51+
A SecretClass used only for server verification needs nothing but the CA certificate, it does not need a key.
52+
So if you were provided with a CA certificate but do not have access to its key, you can still use this method.
53+
54+
First, store the CA certificate (in PEM format) that you were given in a Secret.
55+
The Secret must carry the label `secrets.stackable.tech/class` matching the SecretClass name, and the CA certificate must be stored under the key `ca.crt`:
56+
57+
[source,yaml]
58+
----
59+
include::example$secret-server-verification-ca.yaml[]
60+
----
61+
62+
<1> This label must match the name of the SecretClass created below.
63+
<2> The CA certificate in PEM format.
64+
65+
Then create the SecretClass that uses the `k8sSearch` backend to find that Secret:
66+
67+
[source,yaml]
68+
----
69+
include::example$secretclass-server-verification-ca.yaml[]
70+
----
71+
72+
<1> The name of the SecretClass, this is what `caCert.secretClass` above refers to. It must match the Secret's `secrets.stackable.tech/class` label.
73+
<2> The backend looks for the labeled Secret in the same namespace as the Pod that consumes the certificate.
74+
5175
=== Mutual verification
5276
This example will use TLS and verify both - the server and the client using certificates.
5377
For this to work you need to create a xref:secret-operator:secretclass.adoc[] containing the ca certificate and a key to create new client-certificates.

0 commit comments

Comments
 (0)