summaryrefslogtreecommitdiff
path: root/python/samba
diff options
context:
space:
mode:
authorGabriel Nagy <gabriel.nagy@canonical.com>2024-01-18 20:23:24 +0200
committerAndreas Schneider <asn@cryptomilk.org>2024-01-22 15:41:36 +0000
commit3f3ddfa699a33c2c8a59f7fb9ee044bb2a6e0e06 (patch)
tree7ab5d693a6081ec1d6f87972c634ee5af4d3a780 /python/samba
parent0d1ff69936f18ea729fc11fbbb1569a833302572 (diff)
downloadsamba-3f3ddfa699a33c2c8a59f7fb9ee044bb2a6e0e06.tar.gz
samba-3f3ddfa699a33c2c8a59f7fb9ee044bb2a6e0e06.tar.bz2
samba-3f3ddfa699a33c2c8a59f7fb9ee044bb2a6e0e06.zip
gpo: Decode base64 root cert before importing
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>
Diffstat (limited to 'python/samba')
-rw-r--r--python/samba/gp/gp_cert_auto_enroll_ext.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/python/samba/gp/gp_cert_auto_enroll_ext.py b/python/samba/gp/gp_cert_auto_enroll_ext.py
index e2f81b3f3f8..76b0286abc0 100644
--- a/python/samba/gp/gp_cert_auto_enroll_ext.py
+++ b/python/samba/gp/gp_cert_auto_enroll_ext.py
@@ -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: