Page MenuHomeVyOS Platform

service https fails with KeyError 'certificate' when any pki ca has no certificate
Open, NormalPublicBUG

Description

If any pki ca entry has no certificate (for example one that only holds a CRL), the service https script raises a KeyError. The CA does not need to be used by HTTPS. After the upgrade the boot commit fails and nginx is not started.

File "/usr/libexec/vyos/conf_mode/service_https.py", line 227, in <setcomp>
    load_certificate(cert_data['certificate'])
KeyError: 'certificate'
set pki ca X crl '<crl>'
set pki certificate C certificate '<cert>'
set pki certificate C private key '<key>'
set service https certificates certificate C
after boot: nginx active
1.5.1            3/3
rolling          0/3  (config-status 1, nginx inactive)

Cause
78bec494b (T9022, https://github.com/vyos/vyos-1x/pull/5296) builds the served chain from every pki ca and reads ['certificate'] without a check. pki itself accepts a CA without a certificate.

Suggested fix
Skip CA entries without a certificate when building the chain (if 'certificate' in cert_data).

Details

Version
rolling, 1.5
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)