Ejemplo n.º 1
0
func checkCert(hostURL string, authOptions *auth.Options) error {
	valid, err := cert.ValidateCertificate(hostURL, authOptions)
	if !valid || err != nil {
		return ErrCertInvalid{
			wrappedErr: err,
			hostURL:    hostURL,
		}
	}

	return nil
}
Ejemplo n.º 2
0
func checkCert(hostUrl string, authOptions *auth.AuthOptions, c *cli.Context) error {
	valid, err := cert.ValidateCertificate(
		hostUrl,
		authOptions.CaCertPath,
		authOptions.ServerCertPath,
		authOptions.ServerKeyPath,
	)
	if err != nil {
		return fmt.Errorf("Error attempting to validate the certficate: %s", err)
	}

	if !valid {
		log.Errorf("Invalid certs detected; regenerating for %s", hostUrl)

		if err := runActionWithContext("configureAuth", c); err != nil {
			return fmt.Errorf("Error attempting to regenerate the certs: %s", err)
		}
	}

	return nil
}