func (s *Store) requestCertificateForTarget(t *Target) error { //return fmt.Errorf("not requesting certificate") cl := s.getAccountClient(t.Request.Account) err := solver.AssistedUpsertRegistration(cl, nil, context.TODO()) if err != nil { return err } authsNeeded, err := s.determineNecessaryAuthorizations(t) if err != nil { return err } for _, name := range authsNeeded { log.Debugf("trying to obtain authorization for %#v", name) err := s.obtainAuthorization(name, t.Request.Account) if err != nil { log.Errore(err, "could not obtain authorization for ", name) return err } } csr, err := s.createCSR(t) if err != nil { return err } log.Debugf("requesting certificate for %v", t) acrt, err := cl.RequestCertificate(csr, context.TODO()) if err != nil { log.Errore(err, "could not request certificate") return err } crt := &Certificate{ URL: acrt.URI, } certID := crt.ID() c := s.db.Collection("certs/" + certID) err = fdb.WriteBytes(c, "url", []byte(crt.URL)) if err != nil { log.Errore(err, "could not write certificate URL") return err } s.certs[certID] = crt log.Debugf("downloading certificate which was just requested: %#v", crt.URL) err = s.downloadCertificate(crt) if err != nil { return err } return nil }
func (r *reconcile) EnsureRegistration() error { a, err := r.getAccountByDirectoryURL("") if err != nil { return err } cl := r.getClientForAccount(a) return solver.AssistedUpsertRegistration(cl, nil, context.TODO()) }
func (s *Store) EnsureRegistration() error { a, err := s.getAccountByProviderString("") if err != nil { return err } cl := s.getAccountClient(a) return solver.AssistedUpsertRegistration(cl, nil, context.TODO()) }
func (r *reconcile) requestCertificateForTarget(t *storage.Target) error { //return fmt.Errorf("not requesting certificate") // debugging neuter ensureConceivablySatisfiable(t) acct, err := r.getRequestAccount(&t.Request) if err != nil { return err } cl := r.getClientForAccount(acct) err = solver.AssistedUpsertRegistration(cl, nil, context.TODO()) if err != nil { return err } err = r.obtainNecessaryAuthorizations(t.Request.Names, acct, t.Filename, &t.Request.Challenge) if err != nil { return err } csr, err := r.createCSR(t) if err != nil { return err } log.Debugf("%v: requesting certificate", t) acrt, err := cl.RequestCertificate(csr, context.TODO()) if err != nil { log.Errore(err, "could not request certificate") return err } c, err := r.store.ImportCertificate(acrt.URI) if err != nil { log.Errore(err, "could not import certificate") return err } err = r.downloadCertificate(c) if err != nil { log.Errore(err, "failed to download certificate") return err } return nil }