Skip to content

Commit

Permalink
Refactor CA Logic (#84)
Browse files Browse the repository at this point in the history
The way this was done was a little half-baked, everything was separate
except the self-signed issuer, which would lead to really confusing
logic to enable it based on both whether it was required by the client
CA or server CA, compounded by the fact the server CA needed to generate
it in different circumstanes whether or not the CA was provided from an
external source.  This separates concerns, so the logic is vastly
simplified, and makes client CA stuff un-conditional, as they are all
internal anyway and not accessed by a browser.
  • Loading branch information
spjmurray authored Oct 8, 2024
1 parent dbad582 commit a14f6f5
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 20 deletions.
4 changes: 2 additions & 2 deletions charts/core/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: A Helm chart for deploying Unikorn Core

type: application

version: v0.1.74
appVersion: v0.1.74
version: v0.1.75
appVersion: v0.1.75

icon: https://assets.unikorn-cloud.org/images/logos/dark-on-light/icon.svg

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if (and .Values.clientCA .Values.clientCA.enabled .Values.clientCA.generate) }}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
Expand All @@ -10,7 +9,7 @@ spec:
issuerRef:
group: cert-manager.io
kind: Issuer
name: unikorn-self-signed-issuer
name: unikorn-self-signed-client-issuer
privateKey:
algorithm: RSA
encoding: PKCS8
Expand All @@ -19,4 +18,3 @@ spec:
isCA: true
commonName: Unikorn Client CA
duration: 87600h
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if (and .Values.ca .Values.ca.enabled) }}
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
Expand All @@ -8,4 +7,3 @@ metadata:
spec:
ca:
secretName: unikorn-client-ca
{{- end }}
9 changes: 9 additions & 0 deletions charts/core/templates/client-ca/issuer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: unikorn-self-signed-client-issuer
namespace: {{ .Values.certManager.namespace }}
labels:
{{- include "unikorn.labels" . | nindent 4 }}
spec:
selfSigned: {}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 0 additions & 13 deletions charts/core/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,3 @@ ca:
# These must be base64 encoded strings.
# certificate: SSBhbSBjb21wbGV0ZSBub25zZW5zZS4gIFRoYW5rIHlvdSBmb3IgcmVhZGluZyB0aGlzLiAgR2V0IGEgbGlmZSE=
# privateKey: SSBhbSBjb21wbGV0ZSBub25zZW5zZS4gIFRoYW5rIHlvdSBmb3IgcmVhZGluZyB0aGlzLiAgR2V0IGEgbGlmZSE=

# Unikorn uses mTLS for credentialless authentication between componets. This is
# only used in asynchronous controllers where a user access token is not availabile.
clientCA:
# Enable CA and issuer creation.
enabled: true

# Generate a self signed CA.
# This is typically used at a single site to act as the trust root.
# You will need to (somehow) distribute this to other sites so that services
# can issue certificates as the CA is rotated. The other option is to just
# issue them here at the root and distribute then to the services themselves.
generate: true

0 comments on commit a14f6f5

Please sign in to comment.