create settings

This commit is contained in:
H.T. Kruitbosch 2017-11-28 15:02:59 +01:00
parent 20ea3b7be9
commit 112dec11d2
4 changed files with 12 additions and 9 deletions

View File

@ -20,7 +20,7 @@ packages, like django, python3-saml, etc.
mkdir rugwebsite && cd rugwebsite
virtualenv --python=/usr/bin/python3.5 venv
source venv/bin/activate
pip3 install git+ssh://git@git.webhosting.rug.nl:222/p253591/rug-website.git
pip3 install -U gunicorn git+ssh://git@git.webhosting.rug.nl:222/p253591/rug-website.git
## Settings and X509 certificate

View File

@ -1 +1 @@
__version__ = '0.1.20'
__version__ = '0.1.21'

View File

@ -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('--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-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('--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('--alternative', nargs='*', type=str, dest='alternatives')
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')
@ -34,9 +34,11 @@ 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 " \
print('=' * 100)
print(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, "Expected one " \
"value for option" \
": " + option
options[option] = options[option][0]
@ -47,8 +49,8 @@ class Command(BaseCommand):
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']),
x509.NameAttribute(NameOID.ORGANIZATIONAL_UNIT_NAME, options['organisation_unit']),
x509.NameAttribute(NameOID.COMMON_NAME, options['common_name']),
])
cert = (
x509.CertificateBuilder()

View File

@ -17,6 +17,7 @@ SUPPORT_NAME = '{support_name}'
SUPPORT_EMAIL = '{support_email}'
ORGANISATION = '{organisation}'
ORGANISATION_UNIT = '{organisation_unit}'
SAML_ROUTE = BASE_URL + 'sso/saml/'