settings working
This commit is contained in:
@@ -34,14 +34,21 @@ class Command(BaseCommand):
|
||||
parser.add_argument('--expires-after-days', nargs='?', type=int, default=10 * 365, dest='expires')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
for option in {'country', 'city', 'state', 'organisation', 'organisation-unit', 'common-name', 'support-name',
|
||||
'support-email', 'technical-name', 'technical-email', 'entity-id', 'base-url'}:
|
||||
assert option in options and options[option] is not None and len(options[option]) == 1, "Exepecte one " \
|
||||
"value for option" \
|
||||
": " + option
|
||||
options[option] = options[option][0]
|
||||
|
||||
key = rsa.generate_private_key(public_exponent=65537, key_size=2048, backend = default_backend())
|
||||
subject = issuer = x509.Name([
|
||||
x509.NameAttribute(NameOID.COUNTRY_NAME, options['country'][0]),
|
||||
x509.NameAttribute(NameOID.STATE_OR_PROVINCE_NAME, options['state'][0]),
|
||||
x509.NameAttribute(NameOID.LOCALITY_NAME, options['city'][0]),
|
||||
x509.NameAttribute(NameOID.ORGANIZATION_NAME, options['organisation'][0]),
|
||||
x509.NameAttribute(NameOID.ORGANIZATIONAL_UNIT_NAME, options['organisation-unit'][0]),
|
||||
x509.NameAttribute(NameOID.COMMON_NAME, options['common-name'][0]),
|
||||
x509.NameAttribute(NameOID.COUNTRY_NAME, options['country']),
|
||||
x509.NameAttribute(NameOID.STATE_OR_PROVINCE_NAME, options['state']),
|
||||
x509.NameAttribute(NameOID.LOCALITY_NAME, options['city']),
|
||||
x509.NameAttribute(NameOID.ORGANIZATION_NAME, options['organisation']),
|
||||
x509.NameAttribute(NameOID.ORGANIZATIONAL_UNIT_NAME, options['organisation-unit']),
|
||||
x509.NameAttribute(NameOID.COMMON_NAME, options['common-name']),
|
||||
])
|
||||
cert = (
|
||||
x509.CertificateBuilder()
|
||||
|
Reference in New Issue
Block a user