Move certificate verification code to VerifyConnection
This commit is contained in:
@@ -29,7 +29,7 @@ func init() {
|
||||
// Alert the user that the certificate is not trusted
|
||||
fmt.Printf("Warning: Certificate for %s is not trusted!\n", hostname)
|
||||
fmt.Println("This could indicate a Man-in-the-Middle attack.")
|
||||
case gmi.ErrUnknownCertificate:
|
||||
case gmi.ErrCertificateUnknown:
|
||||
// Prompt the user to trust the certificate
|
||||
trust := trustCertificate(cert)
|
||||
switch trust {
|
||||
|
||||
@@ -19,7 +19,7 @@ func main() {
|
||||
cert, err := store.Lookup(hostname)
|
||||
if err != nil {
|
||||
switch err {
|
||||
case gmi.ErrInvalidCertificate:
|
||||
case gmi.ErrCertificateExpired:
|
||||
log.Print("Old certificate expired, creating new one")
|
||||
// Generate a new certificate if the old one is expired.
|
||||
crt, key, err := gmi.NewRawCertificate(hostname, time.Minute)
|
||||
|
||||
Reference in New Issue
Block a user