1. NetBSD<=9 situation
  2. NetBSD 10 and certctl(8)
  3. Transitions
    1. Fresh installation with sysinst(8)
    2. Fresh installation with live images (live-image, mkimage, arm64.img, etc.)
    3. Upgrade with sysinst(8)
    4. etcupdate(8)
    5. postinstall(8)
  4. certctl(8) proposal and discussions

NetBSD<=9 situation

Prior to NetBSD 10, NetBSD did not ship any CA certificates for TLS trust anchors, so tools such as pkg_add(8) and ftp(1) would simply not do TLS validation in HTTPS requests.

Applications using OpenSSL look in /etc/openssl/certs by default for hashed certificate links as trust anchors, and pkgsrc's security/openssl/builtin.mk sets SSLCERTS to /etc/openssl/certs to reflect that. Some applications also consult /etc/openssl/certs/ca-certificates.crt for a single-file bundle of concatenated PEM files.

Note: /etc/openssl/certs is only for TLS trust anchors. There is no standard directory that applications will consult for, e.g., S/MIME trust anchors for email.

Several pkgsrc packages provide trust anchors and different ways to manage /etc/openssl/certs, mostly from the Mozilla certdata.txt repository:

Users can also manage /etc/openssl/certs manually or in other ways, e.g. to include internal site trust anchors not fit for the public internet.

NetBSD 10 and certctl(8)

NetBSD 10 ships with:

If you upgrade from NetBSD<=9 to NetBSD 10, it will avoid changing your existing configuration of /etc/openssl/certs. You can switch to using certctl(8) if you want as follows:

Other configuration choices you may want to make:

Transitions

Fresh installation with sysinst(8)

sysinst(8) extracts an empty /etc/openssl/certs from base.tgz and default /etc/openssl/certs.conf from etc.tgz, and then runs certctl rehash.

That way, fresh installations have trust anchors installed and configured out of the box.

Fresh installation with live images (live-image, mkimage, arm64.img, etc.)

XXX OOPS -- this doesn't work currently.

Plan: create an rc.d script that runs certctl rehash if /etc/openssl/certs is an empty directory.

Draft patch: https://www.NetBSD.org/~riastradh/tmp/20230926/certctl_init.patch

Upgrade with sysinst(8)

Upgrade with sysinst(8) goes through postinstall(8) (q.v., below).

etcupdate(8)

If you use etcupdate(8) to update etc.tgz on upgrades, it may install the default /etc/openssl/certs.conf for you, which asks certctl(8) to take charge of /etc/openssl/certs.

postinstall(8)

The postinstall(8) script must be run on every upgrade after extracting sets and updating etc (whether with etcupdate(8) or another method of updating the system configuration).

The logic in postinstall(8) is designed to gracefully handle every reasonable upgrade scenario I could think of via two new items:

The only scenario that ends in failure when you run postinstall fix opensslcertsconf opensslcertsrehash is when you have pre-populated /etc/openssl/certs and installed the default /etc/openssl/certs.conf (e.g., with etcupdate(8)) which asks certctl(8) to manage /etc/openssl/certs -- these are inconsistent instructions and the system will fail noisily rather than blow away your existing configuration.

The following transitions have been tested (from the commit):

  1. fresh install: empty /etc/openssl/certs; default /etc/openssl/certs.conf

    • opensslcertsconf
      • check: pass
      • fix: pass -- nothing
    • opensslcertsrehash
      • check: fail -- needs rehash
      • fix: pass -- quietly rehash successfully (go to 4)
  2. fresh upgrade: empty /etc/openssl/certs; no /etc/openssl/certs.conf

    • opensslcertsconf
      • check: fail -- complain missing /etc/openssl/certs.conf
      • fix: pass -- install default /etc/openssl/certs.conf (go to 1)
    • opensslcertsrehash
      • check: fail -- complain missing /etc/openssl/certs.conf
      • fix: fail -- complain missing /etc/openssl/certs.conf
  3. upgrade from certctl, changes to certs: certctl-managed /etc/openssl/certs; default /etc/openssl/certs.conf

    • opensslcertsconf
      • check: pass
      • fix: pass -- nothing
    • opensslcertsrehash
      • check: fail -- needs rehash
      • fix: pass -- quietly rehash successfully (go to 4)
  4. upgrade from certctl, no changes to certs: certctl-managed /etc/openssl/certs; default /etc/openssl/certs.conf

    • opensslcertsconf
      • check: pass
      • fix: pass -- nothing
    • opensslcertsrehash
      • check: pass
      • fix: pass -- quietly rehash successfully (go to 4)
  5. upgrade from mozilla-rootcerts: populated /etc/openssl/certs; no /etc/openssl/certs.conf

    • opensslcertsconf:
      • check: fail -- complain missing /etc/openssl/certs.conf
      • fix: pass -- install manual /etc/openssl/certs.conf (go to 7)
    • opensslcertsrehash:
      • check: fail -- complain missing /etc/openssl/certs.conf
      • fix: fail -- complain missing /etc/openssl/certs.conf
  6. upgrade from mozilla-rootcerts with etcupdate naively: populated /etc/openssl/certs; default /etc/openssl/certs.conf

    • opensslcertsconf:
      • check: pass
      • fix: pass -- nothing
    • opensslcertsrehash:
      • check: fail -- complain mismatched certs/ and certs.conf
      • fix: fail -- complain mismatched certs/ and certs.conf
  7. upgrade from mozilla-rootcerts with etcupdate manually: populated /etc/openssl/certs; manual /etc/openssl/certs.conf

    • opensslcertsconf:
      • check: pass
      • fix: pass -- nothing
    • opensslcertsrehash:
      • check: pass
      • fix: pass -- skip rehash because manual (go to 7)

XXX Should opensslcertsconf check for /etc/openssl/certs/.certctl when /etc/openssl/certs.conf is missing, in case you were previously managing /etc/openssl/certs with certctl(8) and somehow lost /etc/openssl/certs.conf?

certctl(8) proposal and discussions

https://mail-index.NetBSD.org/tech-userlevel/2023/08/22/msg014140.html

Followup discussions: