fix: parse cert CN and subject on OpenSSL 3.x

The `certs` plugin extracted a certificate's Common Name and formatted its subject using string assumptions that only held for pre-3.x OpenSSL output, so a certificate with only a Common Name and no Subject Alternative Name reported no hostnames from `certs:report` and was not recognized during nginx config generation, while the subject report retained the `subject=` prefix and used the wrong separators. Normalizing the subject with `-nameopt` before parsing makes the extraction version independent across OpenSSL and LibreSSL.
This commit is contained in:
Jose Diaz-Gonzalez
2026-07-10 15:05:27 -04:00
parent e47bae8f55
commit 5496029e07
5 changed files with 257 additions and 14 deletions

View File

@@ -146,6 +146,7 @@ lint-shfmt: shfmt
lint: lint-shfmt lint-ci
ci-go-coverage:
@$(MAKE) ci-go-coverage-plugin PLUGIN_NAME=certs
@$(MAKE) ci-go-coverage-plugin PLUGIN_NAME=common
@$(MAKE) ci-go-coverage-plugin PLUGIN_NAME=config
@$(MAKE) ci-go-coverage-plugin PLUGIN_NAME=network
@@ -176,6 +177,7 @@ ci-go-coverage-plugin:
(godacov -r ./../../test-results/coverage/$(PLUGIN_NAME).out -c $$CIRCLE_SHA1 -t $$CODACY_TOKEN || true)" || exit $$?
go-tests:
@$(MAKE) go-test-plugin PLUGIN_NAME=certs
@$(MAKE) go-test-plugin PLUGIN_NAME=common
@$(MAKE) go-test-plugin PLUGIN_NAME=config
@$(MAKE) go-test-plugin PLUGIN_NAME=network