def collect(self):
        print("Please wait while collecting properties...")
        self.logIt("Previously installed instance. Collecting properties")
        salt_fn = os.path.join(Config.configFolder, 'salt')
        if os.path.exists(salt_fn):
            salt_prop = base.read_properties_file(salt_fn)
            Config.encode_salt = salt_prop['encodeSalt']

        jans_prop = base.read_properties_file(Config.jans_properties_fn)
        Config.persistence_type = jans_prop['persistence.type']
        oxauth_ConfigurationEntryDN = jans_prop[
            'jansAuth_ConfigurationEntryDN']
        jans_ConfigurationDN = 'ou=configuration,o=jans'

        if Config.persistence_type in ('couchbase', 'sql', 'spanner'):
            ptype = 'rdbm' if Config.persistence_type in (
                'sql', 'spanner') else 'couchbase'
            Config.mappingLocations = {
                group: ptype
                for group in Config.couchbaseBucketDict
            }
            default_storage = Config.persistence_type

        if not Config.persistence_type in (
                'ldap', 'sql', 'spanner') and os.path.exists(
                    Config.jansCouchebaseProperties):
            jans_cb_prop = base.read_properties_file(
                Config.jansCouchebaseProperties)

            Config.couchebaseClusterAdmin = jans_cb_prop['auth.userName']
            Config.encoded_cb_password = jans_cb_prop['auth.userPassword']
            Config.cb_password = self.unobscure(
                jans_cb_prop['auth.userPassword'])
            Config.couchbase_bucket_prefix = jans_cb_prop['bucket.default']

            Config.couchbase_hostname = jans_cb_prop['servers'].split(
                ',')[0].strip()
            Config.encoded_couchbaseTrustStorePass = jans_cb_prop[
                'ssl.trustStore.pin']
            Config.couchbaseTrustStorePass = self.unobscure(
                jans_cb_prop['ssl.trustStore.pin'])
            Config.cb_query_node = Config.couchbase_hostname
            Config.couchbase_buckets = [
                b.strip() for b in jans_cb_prop['buckets'].split(',')
            ]

        if not Config.persistence_type in ('couchbase',
                                           'sql') and os.path.exists(
                                               Config.ox_ldap_properties):
            jans_ldap_prop = base.read_properties_file(
                Config.ox_ldap_properties)
            Config.ldap_binddn = jans_ldap_prop['bindDN']
            Config.ldapPass = self.unobscure(jans_ldap_prop['bindPassword'])
            Config.opendj_p12_pass = self.unobscure(
                jans_ldap_prop['ssl.trustStorePin'])
            Config.ldap_hostname, Config.ldaps_port = jans_ldap_prop[
                'servers'].split(',')[0].split(':')

        if not Config.persistence_type in ('couchbase',
                                           'ldap') and os.path.exists(
                                               Config.jansRDBMProperties):
            jans_sql_prop = base.read_properties_file(
                Config.jansRDBMProperties)

            uri_re = re.match('jdbc:(.*?)://(.*?):(.*?)/(.*)',
                              jans_sql_prop['connection.uri'])
            Config.rdbm_type, Config.rdbm_host, self.rdbm_port, self.rdbm_db = uri_re.groups(
            )
            Config.rdbm_port = int(self.rdbm_port)
            Config.rdbm_install_type = static.InstallTypes.LOCAL if Config.rdbm_host == 'localhost' else static.InstallTypes.REMOTE
            Config.rdbm_user = jans_sql_prop['auth.userName']
            Config.rdbm_password_enc = jans_sql_prop['auth.userPassword']
            Config.rdbm_password = self.unobscure(Config.rdbm_password_enc)
            Config.rdbm_db = jans_sql_prop['db.schema.name']

        if not Config.persistence_type in ('couchbase',
                                           'ldap') and os.path.exists(
                                               Config.jansSpannerProperties):
            Config.rdbm_type = 'spanner'
            jans_spanner_prop = base.read_properties_file(
                Config.jansSpannerProperties)

            Config.spanner_project = jans_spanner_prop['connection.project']
            Config.spanner_instance = jans_spanner_prop['connection.instance']
            Config.spanner_database = jans_spanner_prop['connection.database']

            if 'connection.emulator-host' in jans_spanner_prop:
                Config.spanner_emulator_host = jans_spanner_prop[
                    'connection.emulator-host'].split(':')[0]
                Config.templateRenderingDict[
                    'spanner_creds'] = 'connection.emulator-host={}:9010'.format(
                        Config.spanner_emulator_host)

            elif 'auth.credentials-file' in jans_spanner_prop:
                Config.google_application_credentials = jans_spanner_prop[
                    'auth.credentials-file']
                Config.templateRenderingDict[
                    'spanner_creds'] = 'auth.credentials-file={}'.format(
                        Config.google_application_credentials)

        if Config.persistence_type in ['hybrid']:
            jans_hybrid_properties = base.read_properties_file(
                jans_hybrid_properties_fn)
            Config.mappingLocations = {
                'default': jans_hybrid_properties['storage.default']
            }
            storages = [
                storage.strip()
                for storage in jans_hybrid_properties['storages'].split(',')
            ]

            for ml, m in (('user', 'people'), ('cache', 'cache'),
                          ('site', 'cache-refresh'), ('token', 'tokens')):
                for storage in storages:
                    if m in jans_hybrid_properties.get(
                            'storage.{}.mapping'.format(storage), []):
                        Config.mappingLocations[ml] = storage

        if not Config.get('couchbase_bucket_prefix'):
            Config.couchbase_bucket_prefix = 'jans'

        # It is time to bind database
        dbUtils.bind()

        if dbUtils.session:
            dbUtils.rdm_automapper()

        result = dbUtils.search(
            'ou=clients,o=jans',
            search_filter='(&(inum=1701.*)(objectClass=jansClnt))',
            search_scope=ldap3.SUBTREE)

        if result:
            Config.jans_radius_client_id = result['inum']
            Config.jans_ro_encoded_pw = result['jansClntSecret']
            Config.jans_ro_pw = self.unobscure(Config.jans_ro_encoded_pw)

            result = dbUtils.search('inum=5866-4202,ou=scripts,o=jans',
                                    search_scope=ldap3.BASE)
            if result:
                Config.enableRadiusScripts = result['jansEnabled']

            result = dbUtils.search(
                'ou=clients,o=jans',
                search_filter='(&(inum=1402.*)(objectClass=jansClnt))',
                search_scope=ldap3.SUBTREE)
            if result:
                Config.oxtrust_requesting_party_client_id = result['inum']

        #admin_dn = None
        #result = dbUtils.search('o=jans', search_filter='(jansGrpTyp=jansManagerGroup)', search_scope=ldap3.SUBTREE)
        #if result:
        #    admin_dn = result['member'][0]

        #if admin_dn:
        #    for rd in dnutils.parse_dn(admin_dn):
        #        if rd[0] == 'inum':
        #            Config.admin_inum = str(rd[1])
        #            break

        oxConfiguration = dbUtils.search(
            jans_ConfigurationDN,
            search_filter='(objectClass=jansAppConf)',
            search_scope=ldap3.BASE)
        if 'jansIpAddress' in oxConfiguration:
            Config.ip = oxConfiguration['jansIpAddress']

        if isinstance(oxConfiguration['jansCacheConf'], str):
            oxCacheConfiguration = json.loads(oxConfiguration['jansCacheConf'])
        else:
            oxCacheConfiguration = oxConfiguration['jansCacheConf']

        Config.cache_provider_type = str(
            oxCacheConfiguration['cacheProviderType'])

        Config.scim_rp_client_jks_pass = '******'  # this is static

        # Other clients
        client_var_id_list = [
            ('oxauth_client_id', '1001.'),
            ('jca_client_id', '1801.', {
                'pw': 'jca_client_pw',
                'encoded': 'jca_client_encoded_pw'
            }),
            ('jca_test_client_id', '1802.', {
                'pw': 'jca_test_client_pw',
                'encoded': 'jca_test_client_encoded_pw'
            }),
            ('scim_client_id', '1201.', {
                'pw': 'scim_client_pw',
                'encoded': 'scim_client_encoded_pw'
            }),
            ('admin_ui_client_id', '1901.', {
                'pw': 'admin_ui_client_pw',
                'encoded': 'admin_ui_client_encoded_pw'
            }),
        ]
        self.check_clients(client_var_id_list)

        result = dbUtils.search(
            search_base='inum={},ou=clients,o=jans'.format(
                Config.oxauth_client_id),
            search_filter='(objectClass=jansClnt)',
            search_scope=ldap3.BASE,
        )
        Config.oxauthClient_encoded_pw = result['jansClntSecret']
        Config.oxauthClient_pw = self.unobscure(Config.oxauthClient_encoded_pw)

        dn_oxauth, oxAuthConfDynamic = dbUtils.get_oxAuthConfDynamic()

        o_issuer = urlparse(oxAuthConfDynamic['issuer'])
        Config.hostname = str(o_issuer.netloc)

        Config.oxauth_openidScopeBackwardCompatibility = oxAuthConfDynamic.get(
            'openidScopeBackwardCompatibility', False)

        if 'pairwiseCalculationSalt' in oxAuthConfDynamic:
            Config.pairwiseCalculationSalt = oxAuthConfDynamic[
                'pairwiseCalculationSalt']
        if 'legacyIdTokenClaims' in oxAuthConfDynamic:
            Config.oxauth_legacyIdTokenClaims = oxAuthConfDynamic[
                'legacyIdTokenClaims']
        if 'pairwiseCalculationKey' in oxAuthConfDynamic:
            Config.pairwiseCalculationKey = oxAuthConfDynamic[
                'pairwiseCalculationKey']
        if 'keyStoreFile' in oxAuthConfDynamic:
            Config.oxauth_openid_jks_fn = oxAuthConfDynamic['keyStoreFile']
        if 'keyStoreSecret' in oxAuthConfDynamic:
            Config.oxauth_openid_jks_pass = oxAuthConfDynamic['keyStoreSecret']

        ssl_subj = self.get_ssl_subject('/etc/certs/httpd.crt')

        Config.countryCode = ssl_subj['C']
        Config.state = ssl_subj['ST']
        Config.city = ssl_subj['L']
        Config.city = ssl_subj['L']

        #this is not good, but there is no way to retreive password from ldap
        if not Config.get('admin_password'):
            if Config.get('ldapPass'):
                Config.admin_password = Config.ldapPass
            elif Config.get('cb_password'):
                Config.admin_password = Config.cb_password

        if not Config.get('orgName'):
            Config.orgName = ssl_subj['O']

        #for service in jetty_services:
        #    setup_prop[jetty_services[service][0]] = os.path.exists('/opt/jans/jetty/{0}/webapps/{0}.war'.format(service))

        for s in ['jansScimEnabled']:
            setattr(Config, s, oxConfiguration.get(s, False))

        application_max_ram = 3072

        default_dir = '/etc/default'
        usedRatio = 0.001
        oxauth_max_heap_mem = 0

        jetty_services = JettyInstaller.jetty_app_configuration

        for service in jetty_services:
            service_default_fn = os.path.join(default_dir, service)
            if os.path.exists(service_default_fn):
                usedRatio += jetty_services[service]['memory']['ratio']
                if service == 'jans-auth':
                    service_prop = base.read_properties_file(
                        service_default_fn)
                    m = re.search('-Xmx(\d*)m', service_prop['JAVA_OPTIONS'])
                    oxauth_max_heap_mem = int(m.groups()[0])

        if oxauth_max_heap_mem:
            ratioMultiplier = 1.0 + (1.0 - usedRatio) / usedRatio
            applicationMemory = oxauth_max_heap_mem / jetty_services[
                'jans-auth']['memory']['jvm_heap_ration']
            allowedRatio = jetty_services['jans-auth']['memory'][
                'ratio'] * ratioMultiplier
            application_max_ram = int(round(applicationMemory / allowedRatio))

        Config.os_type = base.os_type
        Config.os_version = base.os_version

        if not Config.get('ip'):
            Config.ip = self.detect_ip()

        Config.installScimServer = os.path.exists(
            os.path.join(Config.jetty_base, 'jans-scim/start.ini'))
        Config.installFido2 = os.path.exists(
            os.path.join(Config.jetty_base, 'jans-fido2/start.ini'))
        Config.installEleven = os.path.exists(
            os.path.join(Config.jetty_base, 'jans-eleven/start.ini'))
        Config.installConfigApi = os.path.exists(
            os.path.join(Config.jansOptFolder, 'jans-config-api'))

        result = dbUtils.search(
            'ou=people,o=jans',
            search_filter='(&(uid=admin)(objectClass=jansPerson))')
        if result:
            Config.admin_inum = result['inum']
            if 'mail' in result:
                Config.admin_email = result['mail']
예제 #2
0
    def load_properties(self, prop_file, no_update=[]):
        self.logIt('Loading Properties %s' % prop_file)

        no_update += [
            'noPrompt', 'jre_version', 'node_version', 'jetty_version',
            'jython_version', 'jreDestinationPath'
        ]

        cb_install = False
        map_db = []

        if prop_file.endswith('.enc'):
            if not Config.properties_password:
                print(
                    "setup.properties password was not supplied. Please run with argument -properties-password"
                )
                sys.exit(False)

            prop_file = self.decrypt_properties(prop_file,
                                                Config.properties_password)

        try:
            p = base.read_properties_file(prop_file)
        except:
            self.logIt("Error loading properties", True)

        if p.get('ldap_type') == 'openldap':
            self.logIt(
                "ldap_type in setup.properties was changed from openldap to opendj"
            )
            p['ldap_type'] = 'opendj'

        if p.get('cb_install') == '0':
            p['cb_install'] = InstallTypes.NONE

        if p.get('wrends_install') == '0':
            p['wrends_install'] = InstallTypes.NONE

        properties_list = list(p.keys())

        for prop in properties_list:
            if prop in no_update:
                continue
            try:
                setattr(Config, prop, p[prop])
                if prop == 'mappingLocations':
                    mappingLocations = json.loads(p[prop])
                    setattr(Config, prop, mappingLocations)
                    for l in mappingLocations:
                        if not mappingLocations[l] in map_db:
                            map_db.append(mappingLocations[l])

                if p[prop] == 'True':
                    setattr(Config, prop, True)
                elif p[prop] == 'False':
                    setattr(Config, prop, False)
            except:
                self.logIt("Error loading property %s" % prop)

        if prop_file.endswith('-DEC~'):
            self.run(['rm', '-f', prop_file])

        if not 'admin_password' in properties_list:
            Config.admin_password = p['ldapPass']

        if p.get('ldap_hostname') != 'localhost':
            if p.get('remoteLdap', '').lower() == 'true':
                Config.wrends_install = InstallTypes.REMOTE
            elif p.get('installLdap', '').lower() == 'true':
                Config.wrends_install = InstallTypes.LOCAL
            elif p.get('wrends_install'):
                Config.wrends_install = p['wrends_install']
            else:
                Config.wrends_install = InstallTypes.NONE

        if map_db and not 'ldap' in map_db:
            Config.wrends_install = InstallTypes.NONE

        if 'couchbase' in map_db:
            if 'remoteCouchbase' in properties_list and p.get(
                    'remoteCouchbase', '').lower() == 'true':
                Config.cb_install = InstallTypes.REMOTE
            elif p.get('cb_install'):
                Config.cb_install = p['cb_install']
            elif 'persistence_type' in properties_list and p.get(
                    'persistence_type') in ('couchbase', 'hybrid'):
                Config.cb_install = InstallTypes.LOCAL
            else:
                Config.cb_install = InstallTypes.NONE

        if Config.cb_install == InstallTypes.LOCAL:
            available_backends = self.getBackendTypes()
            if not 'couchbase' in available_backends:
                print("Couchbase package is not available exiting.")
                sys.exit(1)

        if (not 'cb_password' in properties_list) and Config.cb_install:
            Config.cb_password = p.get('ldapPass')

        if Config.cb_install == InstallTypes.REMOTE:
            cbm_ = CBM(Config.couchbase_hostname,
                       Config.couchebaseClusterAdmin, Config.cb_password)
            if not cbm_.test_connection().ok:
                print(
                    "Can't connect to remote Couchbase Server with credentials found in setup.properties."
                )
                sys.exit(1)

        if Config.wrends_install == InstallTypes.REMOTE:
            conn_check = self.check_remote_ldap(Config.ldap_hostname,
                                                Config.ldap_binddn,
                                                Config.ldapPass)
            if not conn_check['result']:
                print(
                    "Can't connect to remote LDAP Server with credentials found in setup.properties."
                )
                sys.exit(1)

        if not 'admin_password' in p:
            p['admin_password'] = p['ldapPass']

        return p
    def collect(self):
        print("Please wait while collectiong properties...")
        self.logIt("Previously installed instance. Collecting properties")
        salt_fn = os.path.join(Config.configFolder,'salt')
        if os.path.exists(salt_fn):
            salt_prop = base.read_properties_file(salt_fn)
            Config.encode_salt = salt_prop['encodeSalt']

        gluu_prop = base.read_properties_file(Config.gluu_properties_fn)
        Config.persistence_type = gluu_prop['persistence.type']
        oxauth_ConfigurationEntryDN = gluu_prop['oxauth_ConfigurationEntryDN']
        oxtrust_ConfigurationEntryDN = gluu_prop['oxtrust_ConfigurationEntryDN']
        oxidp_ConfigurationEntryDN = gluu_prop['oxidp_ConfigurationEntryDN']
        gluu_ConfigurationDN = 'ou=configuration,o=gluu'

        if Config.persistence_type == 'couchbase':
            Config.mappingLocations = { group: 'couchbase' for group in Config.couchbaseBucketDict }
            default_storage = 'couchbase'

        if Config.persistence_type != 'ldap' and os.path.exists(Config.gluuCouchebaseProperties):

            gluu_cb_prop = base.read_properties_file(Config.gluuCouchebaseProperties)

            Config.couchebaseClusterAdmin = gluu_cb_prop['auth.userName']
            Config.encoded_cb_password = gluu_cb_prop['auth.userPassword']
            Config.cb_password = self.unobscure(gluu_cb_prop['auth.userPassword'])
            Config.couchbase_bucket_prefix = gluu_cb_prop['bucket.default']

            Config.couchbase_hostname = gluu_cb_prop['servers'].split(',')[0].strip()
            Config.encoded_couchbaseTrustStorePass = gluu_cb_prop['ssl.trustStore.pin']
            Config.couchbaseTrustStorePass = self.unobscure(gluu_cb_prop['ssl.trustStore.pin'])

        if Config.persistence_type != 'couchbase' and os.path.exists(Config.ox_ldap_properties):
            gluu_ldap_prop = base.read_properties_file(Config.ox_ldap_properties)
            Config.ldap_binddn = gluu_ldap_prop['bindDN']
            Config.ldapPass = self.unobscure(gluu_ldap_prop['bindPassword'])
            Config.opendj_p12_pass = self.unobscure(gluu_ldap_prop['ssl.trustStorePin'])
            Config.ldap_hostname, Config.ldaps_port = gluu_ldap_prop['servers'].split(',')[0].split(':')


        if Config.persistence_type in ['hybrid']:
             gluu_hybrid_properties = base.read_properties_file(gluu_hybrid_properties_fn)
             Config.mappingLocations = {'default': gluu_hybrid_properties['storage.default']}
             storages = [ storage.strip() for storage in gluu_hybrid_properties['storages'].split(',') ]

             for ml, m in (('user', 'people'), ('cache', 'cache'), ('site', 'cache-refresh'), ('token', 'tokens')):
                 for storage in storages:
                     if m in gluu_hybrid_properties.get('storage.{}.mapping'.format(storage),[]):
                         Config.mappingLocations[ml] = storage

        if not Config.get('couchbase_bucket_prefix'):
            Config.couchbase_bucket_prefix = 'gluu'

        # It is time to bind database
        dbUtils.bind()

        result = dbUtils.search('ou=clients,o=gluu', search_filter='(inum=1701.*)', search_scope=ldap3.SUBTREE)

        if result:
            Config.gluu_radius_client_id = result['inum']
            Config.gluu_ro_encoded_pw = result['oxAuthClientSecret']
            Config.gluu_ro_pw = self.unobscure(Config.gluu_ro_encoded_pw)
    
            result = dbUtils.search('inum=5866-4202,ou=scripts,o=gluu', search_scope=ldap3.BASE)
            if result:
                Config.enableRadiusScripts = result['oxEnabled']

            result = dbUtils.search('ou=clients,o=gluu', search_filter='(inum=1402.*)', search_scope=ldap3.SUBTREE)
            if result:
                Config.oxtrust_requesting_party_client_id = result['inum']

        admin_dn = None
        result = dbUtils.search('o=gluu', search_filter='(gluuGroupType=gluuManagerGroup)', search_scope=ldap3.SUBTREE)
        if result:
            admin_dn = result['member'][0]


        if admin_dn:
            for rd in dnutils.parse_dn(admin_dn):
                if rd[0] == 'inum':
                    Config.admin_inum = str(rd[1])
                    break

        oxConfiguration = dbUtils.search(gluu_ConfigurationDN, search_scope=ldap3.BASE)
        if 'gluuIpAddress' in oxConfiguration:
            Config.ip = oxConfiguration['gluuIpAddress']

        oxCacheConfiguration = json.loads(oxConfiguration['oxCacheConfiguration'])
        Config.cache_provider_type = str(oxCacheConfiguration['cacheProviderType'])

        result = dbUtils.search(oxidp_ConfigurationEntryDN, search_filter='(objectClass=oxApplicationConfiguration)', search_scope=ldap3.BASE)

        if result:

            oxConfApplication = json.loads(result['oxConfApplication'])
            Config.idpClient_encoded_pw = oxConfApplication['openIdClientPassword']
            Config.idpClient_pw =  self.unobscure(Config.idpClient_encoded_pw)
            
            Config.idp_client_id =  oxConfApplication['openIdClientId']

            if 'openIdClientPassword' in oxConfApplication:
                Config.idpClient_pw =  self.unobscure(oxConfApplication['openIdClientPassword'])
            if 'openIdClientId' in oxConfApplication:
                Config.idp_client_id =  oxConfApplication['openIdClientId']

        dn_oxauth, oxAuthConfDynamic = dbUtils.get_oxAuthConfDynamic()
        dn_oxtrust, oxTrustConfApplication = dbUtils.get_oxTrustConfApplication()

        if 'apiUmaClientId' in oxTrustConfApplication:
            Config.oxtrust_resource_server_client_id =  oxTrustConfApplication['apiUmaClientId']


        if 'apiUmaClientKeyStorePassword' in oxTrustConfApplication:
            Config.api_rs_client_jks_pass = self.unobscure(oxTrustConfApplication['apiUmaClientKeyStorePassword'])

        if 'apiUmaResourceId' in oxTrustConfApplication:
            Config.oxtrust_resource_id =  oxTrustConfApplication['apiUmaResourceId']

        if 'idpSecurityKeyPassword' in oxTrustConfApplication:
            Config.encoded_shib_jks_pw = oxTrustConfApplication['idpSecurityKeyPassword']
            Config.shibJksPass =  self.unobscure(Config.encoded_shib_jks_pw)

        Config.admin_email =  oxTrustConfApplication['orgSupportEmail']

        if 'organizationName' in oxTrustConfApplication:
            Config.orgName =  oxTrustConfApplication['organizationName']

        Config.oxauth_client_id = oxTrustConfApplication['oxAuthClientId']
        Config.oxauthClient_pw = self.unobscure(oxTrustConfApplication['oxAuthClientPassword'])
        Config.oxauthClient_encoded_pw = oxTrustConfApplication['oxAuthClientPassword']

        Config.scim_rp_client_jks_pass = '******' # this is static

        if 'scimUmaClientId' in oxTrustConfApplication:
            Config.scim_rs_client_id =  oxTrustConfApplication['scimUmaClientId']

        if 'scimUmaClientId' in oxTrustConfApplication:
            Config.scim_resource_oxid =  oxTrustConfApplication['scimUmaResourceId']
        if 'scimTestMode' in oxTrustConfApplication:
            Config.scimTestMode =  oxTrustConfApplication['scimTestMode']

        if 'apiUmaClientKeyStorePassword' in oxTrustConfApplication:
            Config.api_rp_client_jks_pass = self.unobscure(oxTrustConfApplication['apiUmaClientKeyStorePassword'])
            Config.api_rs_client_jks_fn = oxTrustConfApplication['apiUmaClientKeyStoreFile']

        if 'scimUmaClientKeyStorePassword' in oxTrustConfApplication:
            Config.scim_rs_client_jks_pass = self.unobscure(oxTrustConfApplication['scimUmaClientKeyStorePassword'])
            Config.scim_rs_client_jks_fn = str(oxTrustConfApplication['scimUmaClientKeyStoreFile'])

        # Other clients
        client_var_id_list = (
                    ('scim_rp_client_id', '1202.'),
                    ('passport_rs_client_id', '1501.'),
                    ('passport_rp_client_id', '1502.'),
                    ('passport_rp_ii_client_id', '1503.'),
                    ('gluu_radius_client_id', '1701.'),
                    )
        self.check_clients(client_var_id_list)
        self.check_clients([('passport_resource_id', '1504.')])

        o_issuer = urlparse(oxAuthConfDynamic['issuer'])
        Config.hostname = str(o_issuer.netloc)

        Config.oxauth_openidScopeBackwardCompatibility =  oxAuthConfDynamic.get('openidScopeBackwardCompatibility', False)

        if 'pairwiseCalculationSalt' in oxAuthConfDynamic:
            Config.pairwiseCalculationSalt =  oxAuthConfDynamic['pairwiseCalculationSalt']
        if 'legacyIdTokenClaims' in oxAuthConfDynamic:
            Config.oxauth_legacyIdTokenClaims = oxAuthConfDynamic['legacyIdTokenClaims']
        if 'pairwiseCalculationKey' in oxAuthConfDynamic:
            Config.pairwiseCalculationKey = oxAuthConfDynamic['pairwiseCalculationKey']
        if 'keyStoreFile' in oxAuthConfDynamic:
            Config.oxauth_openid_jks_fn = oxAuthConfDynamic['keyStoreFile']
        if 'keyStoreSecret' in oxAuthConfDynamic:
            Config.oxauth_openid_jks_pass = oxAuthConfDynamic['keyStoreSecret']


        ssl_subj = self.get_ssl_subject('/etc/certs/httpd.crt')
        Config.countryCode = ssl_subj['C']
        Config.state = ssl_subj['ST']
        Config.city = ssl_subj['L']
        Config.city = ssl_subj['L']
         
         #this is not good, but there is no way to retreive password from ldap
        if not Config.get('oxtrust_admin_password'):
            if Config.get('ldapPass'):
                Config.oxtrust_admin_password = Config.ldapPass
            elif Config.get('cb_password'):
                Config.oxtrust_admin_password = Config.cb_password

        if not Config.get('orgName'):
            Config.orgName = ssl_subj['O']

        #for service in jetty_services:
        #    setup_prop[jetty_services[service][0]] = os.path.exists('/opt/gluu/jetty/{0}/webapps/{0}.war'.format(service))


        for s in ('gluuPassportEnabled', 'gluuRadiusEnabled', 'gluuSamlEnabled', 'gluuScimEnabled'):
            setattr(Config, s, oxConfiguration.get(s, False))

        application_max_ram = 3072

        default_dir = '/etc/default'
        usedRatio = 0.001
        oxauth_max_heap_mem = 0

        jetty_services = JettyInstaller.jetty_app_configuration

        for service in jetty_services:
            service_default_fn = os.path.join(default_dir, service)
            if os.path.exists(service_default_fn):
                usedRatio += jetty_services[service]['memory']['ratio']
                if service == 'oxauth':
                    service_prop = base.read_properties_file(service_default_fn)
                    m = re.search('-Xmx(\d*)m', service_prop['JAVA_OPTIONS'])
                    oxauth_max_heap_mem = int(m.groups()[0])

        if oxauth_max_heap_mem:
            ratioMultiplier = 1.0 + (1.0 - usedRatio)/usedRatio
            applicationMemory = oxauth_max_heap_mem / jetty_services['oxauth']['memory']['jvm_heap_ration']
            allowedRatio = jetty_services['oxauth']['memory']['ratio'] * ratioMultiplier
            application_max_ram = int(round(applicationMemory / allowedRatio))

        if Config.get('gluuRadiusEnabled'):
            Config.oxauth_openidScopeBackwardCompatibility = True

        Config.os_type = base.os_type
        Config.os_version = base.os_version

        if not Config.get('ip'):
            Config.ip = self.detect_ip()