Use certifi to get the mozilla ca bundle

This commit is contained in:
Ruben van Staveren 2020-03-20 11:27:15 +01:00
parent 1256d13c42
commit fd5b903caa
No known key found for this signature in database
GPG Key ID: 63424959ACCADD9C

View File

@ -7,22 +7,15 @@ from __future__ import print_function
import logging import logging
import re import re
import os
import fileinput import fileinput
from argparse import ArgumentParser from argparse import ArgumentParser
from datetime import datetime from datetime import datetime
from OpenSSL import crypto from OpenSSL import crypto
from Crypto.Util import asn1 from Crypto.Util import asn1
from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives import serialization
import certifi.core
# XXX Scan a couple of known locations to get this file
MOZROOTBUNDLE_LOCATIONS = [
'/etc/ssl/cert.pem',
'/etc/pki/tls/cert.pem',
'/etc/ssl/certs/ca-certificates.crt',
]
VALID_HOSTNAME_RE = '^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])'\ VALID_HOSTNAME_RE = '^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])'\
'(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}'\ '(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}'\
'[a-zA-Z0-9]))*$' '[a-zA-Z0-9]))*$'
@ -195,9 +188,7 @@ def main():
main program start and argument parsing main program start and argument parsing
''' '''
mozrootbundle_location = [fname for fname in MOZROOTBUNDLE_LOCATIONS mozrootbundle_location = certifi.core.where()
if os.path.exists(fname)].pop(0)
parser = ArgumentParser(description='Reorder X509/RSA data for' parser = ArgumentParser(description='Reorder X509/RSA data for'
' hosting use') ' hosting use')