|
|
@ -22,8 +22,8 @@ class Command(BaseCommand):
|
|
|
|
parser.add_argument('--city', required=True, nargs=1, type=str, dest='city', help='For example: London or Groningen')
|
|
|
|
parser.add_argument('--city', required=True, nargs=1, type=str, dest='city', help='For example: London or Groningen')
|
|
|
|
parser.add_argument('--state', required=True, nargs=1, type=str, dest='state', help='For example: State or province, for example California or Groningen.')
|
|
|
|
parser.add_argument('--state', required=True, nargs=1, type=str, dest='state', help='For example: State or province, for example California or Groningen.')
|
|
|
|
parser.add_argument('--organisation', required=True, nargs=1, type=str, dest='organisation', help='Typically \'University of Groningen\'')
|
|
|
|
parser.add_argument('--organisation', required=True, nargs=1, type=str, dest='organisation', help='Typically \'University of Groningen\'')
|
|
|
|
parser.add_argument('--organisation-unit', required=True, nargs=1, type=str, dest='organisation-unit', help='For example: \'Research and Innovation\' Support or \'Faculty of smart people\'')
|
|
|
|
parser.add_argument('--organisation-unit', required=True, nargs=1, type=str, dest='organisation_unit', help='For example: \'Research and Innovation\' Support or \'Faculty of smart people\'')
|
|
|
|
parser.add_argument('--common-name', required=True, nargs=1, type=str, dest='common-name')
|
|
|
|
parser.add_argument('--common-name', required=True, nargs=1, type=str, dest='common_name')
|
|
|
|
parser.add_argument('--alternative', nargs='*', type=str, dest='alternatives')
|
|
|
|
parser.add_argument('--alternative', nargs='*', type=str, dest='alternatives')
|
|
|
|
parser.add_argument('--support-name', required=True, nargs=1, type=str, dest='support_name')
|
|
|
|
parser.add_argument('--support-name', required=True, nargs=1, type=str, dest='support_name')
|
|
|
|
parser.add_argument('--support-email', required=True, nargs=1, type=str, dest='support_email')
|
|
|
|
parser.add_argument('--support-email', required=True, nargs=1, type=str, dest='support_email')
|
|
|
@ -34,9 +34,11 @@ class Command(BaseCommand):
|
|
|
|
parser.add_argument('--expires-after-days', nargs='?', type=int, default=10 * 365, dest='expires')
|
|
|
|
parser.add_argument('--expires-after-days', nargs='?', type=int, default=10 * 365, dest='expires')
|
|
|
|
|
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
|
|
|
def handle(self, *args, **options):
|
|
|
|
for option in {'country', 'city', 'state', 'organisation', 'organisation-unit', 'common-name', 'support-name',
|
|
|
|
print('=' * 100)
|
|
|
|
'support-email', 'technical-name', 'technical-email', 'entity-id', 'base-url'}:
|
|
|
|
print(options)
|
|
|
|
assert option in options and options[option] is not None and len(options[option]) == 1, "Exepecte one " \
|
|
|
|
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, "Expected one " \
|
|
|
|
"value for option" \
|
|
|
|
"value for option" \
|
|
|
|
": " + option
|
|
|
|
": " + option
|
|
|
|
options[option] = options[option][0]
|
|
|
|
options[option] = options[option][0]
|
|
|
@ -47,8 +49,8 @@ class Command(BaseCommand):
|
|
|
|
x509.NameAttribute(NameOID.STATE_OR_PROVINCE_NAME, options['state']),
|
|
|
|
x509.NameAttribute(NameOID.STATE_OR_PROVINCE_NAME, options['state']),
|
|
|
|
x509.NameAttribute(NameOID.LOCALITY_NAME, options['city']),
|
|
|
|
x509.NameAttribute(NameOID.LOCALITY_NAME, options['city']),
|
|
|
|
x509.NameAttribute(NameOID.ORGANIZATION_NAME, options['organisation']),
|
|
|
|
x509.NameAttribute(NameOID.ORGANIZATION_NAME, options['organisation']),
|
|
|
|
x509.NameAttribute(NameOID.ORGANIZATIONAL_UNIT_NAME, options['organisation-unit']),
|
|
|
|
x509.NameAttribute(NameOID.ORGANIZATIONAL_UNIT_NAME, options['organisation_unit']),
|
|
|
|
x509.NameAttribute(NameOID.COMMON_NAME, options['common-name']),
|
|
|
|
x509.NameAttribute(NameOID.COMMON_NAME, options['common_name']),
|
|
|
|
])
|
|
|
|
])
|
|
|
|
cert = (
|
|
|
|
cert = (
|
|
|
|
x509.CertificateBuilder()
|
|
|
|
x509.CertificateBuilder()
|
|
|
|