From 46bbd00d09d0ce8d328cfd980447dfa9bfda824e Mon Sep 17 00:00:00 2001 From: Andrew Stoltz Date: Tue, 19 May 2026 17:52:58 -0500 Subject: [PATCH] Add step-ca agent issuer manifest --- .../clusterissuer-step-ca-agent.yaml | 31 ++++++++++++ .../FleetManifestLintTests.cs | 48 +++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 apps/fc-devicemgmt/clusterissuer-step-ca-agent.yaml diff --git a/apps/fc-devicemgmt/clusterissuer-step-ca-agent.yaml b/apps/fc-devicemgmt/clusterissuer-step-ca-agent.yaml new file mode 100644 index 0000000..03fb4cc --- /dev/null +++ b/apps/fc-devicemgmt/clusterissuer-step-ca-agent.yaml @@ -0,0 +1,31 @@ +# Step issuer for FlowerCore.DeviceManagement runtime mTLS leaves. +# +# Requires the smallstep step-issuer CRDs/controller: +# stepclusterissuers.certmanager.step.sm +# The provisioner password lives in the live cert-manager Secret below; do not +# commit the password or generated private key material to this repo. +apiVersion: certmanager.step.sm/v1beta1 +kind: StepClusterIssuer +metadata: + name: step-ca-agent + labels: + app.kubernetes.io/name: step-ca-agent + app.kubernetes.io/component: pki + app.kubernetes.io/part-of: flowercore + app.kubernetes.io/managed-by: argocd + flowercore.io/tenant-id: system + flowercore.io/created-by: bluejay-infra + annotations: + flowercore.io/traceability-standard: k8s-pod-ownership-and-traceability-standard + flowercore.io/provisioner-source: profile::pki::stepca + flowercore.io/secret-source: cert-manager/step-ca-agent-provisioner-password +spec: + url: https://10.0.56.10:9443 + caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJ4RENDQVdxZ0F3SUJBZ0lSQVBZMzU3RzZvdzZ6TUFMNSs0YlMya2t3Q2dZSUtvWkl6ajBFQXdJd1FERWEKTUJnR0ExVUVDaE1SU1VGdFYyOXlhMmx1SUVGRFRVVWdRMEV4SWpBZ0JnTlZCQU1UR1VsQmJWZHZjbXRwYmlCQgpRMDFGSUVOQklGSnZiM1FnUTBFd0hoY05Nall3TXpBNE1UZ3dOekV4V2hjTk16WXdNekExTVRnd056RXhXakJBCk1Sb3dHQVlEVlFRS0V4RkpRVzFYYjNKcmFXNGdRVU5OUlNCRFFURWlNQ0FHQTFVRUF4TVpTVUZ0VjI5eWEybHUKSUVGRFRVVWdRMEVnVW05dmRDQkRRVEJaTUJNR0J5cUdTTTQ5QWdFR0NDcUdTTTQ5QXdFSEEwSUFCSjJuMDRYMQpKWm81WmRxL2kxSWR2OCtmcXdaeUF6Qmg3d2hicWowU1dzSkw4VVdSYWJDTXFZQ3M3K2RYTzB4UlN6cWt3RkRMCngrdm9vT2FpOFJnUk5oYWpSVEJETUE0R0ExVWREd0VCL3dRRUF3SUJCakFTQmdOVkhSTUJBZjhFQ0RBR0FRSC8KQWdFQk1CMEdBMVVkRGdRV0JCUm51UFBRUjZpTS9INnZPbHVpVTNTeWdheXo4akFLQmdncWhrak9QUVFEQWdOSQpBREJGQWlFQXJRSzlkWVBHbUFac2RZbmp6aXVGVlZFNU5LWlVjY2VZdkdmR0MrdExYVXNDSUF1ZEYyekpyQ1JxCjNtSzUwWlpFVC9md1RrSndpRUY0ODI0bWpQOHAxQ0tNCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K + provisioner: + name: step-ca-agent + kid: RF3A9welUYVOWBX8tr19aWyA2kQlxoGZN1dRwTElUEM + passwordRef: + name: step-ca-agent-provisioner-password + namespace: cert-manager + key: password diff --git a/tests/bluejay-infra-lint/FleetManifestLintTests.cs b/tests/bluejay-infra-lint/FleetManifestLintTests.cs index eb9683d..20cec40 100644 --- a/tests/bluejay-infra-lint/FleetManifestLintTests.cs +++ b/tests/bluejay-infra-lint/FleetManifestLintTests.cs @@ -432,6 +432,7 @@ public sealed class FleetManifestLintTests "1password-item.yaml", "argocd-application.yaml", "certificate-web.yaml", + "clusterissuer-step-ca-agent.yaml", "clusterrole-operator.yaml", "clusterrolebinding-operator.yaml", "deployment-operator.yaml", @@ -516,6 +517,53 @@ public sealed class FleetManifestLintTests .ContainSingle("devices.iamworkin.lan"); } + [Fact] + public void FcDeviceManagement_StepCaAgentIssuerMustTargetNocProvisioner() + { + var issuer = FcDeviceManagementDocuments() + .Single(document => document.Kind == "StepClusterIssuer" && document.Name == "step-ca-agent"); + + issuer.Scalar("apiVersion").Should().Be("certmanager.step.sm/v1beta1"); + issuer.Scalar("spec", "url").Should().Be("https://10.0.56.10:9443"); + issuer.Scalar("spec", "caBundle").Should().NotBeNullOrWhiteSpace(); + issuer.Scalar("spec", "provisioner", "name").Should().Be("step-ca-agent"); + issuer.Scalar("spec", "provisioner", "kid").Should().Be("RF3A9welUYVOWBX8tr19aWyA2kQlxoGZN1dRwTElUEM"); + } + + [Fact] + public void FcDeviceManagement_StepCaAgentIssuerMustReferencePasswordSecretOnly() + { + var issuer = FcDeviceManagementDocuments() + .Single(document => document.Kind == "StepClusterIssuer" && document.Name == "step-ca-agent"); + + issuer.Scalar("spec", "provisioner", "passwordRef", "name") + .Should() + .Be("step-ca-agent-provisioner-password"); + issuer.Scalar("spec", "provisioner", "passwordRef", "namespace").Should().Be("cert-manager"); + issuer.Scalar("spec", "provisioner", "passwordRef", "key").Should().Be("password"); + + var issuerText = File.ReadAllText(Path.Combine(Inventory.BluejayRoot, "apps", "fc-devicemgmt", "clusterissuer-step-ca-agent.yaml")); + issuerText.Should().NotContain("stringData:"); + issuerText.Should().NotContain("password:"); + issuerText.Should().NotContain("privateKey"); + } + + [Fact] + public void FcDeviceManagement_StepCaAgentIssuerMustCarryTraceabilityMetadata() + { + var issuer = FcDeviceManagementDocuments() + .Single(document => document.Kind == "StepClusterIssuer" && document.Name == "step-ca-agent"); + + issuer.Scalar("metadata", "labels", "app.kubernetes.io/managed-by").Should().Be("argocd"); + issuer.Scalar("metadata", "labels", "flowercore.io/tenant-id").Should().Be("system"); + issuer.Scalar("metadata", "annotations", "flowercore.io/provisioner-source") + .Should() + .Be("profile::pki::stepca"); + issuer.Scalar("metadata", "annotations", "flowercore.io/secret-source") + .Should() + .Be("cert-manager/step-ca-agent-provisioner-password"); + } + [Fact] public void FcDeviceManagement_OperatorRbacMustCoverDevicesAndOwnerLookup() {