|
| 1 | +--- |
| 2 | +title: Handling Private CAs |
| 3 | +description: Configure certificate bundles in environments requiring a private CA |
| 4 | +--- |
| 5 | + |
| 6 | +# Background |
| 7 | + |
| 8 | +Some organizations use fully private DNS and certificate authorities which won't validate using standard OS certificate bundles. The Plural console and agent communicate over standard HTTPs and all http clients will fail w/o certificate validation. The simplest way to manage this (and to manage private CAs generally) is to reconfigure the certificate bundles of the various apps. There are three main steps to this: |
| 9 | + |
| 10 | +- set up cert managers trust manager in the relevant cluster(s) |
| 11 | +- configure a configmap volume to `/etc/ssl/certs` to be mounted to all deployments for your management console |
| 12 | +- configure your agents to use a similar configmap volume |
| 13 | + |
| 14 | +## Installing Trust Manager |
| 15 | + |
| 16 | +trust-manager is a simple operator in the cert manager ecosystem that collates certificate bundles and writes them to secrets or config maps. Certificates are not usually sensitive information, so storing them in config maps is still within best-practices, and that will be how we manage it in this tutorial. |
| 17 | + |
| 18 | +To install trust-manager, you can follow cert manager's docs [here](https://cert-manager.io/docs/trust/trust-manager/installation/). It does require an installation of cert-manager as well. Once the operator is installed, you'll want to create a bundle resource, like so: |
| 19 | + |
| 20 | +```yaml |
| 21 | +apiVersion: trust.cert-manager.io/v1alpha1 |
| 22 | +kind: Bundle |
| 23 | +metadata: |
| 24 | + name: plrl-bundle |
| 25 | +spec: |
| 26 | + sources: |
| 27 | + - useDefaultCAs: true |
| 28 | + - inLine: |
| 29 | + | # simple way to specify additional certificates, trust manager supports other sources too |
| 30 | + -----BEGIN CERTIFICATE----- |
| 31 | + MIIC5zCCAc+gAwIBAgIBADANBgkqhkiG9w0BAQsFADAVMRMwEQYDVQQDEwprdWJl |
| 32 | + .... |
| 33 | + 0V3NCaQrXoh+3xrXgX/vMdijYLUSo/YPEWmo |
| 34 | + -----END CERTIFICATE----- |
| 35 | + target: |
| 36 | + configMap: |
| 37 | + key: 'ca-certificates.crt' |
| 38 | +``` |
| 39 | +
|
| 40 | +This will create a ConfigMap named `plrl-bundle` in every namespace, which can then be used by whatever workload, but in this case, we'll focus on the main Plural-specific resources to configure. |
| 41 | + |
| 42 | +Note: once you have all these set up and all agents are healthy, you can use Plural to manage these resources long-term. |
| 43 | + |
| 44 | +## Configure your Console |
| 45 | + |
| 46 | +Our helm chart allows you to reconfigure volumes and volumeMounts globally, which we'll use to mount the cert bundle into `/etc/ssl/certs` for all relevant pods. The helm yaml needed would be: |
| 47 | + |
| 48 | +```yaml |
| 49 | +global: |
| 50 | + additionalVolumes: |
| 51 | + - name: ca-certificate-only |
| 52 | + configMap: |
| 53 | + name: plrl-bundle |
| 54 | + defaultMode: 0644 |
| 55 | + optional: false |
| 56 | + items: |
| 57 | + - key: ca-certificates.crt |
| 58 | + path: ca-certificates.crt |
| 59 | + additionalVolumeMounts: |
| 60 | + - mountPath: /etc/ssl/certs/ |
| 61 | + name: ca-certificate-only |
| 62 | + readOnly: true |
| 63 | +``` |
| 64 | + |
| 65 | +If you use our CRDs to self-manage your console install as well, you can add these values using the `helm.values` field in the `ServiceDeployment` spec like so: |
| 66 | + |
| 67 | +```yaml |
| 68 | +apiVersion: deployments.plural.sh/v1alpha1 |
| 69 | +kind: ServiceDeployment |
| 70 | +metadata: |
| 71 | + name: console |
| 72 | + namespace: infra |
| 73 | +spec: |
| 74 | + namespace: plrl-console # this namespace must be correct |
| 75 | + name: console |
| 76 | + helm: |
| 77 | + version: 0.9.x |
| 78 | + chart: console |
| 79 | + values: |
| 80 | + global: |
| 81 | + additionalVolumes: |
| 82 | + - name: ca-certificate-only |
| 83 | + configMap: |
| 84 | + name: plrl-bundle # note this is the same name as the Bundle defined above |
| 85 | + defaultMode: 0644 |
| 86 | + optional: false |
| 87 | + items: |
| 88 | + - key: ca-certificates.crt |
| 89 | + path: ca-certificates.crt |
| 90 | + additionalVolumeMounts: |
| 91 | + - mountPath: /etc/ssl/certs/ |
| 92 | + name: ca-certificate-only |
| 93 | + readOnly: true |
| 94 | + valuesFrom: |
| 95 | + namespace: plrl-console |
| 96 | + name: console-values |
| 97 | + repository: |
| 98 | + namespace: infra |
| 99 | + name: console |
| 100 | + clusterRef: |
| 101 | + kind: Cluster |
| 102 | + name: mgmt |
| 103 | + namespace: infra |
| 104 | +``` |
| 105 | + |
| 106 | +(See the existing cluster installation docs for more details on the configuration of this CRD) |
| 107 | + |
| 108 | +## Configure your agents |
| 109 | + |
| 110 | +The agent similarly allows for configuring volumes/volumeMounts. You'll want to modify your installation to use custom values. This involves modifying the global agent settings for your installation then passing custom values as you install the agent via cli or terraform. The documentation [here](/deployments/sandboxing#configuring-agent-helm-values) should provide a good overview of how to do this, geared towards customizing docker image registries. |
| 111 | + |
| 112 | +The specific values to bind the CA bundle to the agent container would be: |
| 113 | + |
| 114 | +```yaml |
| 115 | +additionalVolumes: |
| 116 | + - name: ca-certificate-only |
| 117 | + configMap: |
| 118 | + name: plrl-bundle |
| 119 | + defaultMode: 0644 |
| 120 | + optional: false |
| 121 | + items: |
| 122 | + - key: ca-certificates.crt |
| 123 | + path: ca-certificates.crt |
| 124 | +additionalVolumeMounts: |
| 125 | + - mountPath: /etc/ssl/certs/ |
| 126 | + name: ca-certificate-only |
| 127 | + readOnly: true |
| 128 | +``` |
0 commit comments