]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
gpo: Decode base64 root cert before importing
authorGabriel Nagy <gabriel.nagy@canonical.com>
Thu, 18 Jan 2024 18:23:24 +0000 (20:23 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 22 Jan 2024 15:41:36 +0000 (15:41 +0000)
The reasoning behind this is described in the previous commit message,
but essentially this should either be wrapped in certificate blocks and
imported as PEM, or converted back to binary and imported as DER.

I've opted for the latter since it's how it used to work before it
regressed in 157335ee93e.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15557

Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com>
Reviewed-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
python/samba/gp/gp_cert_auto_enroll_ext.py
selftest/knownfail.d/gpo [deleted file]

index e2f81b3f3f8189280aa523841e6cffa172e9582c..76b0286abc0e44f762daf9bf34c637ce83792d69 100644 (file)
@@ -217,10 +217,11 @@ def getca(ca, url, trust_dir):
                  ' installed or not configured.')
         if 'cACertificate' in ca:
             log.warn('Installing the server certificate only.')
+            der_certificate = base64.b64decode(ca['cACertificate'])
             try:
-                cert = load_der_x509_certificate(ca['cACertificate'])
+                cert = load_der_x509_certificate(der_certificate)
             except TypeError:
-                cert = load_der_x509_certificate(ca['cACertificate'],
+                cert = load_der_x509_certificate(der_certificate,
                                                  default_backend())
             cert_data = cert.public_bytes(Encoding.PEM)
             with open(root_cert, 'wb') as w:
diff --git a/selftest/knownfail.d/gpo b/selftest/knownfail.d/gpo
deleted file mode 100644 (file)
index f1e590b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba.tests.gpo.samba.tests.gpo.GPOTests.test_gp_cert_auto_enroll_ext_without_ndes