I started using Guix System a few weeks ago, and thus far I’m really impressed. There’s just one thing I just haven’t been able to wrap my head around: how do I trust custom CA certificates?
I have a PEM encoded CA certificate that I want to trust (preferably on the entire system) so that I can curl/wget/whatever without having to specify any environment variables or flags. I guess I should have to modify the nss-certs package to do this?
I’ve created a package to install custom certificates system-wide. I first created my own channel to host the package definition. It has the following directory structure,
The top level directory name was chosen arbitrarily, but the rest follow Guix system conventions. Inside the packages.scm file is just a helper function,
I marked this as non-free since it is for my company’s internal network, choose whichever license you want for yours. Also, the certs must be in .pem format for Guix’s bundling step to work.
After adding the channel, this package can be included to your system config, or user package list just like any other package.
the nss-certs package inherits its source from nss. it gets pulled from https://ftp.mozilla.org/pub/mozilla.org/security/nss/... and is validated by hash.
@spk44’s suggestion is in the right direction. Some versioning on the (source ...) that the .pem files are fetched from would be essential later on.
I think the files just need to be in /etc/ssl/certs and $SSL_CERT_* vars need to be get set in the system profile. idk i could be wrong.
;; maybe not typically necessary
(native-search-paths
(list $SSL_CERT_DIR
$SSL_CERT_FILE))
idk authoritatively. it depends on:
how you want to inject the trust: system-wide, for a user’s profile, for an application/browser/container.
whether you care about certificate bundles ending up in /gnu/store on build machines
how you want to manage/rotate/revoke trust later. in some cases, resetting trust could require restarting services/apps.
in the past, i think i tried using the extra-special-file which works for a personal system definition… but probably a bad approach.
for managing private x509 trust, i imagine this beats ansible & other config tools by a pretty wide margin.