Add error in certificate check

Signed-off-by: manuelbuil <mbuil@suse.com>
This commit is contained in:
manuelbuil
2025-04-02 13:10:11 +02:00
committed by Manuel Buil
parent 1ccfa5e428
commit 9505f7ff3b

View File

@@ -102,7 +102,11 @@ func check(app *cli.Context, cfg *cmds.Server) error {
for _, file := range files {
// ignore errors, as some files may not exist, or may not contain certs.
// Only check whatever exists and has certs.
certs, _ := certutil.CertsFromFile(file)
certs, err := certutil.CertsFromFile(file)
if err != nil {
logrus.Debugf(err.Error())
continue
}
for _, cert := range certs {
if now.Before(cert.NotBefore) {
logrus.Errorf("%s: certificate %s is not valid before %s", file, cert.Subject, cert.NotBefore.Format(time.RFC3339))
@@ -124,7 +128,11 @@ func check(app *cli.Context, cfg *cmds.Server) error {
fmt.Fprintf(w, "-----------\t-------\t------\t-------")
for _, files := range fileMap {
for _, file := range files {
certs, _ := certutil.CertsFromFile(file)
certs, err := certutil.CertsFromFile(file)
if err != nil {
logrus.Debugf(err.Error())
continue
}
for _, cert := range certs {
baseName := filepath.Base(file)
var status string