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:
parent
093c7348db
commit
90f6432443
1 changed files with 5 additions and 2 deletions
7
cert.go
7
cert.go
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue