22. Issue TAK client certificates from a TakClient resource
Date: 2026-11-03
Status
Section titled “Status”Accepted. The restart-on-revoke path in Delete and Consequences is superseded by ADR 24. The resource, Secret shape, RBAC, and data package in this record still apply.
Context
Section titled “Context”A TAK client that uses a certificate needs four things: a key and a certificate signed by the TAK CA, a TAK file user that maps the certificate to its groups, the CA in a truststore, and a connection data package that points at takserver-stream.<domain>:8089. Today the ATAK e2e job does all four by hand on the runner (ADR 14, atak/ci/e2e.sh): openssl signs the certificate, kubectl exec runs UserManager.jar certmod -g <group> in the messaging pod, and a script zips the data package. An operator who wants a device does the same steps from the device docs. Issue #36 asks for a TakClient custom resource that the takserver-oidc Pepr module turns into a certificate, a Secret, and a data package.
What is already true:
- The CA key is not in ConfigMap
cert-migration. Since ADR 2,ca-do-not-share.keyis in Secrettakserver/takserver-ca-key, and the cert Job removes it from the ConfigMap on upgrade. The key is encrypted withCAPASSfrom Secrettakserver-keystore. The ConfigMap still holdsca.pem, which is public. No change to where the key is stored is needed. - The chart
pepr buildwrites runs the module’s admission pods and its watcher as one ServiceAccount,pepr-c72fcf944a4f43bbb386d22371aa640f.pepr/scripts/rbac-scope.tsalready moves the watched objects to named Roles. - The watcher already reads Secret
takserver-certs(admin.pem,admin.key) and Secrettakserver-keystoreto build CloudTAK’s admin Secret.
What TAK Server 5.7 (5.7-RELEASE-14, the upstream tag this repository builds) supports for revocation, from its source:
- A CRL file on the TLS settings.
CoreConfig.xsdallows<crl _name crlFile>inside<security><tls>.SSLConfig.javareads eachcrlFileinto the PKIX trust manager for the streaming ports, andServerConfiguration.javapasses the first one to Tomcat (setCertificateRevocationListFile) for 8443 and the other HTTPS connectors. Both read the file when the TLS context is built.SSLConfig.getInstancecaches that context for the life of the process, and nothing watches the file. A new CRL therefore applies only after the messaging and API pods restart. A connection that is already open is not closed.NioNettyHandlerBaselogsConnection rejected for revoked client certificatewhen a revoked certificate tries to connect. revokeCert.shinsrc/takserver-core/scripts/certs, which runsopenssl ca -revokeandopenssl ca -gencrl.makeRootCa.shalready writes an emptyca.crlwithdefault_crl_days = 730fromconfig.cfg.<auth x509checkRevocation>.X509Authenticatorthen rejects a certificate whose row in thecertificatetable has arevocation_date. That table only holds certificates TAK issued itself through enrollment (TakCertRepository,/certadmin/cert/revoke/{ids}). A certificate signed outside TAK has no row, so this check does not apply to it.- Removing the file user (
DELETE /user-management/api/delete-user/{username}, orcertmod -D). This does not stop the certificate.X509Authenticatormatches a certificate to a file user by SHA-256 fingerprint or by CN. A trusted certificate with no file user still connects, in the anonymous group only. - There is no OCSP responder in this deployment.
enableOCSPexists in the schema, but nothing here would answer it.
Decision
Section titled “Decision”The resource
Section titled “The resource”TakClient, grouptak.uds.dev, versionv1alpha1, namespaced. The TypeScript type is inpepr/api/and the CRD is generated withnpx pepr crd generate. The generated CRD ships in the module chart. The group follows theuds.devnamespace convention (renamed fromtak.jonathanagustin.github.io), andv1alpha1leaves room to change the schema.spec.callsign: the certificate CN and the TAK file user name. It must pass TAK’s username rule.spec.groups: one or more TAK groups, for example["Operators"].spec.validityDays: certificate lifetime, default 30, maximum 365.status.conditions:Ready, with a reason when it is false (InvalidSpec,NoDomain,WaitingForCa,WaitingForAdmin,TakUnavailable) andIssuedwhen it is true. The condition hasobservedGeneration. The Pepr 2.0.7 CRD generator writes onlyconditionsunderstatus, so the serial number, the SHA-256 fingerprint, andnotAfterare annotations (tak.uds.dev/serial,/fingerprint,/not-after) on theTakClientand on its Secret.- A
TakClientis reconciled only in namespacetakclients, which the module chart creates. Its Secret has the same name, in the same namespace, withclient.pem,client.key,ca.pem,package.zip(the data package), andpassword(the PKCS#12 password in the package). Only these Secrets live intakclients, so the watcher’s Secret verbs there need no names. A Role cannot pin Secretcreateto a name, and this keeps that grant away from namespaces with other Secrets. A device in another namespace, such as the ATAK test VM inatak, gets a copy made by whoever deploys it.
Where signing happens
Section titled “Where signing happens”- The watcher signs. It reads
ca.pemfrom ConfigMapcert-migration,ca-do-not-share.keyfrom Secrettakserver-ca-key, andCAPASSfrom Secrettakserver-keystore. It decrypts the CA key in memory with Node’scrypto, generates an RSA 2048 client key, and signs a certificate withextendedKeyUsage = clientAuthand a random 128-bit serial. The CA key is never written to disk, a log, a status field, or another object. - The client key exists only in the output Secret. The image has no key, and git has no key. The existing gitleaks rule and
*.keyignore stay. - The alternative was a Job that runs
makeCert.sh clientin thetakserver-configimage. It would keep the CA key out of the watcher, but the watcher would need Jobcreateand would still have to read the Job’s output, which holds the client key. Signing in the watcher is fewer moving parts and the same set of readers.
Who can read the CA key
Section titled “Who can read the CA key”- The watcher runs as its own ServiceAccount,
pepr-<uuid>-watcher. The admission pods keeppepr-<uuid>.pepr/scripts/rbac-scope.tsadds the account and points the watcher Deployment at it. - Every Secret rule and every
TakClientrule is in a Role or ClusterRole namedpepr-<uuid>-watcher…, bound only to the watcher account. That includesget,list, andwatchon Secrettakserver/takserver-ca-key, by name. The other rules (ConfigMaps, Deployments, pods, Services, and the rest) are bound to both accounts. - The admission pods read only ConfigMap
core-config, so they can read no Secret at all.tests/takclient.shchecks this withkubectl auth can-iagainst both accounts. - Before this change, only the cert Job and cluster administrators could read the CA key.
- Creating a
TakClientis the same as being given a certificate for any TAK group. The CRD has noaggregate-to-editoraggregate-to-adminlabel, so only cluster administrators can create one until someone grants it on purpose.
Registering the client in TAK
Section titled “Registering the client in TAK”- The watcher calls TAK’s admin API on
takserver-api:8443with the admin certificate it already reads:POST /user-management/api/new-userwith the callsign, the groups, and a random password that nobody keeps (TAK requires one).X509Authenticatorthen maps the certificate to that user by CN. UserAuthenticationFile.xmlis not on a volume, so a messaging restart loses the user. The watcher already watchestakserver-messagingfor the startup order. When it becomes Available, the watcher registers everyTakClientagain. ATakClientthat is notReadybecause the CA, the admin certificate, or TAK is not ready yet is tried again every minute: the watcher writes annotationtak.uds.dev/reconcile-retry, which sends another update.- The takserver Package allows ingress to
takserver-apion 8443 from the watcher pods inpepr-system(app: pepr-<uuid>-watcher), with the watcher’s ServiceAccount (pepr-<uuid>-watcher) asremoteServiceAccount.pepr-systemis ambient, liketakserver. - The TAK API’s server certificate is not issued for the Service name, so the watcher checks the chain against the TAK CA and skips the host name check.
Delete
Section titled “Delete”- A Pepr
FinalizeonTakClient:- Deletes the TAK file user, so a new connection gets no groups.
- Adds the serial to the CRL and writes it to Secret
takserver/takserver-crl, signed by the TAK CA, with anextUpdate730 days out, as TAK’s ownconfig.cfgsets. - Deletes the client’s Secret.
- Pepr adds its finalizer in the mutating webhook.
finalize-chart.mjsnarrows that webhook to namespacetakserverand, with match conditions, to the TAK objects (seewebhook-scope.ts).splitTakClientWebhookmoves thetakclientsrule to a second webhook entry that matches only namespacetakclients, with the same path, CA bundle, timeout, and failure policy and without those match conditions. - If finalize cannot finish (the CA is not readable), it keeps the finalizer and writes an annotation 30 seconds later, which runs it again.
- A certificate that Reconcile replaces (the Secret was deleted, the callsign changed, or a third of the lifetime is left) is added to the CRL too.
- The render capability mounts
takserver-crlinto the messaging and API pods, and CoreConfig gets<crl _name="tak-ca" crlFile="certs/crl/ca.crl"/>in<security><tls>. The Secret has the UDS Coreuds.dev/pod-reloadlabel, so UDS Core restarts those pods when the CRL changes and TAK starts rejecting the certificate. Between the delete and the restart, the certificate can still connect, with no groups. - The watcher writes an empty CRL when the Secret is missing, so TAK always has a file to load. The CRL volume is not optional, so a TAK pod waits for it. The watcher checks the CRL when the CA material changes, on each
TakClientreconcile, and once a day. It writes a new one with the same entries whennextUpdateis less than 60 days away, and drops entries for certificates that have expired. Java rejects every client certificate if the CRL has expired. If the CA changes, it writes an empty CRL signed by the new CA. - Finalize removes the finalizer only after the CRL Secret is written. If TAK is not reachable, the user is left behind and the watcher logs it. The revocation restart starts messaging with no file users, so the user is gone after it. The CRL is what stops the certificate.
- Unit tests in
pepr/capabilities/keep the 100% line, branch, and function gate. They cover signing against a CA generated in the test, the data package contents, the status conditions, and the finalizer order. - A cluster test applies a
TakClientfor callsigntakclient-test, waits forReady, connects on 8089 with the Secret’s certificate, and checks/Marti/api/clientEndPointsfor the callsign. It then deletes the resource, waits for the API and messaging pods to restart, and checks that the handshake with that certificate fails. It runs on amd64 and arm64. - The ATAK e2e job applies a
TakClientforatak-deviceand copies its data package into theataknamespace, in place of theopensslandcertmodsteps. tests/takclient.shis tasktest:takclient, the last step oftest:all.
Consequences
Section titled “Consequences”Revocation needs a restart of the TAK API and messaging pods.Superseded by ADR 24: TakClient certificates are signed by TAK and revoked through the certadmin API, so a live connection closes without a pod restart. The CRL remains as a backstop withoutuds.dev/pod-reload.- Adding a CRL to
<security><tls>turns on CRL checks for every certificate the TAK CA signed, including the admin certificate and CloudTAK’s. An expired or unreadable CRL would reject all of them. The watcher keeps it current, andtests/checks that the CRL loads. - The module’s watcher can now read the TAK CA key. A compromise of the watcher pod is a compromise of the CA. The admission pods cannot read it. Before this change, the cert Job was the only workload with that access.
- Deleting the
takclientsnamespace, or uninstalling the module chart, deletes everyTakClientSecret. If the watcher is not running then, the finalizers hold the delete until it is. - The watcher makes HTTPS calls to TAK, which it did not do before. That is a new network rule and a new failure mode, reported in the
Readycondition. - Nothing schedules a renewal. A reconcile issues a new certificate when less than a third of its lifetime is left, but a reconcile runs only when the
TakClientchanges or the watcher starts. Annotationtak.uds.dev/not-aftershows the expiry. Scheduled renewal is a later change. - Certificates that TAK issues through enrollment on 8446 are not affected. They are still revoked through TAK’s own certificate table.