Skip to content

Commit 5122ad1

Browse files
committed
feat: ssl status: add severity message when failed to perform tls handshake
1 parent f38ea39 commit 5122ad1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

services/sslstatus/sslcheck.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ func checkSSLExpiry(domain string, logger *log.Logger) string {
2020
cleanDomain := strings.TrimPrefix(domain, "*.")
2121
certs := conn.ConnectionState().PeerCertificates
2222

23+
status := "Info"
24+
2325
if len(certs) > 0 {
2426
cert := certs[0]
2527

26-
status := "Info"
27-
2828
// checking whether the certificate matches the domain being checked
2929
if err := cert.VerifyHostname(cleanDomain); err != nil {
3030
status = "Danger"
@@ -65,7 +65,10 @@ func checkSSLExpiry(domain string, logger *log.Logger) string {
6565
expiredDate)
6666
}
6767

68-
return fmt.Sprintf("failed to perform a TLS handshake for the domain: %s\n", cleanDomain)
68+
status = "Danger"
69+
return fmt.Sprintf("%s: failed to perform a TLS handshake for the domain: %s\n",
70+
status,
71+
cleanDomain)
6972
}
7073

7174
func checkSSLExpiryMulti(domains []string, logger *log.Logger) string {

0 commit comments

Comments
 (0)