Просмотр исходного кода

remove incorrect check on revoked certificate dates, add mutex lock for generating CRLs,

Raal Goff 4 лет назад
Родитель
Сommit
40baf73dff
3 измененных файлов с 5 добавлено и 1 удалено
  1. 1 0
      authority/authority.go
  2. 3 0
      authority/tls.go
  3. 1 1
      db/db.go

+ 1 - 0
authority/authority.go

@@ -71,6 +71,7 @@ type Authority struct {
 
 	// CRL vars
 	crlTicker *time.Ticker
+	crlMutex  sync.Mutex
 
 	// Do not re-initialize
 	initOnce  bool

+ 3 - 0
authority/tls.go

@@ -637,6 +637,9 @@ func (a *Authority) GenerateCertificateRevocationList() error {
 		return errors.Errorf("CA does not support CRL Generation")
 	}
 
+	a.crlMutex.Lock() // use a mutex to ensure only one CRL is generated at a time to avoid concurrency issues
+	defer a.crlMutex.Unlock()
+
 	crlInfo, err := crlDB.GetCRL()
 	if err != nil {
 		return errors.Wrap(err, "could not retrieve CRL from database")

+ 1 - 1
db/db.go

@@ -255,7 +255,7 @@ func (db *DB) GetRevokedCertificates() (*[]RevokedCertificateInfo, error) {
 			return nil, err
 		}
 
-		if !data.RevokedAt.IsZero() && data.RevokedAt.After(now) {
+		if !data.RevokedAt.IsZero() {
 			revokedCerts = append(revokedCerts, data)
 		} else if data.RevokedAt.IsZero() {
 			cert, err := db.GetCertificate(data.Serial)