Hiya. security.pki.certificateFiles is an obvious answer for this question, except it doesnt work when the certificate is stored by agenix.
Is there a way to overcome this?
This is my current code, but it doesnt work either:
Why use agenix? The point of certificates is that they are public, you should just put it in a plaintext file in your repo and use security.pki.certificateFiles as intended.
Then simply don’t publish the git repository containing this cert on a public forge.
Exfiltrating a public cert from the nix store of machines will almost certainly not give you any more metadata than you already have simply by gaining access to the machines in question. Especially since this gives you a company name at best; you can check what metadata your cert contains, you know. agenix is for secrets, public certificates are sensitive data at best.
If you still want to use a public forge, you can just place the cert in a private repo which you either depend on via flake inputs or a fetch* derivation. Hell, you could use a fetch* derivation to grab the cert from wherever you’re downloading it in the first place, or use requireFile if that’s nontrivial.
Instead of manual symlinking, point security.pki.certificateFiles directly to the config.age.secrets.cloudflare-cert.path. Ensure your service waits for the secret decryption before execution.