Cleaning up.
This commit is contained in:
@@ -222,11 +222,11 @@ func VerifyCertificateError(cert *x509.Certificate) (revoked, ok bool, err error
|
|||||||
if !time.Now().Before(cert.NotAfter) {
|
if !time.Now().Before(cert.NotAfter) {
|
||||||
msg := fmt.Sprintf("Certificate expired %s\n", cert.NotAfter)
|
msg := fmt.Sprintf("Certificate expired %s\n", cert.NotAfter)
|
||||||
log.Info(msg)
|
log.Info(msg)
|
||||||
return true, true, fmt.Errorf(msg)
|
return true, true, errors.New(msg)
|
||||||
} else if !time.Now().After(cert.NotBefore) {
|
} else if !time.Now().After(cert.NotBefore) {
|
||||||
msg := fmt.Sprintf("Certificate isn't valid until %s\n", cert.NotBefore)
|
msg := fmt.Sprintf("Certificate isn't valid until %s\n", cert.NotBefore)
|
||||||
log.Info(msg)
|
log.Info(msg)
|
||||||
return true, true, fmt.Errorf(msg)
|
return true, true, errors.New(msg)
|
||||||
}
|
}
|
||||||
return revCheck(cert)
|
return revCheck(cert)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"flag"
|
"flag"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
@@ -109,7 +110,7 @@ func checkSite(hostport string) (string, error) {
|
|||||||
|
|
||||||
state := conn.ConnectionState()
|
state := conn.ConnectionState()
|
||||||
if len(state.PeerCertificates) == 0 {
|
if len(state.PeerCertificates) == 0 {
|
||||||
return "UNKNOWN", fmt.Errorf("no peer certificates presented")
|
return "UNKNOWN", errors.New("no peer certificates presented")
|
||||||
}
|
}
|
||||||
return evaluateCert(state.PeerCertificates[0])
|
return evaluateCert(state.PeerCertificates[0])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,10 +39,6 @@ func compress(path, target string, level int) error {
|
|||||||
return errors.Wrap(err, "compressing file")
|
return errors.Wrap(err, "compressing file")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "stat(2)ing destination file")
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user