1
23.1 Legacy Series / Re: Certificate gp12-file generated with Opnsense can't be imported in Zyxel GS1920
« on: May 30, 2023, 09:40:59 am »Since I am only a beginner with the certificate-stuff it is not clear to me what I have to do with the -nokeys -cacerts-Option.The -nokeys -nocerts parameters would create the PKCS#12 archive without the private key and server certificate. Only the CA certificate(s) would be included depending on whether you use -certfile cert.pem or -certfile cert2.pem (presuming your Intermediate CA cert was cert2.pem and not cert1.pem). You could then attempt to import them into the switch. This was to check if the switch accepts CA certificates without them being an extra certificate(s). We know it accepts server certificates, but what about CA certificates. I note this may not be a valid test anyway, depending on how Zyxel have chosen to process the bag. An alternative would be to export the Intermediate CA certificate in the GUI as a PKCS#12 archive and see if that can be imported. Does that make sense now?
But what is not clear to me is what is the benefit of generating the P12-File in the WebGui with including the certificate for the Intermediate-CA. Does any szenario has a benefit of the second certificate?According to the relevant RFC, when setting up the HTTPS connection, a server (in this case your switch) is required to include all intermediate CA certificates in the certificate_list of the Server Certificate Message. The exception is the root CA certificate, which MAY be omitted from the chain specified in the certificate_list.
So essentially, the server is required to provide all the certificates in the chain except the root CA certificate, which should be in your certificate store if you trust it. That way, you only need the trust anchor, i.e. the root CA certificate, and the server will provide any other certificates in the chain.
It is noteworthy that normally, when including the extra CA certificates in a PKCS#12 export, the root CA would also be included, i.e. the whole chain would be in the bag. However, in the case of OPNsense only the issuer certificate is included. One reason could be convenience, as some certificate stores will hold multiple copies of the same certificate when it is imported. So if all certificates are imported, then this could result in multiple copies of the same root CA certificate (and issuing CA certificates) being present in the store, which can introduce additional management overhead. There are likely other compatibility or simplicity reasons for this, but I do note that it is possible this could change in the future and the root CA certificate could end up being included.
I only mention this in the event a vendor might wish to accommodate same, whether it be the presence of a root CA certificate in the PKCS#12 archive generally, or whether it be to check for duplicates before importing.