From 45c6a68e3020b31eddc2dc254a787955ac261424 Mon Sep 17 00:00:00 2001 From: Andreas Sieferlinger Date: Jul 13 2017 10:59:16 +0000 Subject: very basic implementation of custom specified path things one might want to add: - check if file exists - check if file is correctly encoded - test in general Signed-off-by: Andreas Sieferlinger --- diff --git a/ipsilon/providers/saml2idp.py b/ipsilon/providers/saml2idp.py index 09bb12a..6d6541a 100644 --- a/ipsilon/providers/saml2idp.py +++ b/ipsilon/providers/saml2idp.py @@ -506,6 +506,10 @@ class Installer(ProviderInstaller): METADATA_DEFAULT_VALIDITY_PERIOD)) group.add_argument('--saml2-session-dburl', help='session database URL') + group.add_argument('--saml2-cert-path', default=None, + help='full path to certificate') + group.add_argument('--saml2-key-path', default=None, + help='full path to key') def configure(self, opts, changes): if opts['saml2'] != 'yes': @@ -516,9 +520,14 @@ class Installer(ProviderInstaller): if not os.path.exists(path): os.makedirs(path, 0700) - # Use the same cert for signing and ecnryption for now - cert = Certificate(path) - cert.generate('idp', opts['hostname']) + # Use the same cert for signing and encryption for now + if opts['saml2_cert_path']: + cert = Certificate(opts['saml2_cert_path']) + cert.key = opts['saml2_key_path'] + cert.cert = opts['saml2_cert_path'] + else: + cert = Certificate(path) + cert.generate('idp', opts['hostname']) # Generate Idp Metadata proto = 'https'