Beispiel #1
0
func (r *reconcile) downloadCertificate(c *storage.Certificate) error {
	log.Debugf("downloading certificate %v", c)

	cl := r.getGenericClient()

	crt := acmeapi.Certificate{
		URI: c.URL,
	}

	err := cl.WaitForCertificate(&crt, context.TODO())
	if err != nil {
		return err
	}

	if len(crt.Certificate) == 0 {
		return fmt.Errorf("nil certificate?")
	}

	c.Certificates = [][]byte{crt.Certificate}
	c.Certificates = append(c.Certificates, crt.ExtraCertificates...)
	c.Cached = true

	err = r.store.SaveCertificate(c)
	if err != nil {
		log.Errore(err, "failed to save certificate after retrieval: %v", c)
		return err
	}

	return nil
}
Beispiel #2
0
func (r *reconcile) revokeCertificate(c *storage.Certificate) error {
	err := r.revokeCertificateInner(c)
	if err != nil {
		return err
	}

	c.Revoked = true
	err = r.store.SaveCertificate(c)
	if err != nil {
		log.Errore(err, "failed to save certificate after revocation: ", c)
		return err
	}

	return nil
}