Skip to main content

OpenBao agent injector TLS configuration

warning

Important Note: This chart is not compatible with Helm 2. Please use Helm 3.6+ with this chart.

The following instructions demonstrate how to manually configure the OpenBao Agent Injector with self-signed certificates.

Create a certificate authority (CA)

First, create a private key to be used by our custom Certificate Authority (CA):

$ openssl genrsa -out injector-ca.key 2048

Next, create a certificate authority certificate:

warning

Important Note: Values such as days (how long the certificate is valid for) should be configured for your environment.

$ openssl req \
-x509 \
-new \
-nodes \
-key injector-ca.key \
-sha256 \
-days 1825 \
-out injector-ca.crt \
-subj "/C=US/ST=CA/L=San Francisco/O=OpenBao/CN=openbao-agent-injector-svc"

Create OpenBao agent injector certificate

Next we can create a certificate and key signed by the certificate authority generated above. This certificate and key will be used by the OpenBao Agent Injector for TLS communications with the Kubernetes API.

First, create a private key for the certificate:

$ openssl genrsa -out tls.key 2048

Next, create a certificate signing request (CSR) to be used when signing the certificate:

$ openssl req \
-new \
-key tls.key \
-out tls.csr \
-subj "/C=US/ST=CA/L=San Francisco/O=OpenBao/CN=openbao-agent-injector-svc"

After creating the CSR, create an extension file to configure additional parameters for signing the certificate.

warning

Important Note: The alternative names for the certificate must be configured to use the name of the OpenBao Agent Injector Kubernetes service and namespace where its created.

In this example the OpenBao Agent Injector service name is openbao-agent-injector-svc in the openbao namespace. This uses the pattern <k8s service name>.<k8s namespace>.svc.cluster.local.

$ cat <<EOF >csr.conf
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names

[alt_names]
DNS.1 = openbao-agent-injector-svc
DNS.2 = openbao-agent-injector-svc.openbao
DNS.3 = openbao-agent-injector-svc.openbao.svc
DNS.4 = openbao-agent-injector-svc.openbao.svc.cluster.local
EOF

Finally, sign the certificate:

warning

Important Note: Values such as days (how long the certificate is valid for) should be configured for your environment.

$ openssl x509 \
-req \
-in tls.csr \
-CA injector-ca.crt \
-CAkey injector-ca.key \
-CAcreateserial \
-out tls.crt \
-days 1825 \
-sha256 \
-extfile csr.conf

Configuration

Now that a certificate authority and a signed certificate have been created, we can now configure Helm and the OpenBao Agent Injector to use them.

First, create a Kubernetes secret containing the certificate and key created above:

warning

Important Note: This example assumes the OpenBao Agent Injector is running in the openbao namespace.

$ kubectl create secret generic injector-tls \
--from-file tls.crt \
--from-file tls.key \
--namespace=openbao

Next, base64 encode the certificate authority so Kubernetes can verify the authenticity of the certificate:

$ export CA_BUNDLE=$(cat injector-ca.crt | base64)

Finally, install the OpenBao Agent Injector with the following custom values:

$ helm install openbao openbao/openbao \
--namespace=openbao \
--set="injector.certs.secretName=injector-tls" \
--set="injector.certs.caBundle=${CA_BUNDLE?}"