Skip to content

Commit

Permalink
fix star and dot
Browse files Browse the repository at this point in the history
  • Loading branch information
elfranne committed Jun 23, 2023
1 parent 4aaab71 commit d3425ac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/cert/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ func CollectMetrics(ctx context.Context, path string, cfg Config) (Metrics, erro
if err != nil {
return metrics, err
}
metrics.Tags = map[string]string{"subject": cert.Subject.CommonName}
fixStar := strings.Replace(cert.Subject.CommonName, "*", "STAR", 1)
fixDot := strings.ReplaceAll(fixStar, ".", "_")
metrics.Tags = map[string]string{"subject": fixDot}
if cfg.ServerName != "" {
if err := cert.VerifyHostname(cfg.ServerName); err != nil {
return metrics, fmt.Errorf("error supplied servername not valid for this certificate: %v", err)
Expand Down

0 comments on commit d3425ac

Please sign in to comment.