dnstapir / pop

DNS TAPIR Policy Processor
BSD 2-Clause "Simplified" License
1 stars 1 forks source link

Move from MQTT topics being configureable to not. #55

Open johanix opened 2 months ago

johanix commented 2 months ago

There is lot's of opportunity to get the topics wrong as long as they are configurable. In particular, as part of the topic name often has to match the cert CN, it seems like it would be better to create the topic internally and not have that as a set of config options.

For the particular case of the CN, this is how to extract it from the cert:

// Parse the certificate
cert, err := x509.ParseCertificate(block.Bytes)
if err != nil {
    log.Fatalf("failed to parse certificate: %v", err)
}

// Extract the Common Name (CN)
cn := cert.Subject.CommonName