1
0
Fork 0
mirror of https://github.com/Luzifer/promcertcheck.git synced 2024-11-08 16:00:08 +00:00

Add support for ports in probe-URLs

This commit is contained in:
Knut Ahlers 2016-09-29 11:40:55 +02:00
parent 093c7348db
commit 90f6432443
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -53,9 +53,12 @@ func checkCertificate(probeURL *url.URL) (probeResult, *x509.Certificate) {
intermediatePool := x509.NewCertPool()
var verifyCert *x509.Certificate
hostPort := strings.Split(probeURL.Host, ":")
host := hostPort[0]
for _, cert := range resp.TLS.PeerCertificates {
wildHost := "*" + probeURL.Host[strings.Index(probeURL.Host, "."):]
if !inSlice(cert.DNSNames, probeURL.Host) && !inSlice(cert.DNSNames, wildHost) {
wildHost := "*" + host[strings.Index(host, "."):]
if !inSlice(cert.DNSNames, host) && !inSlice(cert.DNSNames, wildHost) {
intermediatePool.AddCert(cert)
continue
}