From 9065aa3750cd7e3941386875d96e78a6efffcdb0 Mon Sep 17 00:00:00 2001 From: Charles Hendrie Date: Tue, 11 Oct 2016 00:42:09 -0500 Subject: [PATCH] Update the private key regex validation (#435) * Update the private key regex validation Private keys provided by the Let's Encrypt certificate authority as part of their certificate bundle fail the import/upload certificate private key validation. The validation is looking for a specific character sequence at the begin of the certificate. In order to support valid Let's Encrypt private keys, the regex has been updated to check for both the existing sequence and the Let's Encrypt character sequence. Example Let's Encrypt private key: -----BEGIN PRIVATE KEY----- MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCvsiwV8A5+r0tQ QzUAJO0DfoEb9tMWvoFi0DLs9tx88IwMqItPPl9+RNzQnv9qqZR1h4W97sxP8aWY ... AeS667IJO/2DMKaGiEldaVZtgqdUhCL8Rm4XUFVb1GjLa03E4VRU6W7eQ4hgT2a7 cHDAR8MiovNyfT0fm8Xz3ac= -----END PRIVATE KEY----- * Add private key regex for footer Update the import/upload private key validation regex to verify both the header and footer are matching. --- .../static/app/angular/certificates/certificate/upload.tpl.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lemur/static/app/angular/certificates/certificate/upload.tpl.html b/lemur/static/app/angular/certificates/certificate/upload.tpl.html index 26514bf3..c7073c42 100644 --- a/lemur/static/app/angular/certificates/certificate/upload.tpl.html +++ b/lemur/static/app/angular/certificates/certificate/upload.tpl.html @@ -60,7 +60,7 @@
+ class="form-control" ng-pattern="/(^-----BEGIN PRIVATE KEY-----[\S\s]*-----END PRIVATE KEY-----)|(^-----BEGIN RSA PRIVATE KEY-----[\S\s]*-----END RSA PRIVATE KEY-----)/">

Enter a valid certificate.