<s> import os . path <EOL> import Properties <EOL> import random <EOL> import shutil <EOL> import socket <EOL> import string <EOL> import time <EOL> import uuid <EOL> import json <EOL> import traceback <EOL> import subprocess <EOL> import sys <EOL> import getopt <EOL> import hashlib <EOL> import re <EOL> class Setup ( object ) : <EOL> def __init__ ( self , install_dir = None ) : <EOL> self . install_dir = install_dir <EOL> self . oxVersion = '<STR_LIT>' <EOL> self . githubBranchName = '<STR_LIT>' <EOL> self . oxtrust_war = '<STR_LIT>' % ( self . oxVersion , self . oxVersion ) <EOL> self . oxauth_war = '<STR_LIT>' % ( self . oxVersion , self . oxVersion ) <EOL> self . oxauth_rp_war = '<STR_LIT>' % ( self . oxVersion , self . oxVersion ) <EOL> self . idp_war = '<STR_LIT>' % ( self . oxVersion , self . oxVersion ) <EOL> self . asimba_war = "<STR_LIT>" % ( self . oxVersion , self . oxVersion ) <EOL> self . cas_war = "<STR_LIT>" % ( self . oxVersion , self . oxVersion ) <EOL> self . ce_setup_zip = '<STR_LIT>' % self . githubBranchName <EOL> self . downloadWars = None <EOL> self . installOxAuth = True <EOL> self . installOxTrust = True <EOL> self . installLdap = True <EOL> self . installHttpd = True <EOL> self . installSaml = False <EOL> self . installAsimba = False <EOL> self . installCas = False <EOL> self . installOxAuthRP = False <EOL> self . os_types = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . os_type = None <EOL> self . os_initdaemon = None <EOL> self . apache_version = None <EOL> self . opendj_version = None <EOL> self . distFolder = "<STR_LIT>" <EOL> self . setup_properties_fn = "<STR_LIT>" % self . install_dir <EOL> self . log = '<STR_LIT>' % self . install_dir <EOL> self . logError = '<STR_LIT>' % self . install_dir <EOL> self . savedProperties = "<STR_LIT>" % self . install_dir <EOL> self . gluuOptFolder = "<STR_LIT>" <EOL> self . gluuOptBinFolder = "<STR_LIT>" <EOL> self . configFolder = '<STR_LIT>' <EOL> self . certFolder = '<STR_LIT>' <EOL> self . tomcatHome = '<STR_LIT>' <EOL> self . tomcat_user_home_lib = "<STR_LIT>" <EOL> self . oxauth_lib = "<STR_LIT>" <EOL> self . tomcatWebAppFolder = "<STR_LIT>" <EOL> self . oxBaseDataFolder = "<STR_LIT>" <EOL> self . oxPhotosFolder = "<STR_LIT>" <EOL> self . oxTrustRemovedFolder = "<STR_LIT>" <EOL> self . oxTrustCacheRefreshFolder = "<STR_LIT>" <EOL> self . oxCustomizationFolder = "<STR_LIT>" <EOL> self . etc_hosts = '<STR_LIT>' <EOL> self . etc_hostname = '<STR_LIT>' <EOL> self . idpFolder = "<STR_LIT>" <EOL> self . idpMetadataFolder = "<STR_LIT>" <EOL> self . idpLogsFolder = "<STR_LIT>" <EOL> self . idpLibFolder = "<STR_LIT>" <EOL> self . idpConfFolder = "<STR_LIT>" <EOL> self . idpSslFolder = "<STR_LIT>" <EOL> self . idpTempMetadataFolder = "<STR_LIT>" <EOL> self . idpWarFolder = "<STR_LIT>" <EOL> self . idpSPFolder = "<STR_LIT>" <EOL> self . hostname = None <EOL> self . ip = None <EOL> self . orgName = None <EOL> self . orgShortName = None <EOL> self . countryCode = None <EOL> self . city = None <EOL> self . state = None <EOL> self . admin_email = None <EOL> self . encoded_ox_ldap_pw = None <EOL> self . encoded_ldap_pw = None <EOL> self . encoded_shib_jks_pw = None <EOL> self . baseInum = None <EOL> self . inumOrg = None <EOL> self . inumAppliance = None <EOL> self . inumOrgFN = None <EOL> self . inumApplianceFN = None <EOL> self . ldapBaseFolderldapPass = None <EOL> self . oxauth_client_id = None <EOL> self . oxauthClient_pw = None <EOL> self . oxauthClient_encoded_pw = None <EOL> self . oxauthClient_2_pw = None <EOL> self . oxauthClient_2_encoded_pw = None <EOL> self . oxauthClient_3_pw = None <EOL> self . oxauthClient_3_encoded_pw = None <EOL> self . oxauthClient_4_pw = None <EOL> self . oxauthClient_4_encoded_pw = None <EOL> self . encode_salt = None <EOL> self . oxauth_jsf_salt = None <EOL> self . oxTrustConfigGeneration = "<STR_LIT:true>" <EOL> self . outputFolder = '<STR_LIT>' % self . install_dir <EOL> self . templateFolder = '<STR_LIT>' % self . install_dir <EOL> self . staticFolder = '<STR_LIT>' % self . install_dir <EOL> self . indexJson = '<STR_LIT>' % self . install_dir <EOL> self . oxauth_error_json = '<STR_LIT>' % self . install_dir <EOL> self . oxauth_openid_key_json = "<STR_LIT>" % self . certFolder <EOL> self . httpdKeyPass = None <EOL> self . httpdKeyFn = '<STR_LIT>' % self . certFolder <EOL> self . httpdCertFn = '<STR_LIT>' % self . certFolder <EOL> self . shibJksPass = None <EOL> self . shibJksFn = '<STR_LIT>' % self . certFolder <EOL> self . asimbaJksPass = None <EOL> self . asimbaJksFn = '<STR_LIT>' % self . certFolder <EOL> self . openDjCertFn = '<STR_LIT>' % self . certFolder <EOL> self . ldap_type = "<STR_LIT>" <EOL> self . ldap_binddn = '<STR_LIT>' <EOL> self . ldap_hostname = "<STR_LIT:localhost>" <EOL> self . ldap_port = '<STR_LIT>' <EOL> self . ldaps_port = '<STR_LIT>' <EOL> self . ldap_jmx_port = '<STR_LIT>' <EOL> self . ldap_admin_port = '<STR_LIT>' <EOL> self . ldapBaseFolder = '<STR_LIT>' <EOL> self . ldapStartTimeOut = <NUM_LIT:30> <EOL> self . ldapSetupCommand = '<STR_LIT>' % self . ldapBaseFolder <EOL> self . ldapDsconfigCommand = "<STR_LIT>" % self . ldapBaseFolder <EOL> self . ldapDsCreateRcCommand = "<STR_LIT>" % self . ldapBaseFolder <EOL> self . ldapDsJavaPropCommand = "<STR_LIT>" % self . ldapBaseFolder <EOL> self . ldapPassFn = '<STR_LIT>' <EOL> self . ldap_backend_type = '<STR_LIT>' <EOL> self . importLdifCommand = '<STR_LIT>' % self . ldapBaseFolder <EOL> self . ldapModifyCommand = '<STR_LIT>' % self . ldapBaseFolder <EOL> self . loadLdifCommand = self . importLdifCommand <EOL> self . schemaFolder = "<STR_LIT>" % self . ldapBaseFolder <EOL> self . org_custom_schema = "<STR_LIT>" % self . ldapBaseFolder <EOL> self . schemaFiles = [ "<STR_LIT>" % ( self . install_dir , self . ldap_type ) , <EOL> "<STR_LIT>" % ( self . install_dir , self . ldap_type ) , <EOL> "<STR_LIT>" % ( self . install_dir , self . ldap_type ) , <EOL> "<STR_LIT>" % self . install_dir ] <EOL> self . gluuScriptFiles = [ '<STR_LIT>' % self . install_dir , <EOL> '<STR_LIT>' % self . install_dir ] <EOL> self . init_files = [ '<STR_LIT>' % self . install_dir , <EOL> '<STR_LIT>' % self . install_dir ] <EOL> self . tomcat_template_centos7 = '<STR_LIT>' % self . install_dir <EOL> self . tomcat_service_centos7 = "<STR_LIT>" % self . tomcatHome <EOL> self . redhat_services = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . debian_services = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . ldap_start_script = '<STR_LIT>' <EOL> self . apache_start_script = '<STR_LIT>' <EOL> self . tomcat_start_script = '<STR_LIT>' <EOL> self . ldapEncodePWCommand = '<STR_LIT>' % self . ldapBaseFolder <EOL> self . oxEncodePWCommand = '<STR_LIT>' % self . gluuOptFolder <EOL> self . keytoolCommand = '<STR_LIT>' <EOL> self . jarCommand = '<STR_LIT>' <EOL> self . opensslCommand = '<STR_LIT>' <EOL> self . defaultTrustStoreFN = '<STR_LIT>' <EOL> self . defaultTrustStorePW = '<STR_LIT>' <EOL> self . oxauth_config_json = '<STR_LIT>' % self . outputFolder <EOL> self . oxauth_context_xml = '<STR_LIT>' % self . tomcatHome <EOL> self . oxtrust_context_xml = '<STR_LIT>' % self . tomcatHome <EOL> self . oxtrust_config_json = '<STR_LIT>' % self . outputFolder <EOL> self . oxtrust_cache_refresh_json = '<STR_LIT>' % self . outputFolder <EOL> self . oxtrust_import_person_json = '<STR_LIT>' % self . outputFolder <EOL> self . oxidp_config_json = '<STR_LIT>' % self . outputFolder <EOL> self . oxcas_config_json = '<STR_LIT>' % self . outputFolder <EOL> self . oxasimba_config_json = '<STR_LIT>' % self . outputFolder <EOL> self . tomcat_server_xml = '<STR_LIT>' % self . tomcatHome <EOL> self . tomcat_python_readme = '<STR_LIT>' % self . tomcatHome <EOL> self . ox_ldap_properties = '<STR_LIT>' % self . tomcatHome <EOL> self . tomcat_gluuTomcatWrapper = '<STR_LIT>' % self . tomcatHome <EOL> self . oxauth_static_conf_json = '<STR_LIT>' % self . outputFolder <EOL> self . tomcat_log_folder = "<STR_LIT>" % self . tomcatHome <EOL> self . tomcat_max_ram = None <EOL> self . oxTrust_log_rotation_configuration = "<STR_LIT>" % self . tomcatHome <EOL> self . eduperson_schema_ldif = '<STR_LIT>' <EOL> self . apache2_conf = '<STR_LIT>' % self . outputFolder <EOL> self . apache2_ssl_conf = '<STR_LIT>' % self . outputFolder <EOL> self . apache2_24_conf = '<STR_LIT>' % self . outputFolder <EOL> self . apache2_ssl_24_conf = '<STR_LIT>' % self . outputFolder <EOL> self . ldif_base = '<STR_LIT>' % self . outputFolder <EOL> self . ldif_appliance = '<STR_LIT>' % self . outputFolder <EOL> self . ldif_attributes = '<STR_LIT>' % self . outputFolder <EOL> self . ldif_scopes = '<STR_LIT>' % self . outputFolder <EOL> self . ldif_clients = '<STR_LIT>' % self . outputFolder <EOL> self . ldif_people = '<STR_LIT>' % self . outputFolder <EOL> self . ldif_groups = '<STR_LIT>' % self . outputFolder <EOL> self . ldif_site = '<STR_LIT>' % self . install_dir <EOL> self . ldif_scripts = '<STR_LIT>' % self . outputFolder <EOL> self . ldif_configuration = '<STR_LIT>' % self . outputFolder <EOL> self . ldif_scim = '<STR_LIT>' % self . outputFolder <EOL> self . ldif_asimba = '<STR_LIT>' % self . outputFolder <EOL> self . encode_script = '<STR_LIT>' % self . gluuOptFolder <EOL> self . cas_properties = '<STR_LIT>' % self . outputFolder <EOL> self . asimba_configuration = '<STR_LIT>' % self . outputFolder <EOL> self . asimba_properties = '<STR_LIT>' % self . outputFolder <EOL> self . asimba_selector_configuration = '<STR_LIT>' % self . tomcatHome <EOL> self . network = "<STR_LIT>" <EOL> self . ldap_setup_properties = '<STR_LIT>' % self . templateFolder <EOL> self . oxauth_config_base64 = None <EOL> self . oxauth_static_conf_base64 = None <EOL> self . oxauth_error_base64 = None <EOL> self . oxauth_openid_key_base64 = None <EOL> self . pairwiseCalculationKey = None <EOL> self . pairwiseCalculationSalt = None <EOL> self . oxtrust_config_base64 = None <EOL> self . oxtrust_cache_refresh_base64 = None <EOL> self . oxtrust_import_person_base64 = None <EOL> self . oxidp_config_base64 = None <EOL> self . oxcas_config_base64 = None <EOL> self . oxasimba_config_base64 = None <EOL> self . scim_rs_client_id = None <EOL> self . scim_rp_client_id = None <EOL> self . scim_rs_client_jwks = None <EOL> self . scim_rp_client_jwks = None <EOL> self . scim_rs_client_base64_jwks = None <EOL> self . scim_rp_client_base64_jwks = None <EOL> self . scim_rp_client_openid_key_json = '<STR_LIT>' % self . outputFolder <EOL> self . ldif_files = [ self . ldif_base , <EOL> self . ldif_appliance , <EOL> self . ldif_attributes , <EOL> self . ldif_scopes , <EOL> self . ldif_clients , <EOL> self . ldif_people , <EOL> self . ldif_groups , <EOL> self . ldif_site , <EOL> self . ldif_scripts , <EOL> self . ldif_configuration , <EOL> self . ldif_scim , <EOL> self . ldif_asimba <EOL> ] <EOL> self . ce_templates = { self . oxauth_config_json : False , <EOL> self . oxauth_context_xml : True , <EOL> self . oxtrust_context_xml : True , <EOL> self . tomcat_python_readme : True , <EOL> self . oxtrust_config_json : False , <EOL> self . oxtrust_cache_refresh_json : False , <EOL> self . oxtrust_import_person_json : False , <EOL> self . oxidp_config_json : False , <EOL> self . oxcas_config_json : False , <EOL> self . oxasimba_config_json : False , <EOL> self . tomcat_server_xml : True , <EOL> self . ox_ldap_properties : True , <EOL> self . tomcat_gluuTomcatWrapper : True , <EOL> self . oxauth_static_conf_json : False , <EOL> self . oxTrust_log_rotation_configuration : True , <EOL> self . ldap_setup_properties : False , <EOL> self . org_custom_schema : False , <EOL> self . apache2_conf : False , <EOL> self . apache2_ssl_conf : False , <EOL> self . apache2_24_conf : False , <EOL> self . apache2_ssl_24_conf : False , <EOL> self . etc_hosts : False , <EOL> self . etc_hostname : False , <EOL> self . ldif_base : False , <EOL> self . ldif_appliance : False , <EOL> self . ldif_attributes : False , <EOL> self . ldif_scopes : False , <EOL> self . ldif_clients : False , <EOL> self . ldif_people : False , <EOL> self . ldif_groups : False , <EOL> self . ldif_scripts : False , <EOL> self . ldif_scim : False , <EOL> self . ldif_asimba : False , <EOL> self . cas_properties : False , <EOL> self . asimba_configuration : False , <EOL> self . asimba_properties : False , <EOL> self . asimba_selector_configuration : True , <EOL> self . network : False <EOL> } <EOL> def __repr__ ( self ) : <EOL> try : <EOL> return '<STR_LIT>' . ljust ( <NUM_LIT:30> ) + self . hostname . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" + '<STR_LIT>' . ljust ( <NUM_LIT:30> ) + self . orgName . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" + '<STR_LIT>' . ljust ( <NUM_LIT:30> ) + self . os_type . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" + '<STR_LIT>' . ljust ( <NUM_LIT:30> ) + self . city . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" + '<STR_LIT:state>' . ljust ( <NUM_LIT:30> ) + self . state . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" + '<STR_LIT>' . ljust ( <NUM_LIT:30> ) + self . countryCode . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" + '<STR_LIT>' . ljust ( <NUM_LIT:30> ) + self . admin_email . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" + '<STR_LIT>' . ljust ( <NUM_LIT:30> ) + self . tomcat_max_ram . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" + '<STR_LIT>' . ljust ( <NUM_LIT:30> ) + self . ldapPass . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" + '<STR_LIT>' . ljust ( <NUM_LIT:30> ) + ` self . installOxAuth ` . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" + '<STR_LIT>' . ljust ( <NUM_LIT:30> ) + ` self . installOxAuth ` . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" + '<STR_LIT>' . ljust ( <NUM_LIT:30> ) + ` self . installLdap ` . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" + '<STR_LIT>' . ljust ( <NUM_LIT:30> ) + ` self . installHttpd ` . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" + '<STR_LIT>' . ljust ( <NUM_LIT:30> ) + ` self . installSaml ` . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" + '<STR_LIT>' . ljust ( <NUM_LIT:30> ) + ` self . installAsimba ` . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" + '<STR_LIT>' . ljust ( <NUM_LIT:30> ) + ` self . installCas ` . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" + '<STR_LIT>' . ljust ( <NUM_LIT:30> ) + ` self . installOxAuthRP ` . rjust ( <NUM_LIT> ) + "<STR_LIT:\n>" <EOL> except : <EOL> s = "<STR_LIT>" <EOL> for key in self . __dict__ . keys ( ) : <EOL> val = self . __dict__ [ key ] <EOL> s = s + "<STR_LIT>" % ( key , "<STR_LIT:->" * len ( key ) , val ) <EOL> return s <EOL> def add_ldap_schema ( self ) : <EOL> try : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> for schemaFile in self . schemaFiles : <EOL> self . copyFile ( schemaFile , self . schemaFolder ) <EOL> self . run ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , self . ldapBaseFolder ] ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def change_ownership ( self ) : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> realCertFolder = os . path . realpath ( self . certFolder ) <EOL> realTomcatFolder = os . path . realpath ( self . tomcatHome ) <EOL> realLdapBaseFolder = os . path . realpath ( self . ldapBaseFolder ) <EOL> realIdpFolder = os . path . realpath ( self . idpFolder ) <EOL> self . run ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , realCertFolder ] ) <EOL> self . run ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , realTomcatFolder ] ) <EOL> self . run ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , realLdapBaseFolder ] ) <EOL> self . run ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , self . oxBaseDataFolder ] ) <EOL> self . run ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , realIdpFolder ] ) <EOL> def change_permissions ( self ) : <EOL> realCertFolder = os . path . realpath ( self . certFolder ) <EOL> self . run ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , realCertFolder ] ) <EOL> self . run ( [ '<STR_LIT>' , '<STR_LIT>' , realCertFolder ] ) <EOL> def get_ip ( self ) : <EOL> testIP = None <EOL> detectedIP = None <EOL> try : <EOL> testSocket = socket . socket ( socket . AF_INET , socket . SOCK_DGRAM ) <EOL> detectedIP = [ ( testSocket . connect ( ( '<STR_LIT>' , <NUM_LIT> ) ) , <EOL> testSocket . getsockname ( ) [ <NUM_LIT:0> ] , <EOL> testSocket . close ( ) ) for s in [ socket . socket ( socket . AF_INET , socket . SOCK_DGRAM ) ] ] [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] <EOL> except : <EOL> self . logIt ( "<STR_LIT>" , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> if detectedIP : <EOL> testIP = self . getPrompt ( "<STR_LIT>" , detectedIP ) <EOL> else : <EOL> testIP = self . getPrompt ( "<STR_LIT>" ) <EOL> if not self . isIP ( testIP ) : <EOL> testIP = None <EOL> print '<STR_LIT>' <EOL> return testIP <EOL> def check_properties ( self ) : <EOL> self . logIt ( '<STR_LIT>' ) <EOL> while not self . hostname : <EOL> testhost = raw_input ( '<STR_LIT>' ) . strip ( ) <EOL> if len ( testhost . split ( '<STR_LIT:.>' ) ) >= <NUM_LIT:3> : <EOL> self . hostname = testhost <EOL> else : <EOL> print '<STR_LIT>' <EOL> while not self . ip : <EOL> self . ip = self . get_ip ( ) <EOL> while not self . orgName : <EOL> self . orgName = raw_input ( '<STR_LIT>' ) . strip ( ) <EOL> while not self . countryCode : <EOL> testCode = raw_input ( '<STR_LIT>' ) . strip ( ) <EOL> if len ( testCode ) == <NUM_LIT:2> : <EOL> self . countryCode = testCode <EOL> else : <EOL> print '<STR_LIT>' <EOL> while not self . city : <EOL> self . city = raw_input ( '<STR_LIT>' ) . strip ( ) <EOL> while not self . state : <EOL> self . state = raw_input ( '<STR_LIT>' ) . strip ( ) <EOL> if not self . admin_email : <EOL> tld = None <EOL> try : <EOL> tld = "<STR_LIT:.>" . join ( self . hostname . split ( "<STR_LIT:.>" ) [ - <NUM_LIT:2> : ] ) <EOL> except : <EOL> tld = self . hostname <EOL> self . admin_email = "<STR_LIT>" % tld <EOL> if not self . httpdKeyPass : <EOL> self . httpdKeyPass = self . getPW ( ) <EOL> if not self . ldapPass : <EOL> self . ldapPass = self . getPW ( ) <EOL> if not self . shibJksPass : <EOL> self . shibJksPass = self . getPW ( ) <EOL> if not self . asimbaJksPass : <EOL> self . asimbaJksPass = self . getPW ( ) <EOL> if not self . encode_salt : <EOL> self . encode_salt = self . getPW ( ) + self . getPW ( ) <EOL> if not self . baseInum : <EOL> self . baseInum = '<STR_LIT>' % tuple ( [ self . getQuad ( ) for i in xrange ( <NUM_LIT:4> ) ] ) <EOL> if not self . inumOrg : <EOL> orgTwoQuads = '<STR_LIT>' % tuple ( [ self . getQuad ( ) for i in xrange ( <NUM_LIT:2> ) ] ) <EOL> self . inumOrg = '<STR_LIT>' % ( self . baseInum , orgTwoQuads ) <EOL> if not self . inumAppliance : <EOL> applianceTwoQuads = '<STR_LIT>' % tuple ( [ self . getQuad ( ) for i in xrange ( <NUM_LIT:2> ) ] ) <EOL> self . inumAppliance = '<STR_LIT>' % ( self . baseInum , applianceTwoQuads ) <EOL> if not self . oxauth_client_id : <EOL> clientTwoQuads = '<STR_LIT>' % tuple ( [ self . getQuad ( ) for i in xrange ( <NUM_LIT:2> ) ] ) <EOL> self . oxauth_client_id = '<STR_LIT>' % ( self . inumOrg , clientTwoQuads ) <EOL> if not self . scim_rs_client_id : <EOL> scimClientTwoQuads = '<STR_LIT>' % tuple ( [ self . getQuad ( ) for i in xrange ( <NUM_LIT:2> ) ] ) <EOL> self . scim_rs_client_id = '<STR_LIT>' % ( self . inumOrg , scimClientTwoQuads ) <EOL> if not self . scim_rp_client_id : <EOL> scimClientTwoQuads = '<STR_LIT>' % tuple ( [ self . getQuad ( ) for i in xrange ( <NUM_LIT:2> ) ] ) <EOL> self . scim_rp_client_id = '<STR_LIT>' % ( self . inumOrg , scimClientTwoQuads ) <EOL> if not self . inumApplianceFN : <EOL> self . inumApplianceFN = self . inumAppliance . replace ( '<STR_LIT:@>' , '<STR_LIT>' ) . replace ( '<STR_LIT:!>' , '<STR_LIT>' ) . replace ( '<STR_LIT:.>' , '<STR_LIT>' ) <EOL> if not self . inumOrgFN : <EOL> self . inumOrgFN = self . inumOrg . replace ( '<STR_LIT:@>' , '<STR_LIT>' ) . replace ( '<STR_LIT:!>' , '<STR_LIT>' ) . replace ( '<STR_LIT:.>' , '<STR_LIT>' ) <EOL> def choose_from_list ( self , list_of_choices , choice_name = "<STR_LIT>" , default_choice_index = <NUM_LIT:0> ) : <EOL> return_value = None <EOL> choice_map = { } <EOL> chosen_index = <NUM_LIT:0> <EOL> print "<STR_LIT>" % choice_name <EOL> for choice in list_of_choices : <EOL> choice_map [ chosen_index ] = choice <EOL> chosen_index += <NUM_LIT:1> <EOL> print "<STR_LIT>" % ( chosen_index , choice ) <EOL> while not return_value : <EOL> choice_number = self . getPrompt ( "<STR_LIT>" , str ( default_choice_index + <NUM_LIT:1> ) ) <EOL> try : <EOL> choice_number = int ( choice_number ) - <NUM_LIT:1> <EOL> if ( choice_number >= <NUM_LIT:0> ) & ( choice_number < len ( list_of_choices ) ) : <EOL> return_value = choice_map [ choice_number ] <EOL> else : <EOL> print '<STR_LIT>' % ( choice_number + <NUM_LIT:1> ) <EOL> except : <EOL> print '<STR_LIT>' % choice_number <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> return return_value <EOL> def configure_httpd ( self ) : <EOL> if self . os_type in [ '<STR_LIT>' , '<STR_LIT>' ] and self . os_initdaemon == '<STR_LIT>' and self . apache_version == "<STR_LIT>" : <EOL> self . copyFile ( self . apache2_24_conf , '<STR_LIT>' ) <EOL> self . copyFile ( self . apache2_ssl_24_conf , '<STR_LIT>' ) <EOL> if self . os_type == '<STR_LIT>' and self . os_initdaemon == '<STR_LIT>' : <EOL> self . copyFile ( self . apache2_conf , '<STR_LIT>' ) <EOL> self . copyFile ( self . apache2_ssl_conf , '<STR_LIT>' ) <EOL> if self . os_type in [ '<STR_LIT>' , '<STR_LIT>' ] and self . os_initdaemon == '<STR_LIT>' : <EOL> self . copyFile ( self . apache2_conf , '<STR_LIT>' ) <EOL> self . copyFile ( self . apache2_ssl_conf , '<STR_LIT>' ) <EOL> if self . os_type in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> self . copyFile ( self . apache2_ssl_conf , '<STR_LIT>' ) <EOL> self . run ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> def configure_oxtrust ( self ) : <EOL> if not self . installSaml : <EOL> self . oxTrustConfigGeneration = "<STR_LIT:false>" <EOL> def configure_opendj ( self ) : <EOL> try : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> if self . opendj_version == "<STR_LIT>" : <EOL> opendj_prop_name = '<STR_LIT>' <EOL> else : <EOL> opendj_prop_name = '<STR_LIT>' <EOL> config_changes = [ [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' % self . ldap_backend_type , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:%s>' % opendj_prop_name ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> ] <EOL> for changes in config_changes : <EOL> dsconfigCmd = "<STR_LIT:U+0020>" . join ( [ '<STR_LIT>' % self . ldapBaseFolder , <EOL> self . ldapDsconfigCommand , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> self . ldap_hostname , <EOL> '<STR_LIT>' , <EOL> self . ldap_admin_port , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % self . ldap_binddn , <EOL> '<STR_LIT>' , <EOL> self . ldapPassFn ] + changes ) <EOL> self . run ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:-c>' , <EOL> dsconfigCmd ] ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def copyFile ( self , inFile , destFolder ) : <EOL> try : <EOL> shutil . copy ( inFile , destFolder ) <EOL> self . logIt ( "<STR_LIT>" % ( inFile , destFolder ) ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % ( inFile , destFolder ) , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def copyTree ( self , src , dst , symlinks = False , ignore = None ) : <EOL> try : <EOL> if not os . path . exists ( dst ) : <EOL> os . makedirs ( dst ) <EOL> for item in os . listdir ( src ) : <EOL> s = os . path . join ( src , item ) <EOL> d = os . path . join ( dst , item ) <EOL> if os . path . isdir ( s ) : <EOL> self . copyTree ( s , d , symlinks , ignore ) <EOL> else : <EOL> if not os . path . exists ( d ) or os . stat ( s ) . st_mtime - os . stat ( d ) . st_mtime > <NUM_LIT:1> : <EOL> shutil . copy2 ( s , d ) <EOL> self . logIt ( "<STR_LIT>" % ( src , dst ) ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % ( src , dst ) , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def copy_output ( self ) : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> service_path = '<STR_LIT>' <EOL> apache_service_name = '<STR_LIT>' <EOL> if self . os_type in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> service_path = '<STR_LIT>' <EOL> apache_service_name = '<STR_LIT>' <EOL> self . run ( [ service_path , apache_service_name , '<STR_LIT>' ] ) <EOL> for dest_fn in self . ce_templates . keys ( ) : <EOL> if self . ce_templates [ dest_fn ] : <EOL> fn = os . path . split ( dest_fn ) [ - <NUM_LIT:1> ] <EOL> output_fn = os . path . join ( self . outputFolder , fn ) <EOL> try : <EOL> self . logIt ( "<STR_LIT>" % ( output_fn , dest_fn ) ) <EOL> dest_dir = os . path . dirname ( dest_fn ) <EOL> if not os . path . exists ( dest_dir ) : <EOL> self . logIt ( "<STR_LIT>" % dest_dir ) <EOL> os . makedirs ( dest_dir ) ; <EOL> shutil . copyfile ( output_fn , dest_fn ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % ( output_fn , dest_fn ) , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> self . run ( [ service_path , apache_service_name , '<STR_LIT:start>' ] ) <EOL> def copy_scripts ( self ) : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> for script in self . gluuScriptFiles : <EOL> self . copyFile ( script , self . gluuOptBinFolder ) <EOL> self . logIt ( "<STR_LIT>" ) <EOL> try : <EOL> f = open ( '<STR_LIT>' % self . templateFolder ) <EOL> encode_script = f . read ( ) <EOL> f . close ( ) <EOL> f = open ( "<STR_LIT>" % self . gluuOptBinFolder , '<STR_LIT:w>' ) <EOL> f . write ( encode_script % self . __dict__ ) <EOL> f . close ( ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> self . run ( [ "<STR_LIT>" , '<STR_LIT>' , '<STR_LIT>' , self . gluuOptBinFolder ] ) <EOL> def copy_static ( self ) : <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , "<STR_LIT>" % self . tomcatHome ) <EOL> if self . installSaml : <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , "<STR_LIT>" % self . tomcatHome ) <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , "<STR_LIT>" % self . tomcatHome ) <EOL> self . copyTree ( "<STR_LIT>" % self . install_dir , self . idpConfFolder ) <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , "<STR_LIT>" % self . idpMetadataFolder ) <EOL> if self . installOxAuth : <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , "<STR_LIT>" % self . tomcatHome ) <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , "<STR_LIT>" % self . certFolder ) <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , "<STR_LIT>" % self . certFolder ) <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , "<STR_LIT>" % self . certFolder ) <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , "<STR_LIT>" % self . certFolder ) <EOL> def createDirs ( self , name ) : <EOL> try : <EOL> if not os . path . exists ( name ) : <EOL> os . makedirs ( name , <NUM_LIT:0> <NUM_LIT> ) <EOL> self . logIt ( '<STR_LIT>' % name ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % name , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def deleteLdapPw ( self ) : <EOL> try : <EOL> os . remove ( self . ldapPassFn ) <EOL> os . remove ( os . path . join ( self . ldapBaseFolder , '<STR_LIT>' ) ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % self . ldapPassFn ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def detect_os_type ( self ) : <EOL> try : <EOL> distro_info = self . file_get_contents ( '<STR_LIT>' ) <EOL> except IOError as e : <EOL> distro_info = self . file_get_contents ( '<STR_LIT>' ) <EOL> if '<STR_LIT>' in distro_info : <EOL> return self . os_types [ <NUM_LIT:0> ] <EOL> elif '<STR_LIT>' in distro_info : <EOL> return self . os_types [ <NUM_LIT:1> ] <EOL> elif '<STR_LIT>' in distro_info : <EOL> return self . os_types [ <NUM_LIT:3> ] <EOL> elif '<STR_LIT>' in distro_info : <EOL> return self . os_types [ <NUM_LIT:4> ] <EOL> else : <EOL> return self . choose_from_list ( self . os_types , "<STR_LIT>" ) <EOL> def detect_initd ( self ) : <EOL> return open ( os . path . join ( '<STR_LIT>' ) , '<STR_LIT:r>' ) . read ( ) . split ( ) [ <NUM_LIT:1> ] <EOL> def determineApacheVersion ( self , apache_cmd ) : <EOL> cmd = "<STR_LIT>" % apache_cmd <EOL> PIPE = subprocess . PIPE <EOL> p = subprocess . Popen ( cmd , shell = True , stdin = PIPE , stdout = PIPE , stderr = subprocess . STDOUT , close_fds = True , cwd = None ) <EOL> apache_version = p . stdout . read ( ) . strip ( ) . split ( '<STR_LIT:U+0020>' ) [ <NUM_LIT:2> ] . split ( '<STR_LIT:/>' ) [ <NUM_LIT:1> ] <EOL> if re . match ( r'<STR_LIT>' , apache_version ) : <EOL> return "<STR_LIT>" <EOL> return "<STR_LIT>" <EOL> def determineApacheVersionForOS ( self ) : <EOL> if self . os_type in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> return self . determineApacheVersion ( "<STR_LIT>" ) <EOL> else : <EOL> return self . determineApacheVersion ( "<STR_LIT>" ) <EOL> def determineOpenDJVersion ( self ) : <EOL> f = open ( '<STR_LIT>' , '<STR_LIT:r>' ) <EOL> encode_script = f . read ( ) . split ( ) [ <NUM_LIT:0> ] <EOL> f . close ( ) <EOL> if re . match ( r'<STR_LIT>' , encode_script ) : <EOL> return "<STR_LIT>" <EOL> return "<STR_LIT>" <EOL> def downloadWarFiles ( self ) : <EOL> if self . downloadWars : <EOL> print "<STR_LIT>" <EOL> self . run ( [ '<STR_LIT>' , self . oxauth_war , '<STR_LIT>' , '<STR_LIT>' % self . tomcatWebAppFolder ] ) <EOL> print "<STR_LIT>" <EOL> self . run ( [ '<STR_LIT>' , self . oxtrust_war , '<STR_LIT>' , '<STR_LIT>' % self . tomcatWebAppFolder ] ) <EOL> print "<STR_LIT>" <EOL> self . run ( [ '<STR_LIT>' , self . idp_war , '<STR_LIT>' , '<STR_LIT>' % self . idpWarFolder ] ) <EOL> print "<STR_LIT>" <EOL> self . run ( [ '<STR_LIT>' , self . cas_war , '<STR_LIT>' , '<STR_LIT>' % self . distFolder ] ) <EOL> print "<STR_LIT>" <EOL> def encode_passwords ( self ) : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> try : <EOL> self . encoded_ldap_pw = self . ldap_encode ( self . ldapPass ) <EOL> cmd = "<STR_LIT>" % ( self . oxEncodePWCommand , self . shibJksPass ) <EOL> self . encoded_shib_jks_pw = os . popen ( cmd , '<STR_LIT:r>' ) . read ( ) . strip ( ) <EOL> cmd = "<STR_LIT>" % ( self . oxEncodePWCommand , self . ldapPass ) <EOL> self . encoded_ox_ldap_pw = os . popen ( cmd , '<STR_LIT:r>' ) . read ( ) . strip ( ) <EOL> self . oxauthClient_pw = self . getPW ( ) <EOL> cmd = "<STR_LIT>" % ( self . oxEncodePWCommand , self . oxauthClient_pw ) <EOL> self . oxauthClient_encoded_pw = os . popen ( cmd , '<STR_LIT:r>' ) . read ( ) . strip ( ) <EOL> self . oxauthClient_2_pw = self . getPW ( ) <EOL> cmd = "<STR_LIT>" % ( self . oxEncodePWCommand , self . oxauthClient_2_pw ) <EOL> self . oxauthClient_2_encoded_pw = os . popen ( cmd , '<STR_LIT:r>' ) . read ( ) . strip ( ) <EOL> self . oxauthClient_3_pw = self . getPW ( ) <EOL> cmd = "<STR_LIT>" % ( self . oxEncodePWCommand , self . oxauthClient_3_pw ) <EOL> self . oxauthClient_3_encoded_pw = os . popen ( cmd , '<STR_LIT:r>' ) . read ( ) . strip ( ) <EOL> self . oxauthClient_4_pw = self . getPW ( ) <EOL> cmd = "<STR_LIT>" % ( self . oxEncodePWCommand , self . oxauthClient_4_pw ) <EOL> self . oxauthClient_4_encoded_pw = os . popen ( cmd , '<STR_LIT:r>' ) . read ( ) . strip ( ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def export_opendj_public_cert ( self ) : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> openDjPinFn = '<STR_LIT>' % self . ldapBaseFolder <EOL> openDjTruststoreFn = '<STR_LIT>' % self . ldapBaseFolder <EOL> openDjPin = None <EOL> try : <EOL> f = open ( openDjPinFn ) <EOL> openDjPin = f . read ( ) . splitlines ( ) [ <NUM_LIT:0> ] <EOL> f . close ( ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> self . logIt ( "<STR_LIT>" ) <EOL> self . run ( [ self . keytoolCommand , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> openDjTruststoreFn , <EOL> '<STR_LIT>' , <EOL> openDjPin , <EOL> '<STR_LIT>' , <EOL> self . openDjCertFn , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> self . logIt ( "<STR_LIT>" ) <EOL> self . run ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" % self . hostname , "<STR_LIT>" , self . openDjCertFn , "<STR_LIT>" , self . defaultTrustStoreFN , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> def file_get_contents ( self , filename ) : <EOL> with open ( filename ) as f : <EOL> return f . read ( ) <EOL> def gen_cert ( self , suffix , password , user = '<STR_LIT:root>' ) : <EOL> self . logIt ( '<STR_LIT>' % suffix ) <EOL> key_with_password = '<STR_LIT>' % ( self . certFolder , suffix ) <EOL> key = '<STR_LIT>' % ( self . certFolder , suffix ) <EOL> csr = '<STR_LIT>' % ( self . certFolder , suffix ) <EOL> public_certificate = '<STR_LIT>' % ( self . certFolder , suffix ) <EOL> self . run ( [ self . opensslCommand , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> key_with_password , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % password , <EOL> '<STR_LIT>' <EOL> ] ) <EOL> self . run ( [ self . opensslCommand , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> key_with_password , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % password , <EOL> '<STR_LIT>' , <EOL> key <EOL> ] ) <EOL> self . run ( [ self . opensslCommand , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> key , <EOL> '<STR_LIT>' , <EOL> csr , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % ( self . countryCode , self . state , self . city , self . orgName , self . hostname , self . admin_email ) <EOL> ] ) <EOL> self . run ( [ self . opensslCommand , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> csr , <EOL> '<STR_LIT>' , <EOL> key , <EOL> '<STR_LIT>' , <EOL> public_certificate <EOL> ] ) <EOL> self . run ( [ "<STR_LIT>" , '<STR_LIT>' % ( user , user ) , key_with_password ] ) <EOL> self . run ( [ "<STR_LIT>" , '<STR_LIT>' , key_with_password ] ) <EOL> self . run ( [ "<STR_LIT>" , '<STR_LIT>' % ( user , user ) , key ] ) <EOL> self . run ( [ "<STR_LIT>" , '<STR_LIT>' , key ] ) <EOL> self . run ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" % ( self . hostname , suffix ) , "<STR_LIT>" , public_certificate , "<STR_LIT>" , self . defaultTrustStoreFN , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> def generate_crypto ( self ) : <EOL> try : <EOL> self . logIt ( '<STR_LIT>' ) <EOL> self . gen_cert ( '<STR_LIT>' , self . httpdKeyPass , '<STR_LIT>' ) <EOL> self . gen_cert ( '<STR_LIT>' , self . shibJksPass , '<STR_LIT>' ) <EOL> self . gen_cert ( '<STR_LIT>' , self . asimbaJksPass , '<STR_LIT>' ) <EOL> self . gen_keystore ( '<STR_LIT>' , <EOL> self . shibJksFn , <EOL> self . shibJksPass , <EOL> '<STR_LIT>' % self . certFolder , <EOL> '<STR_LIT>' % self . certFolder , <EOL> '<STR_LIT>' ) <EOL> self . gen_keystore ( '<STR_LIT>' , <EOL> self . asimbaJksFn , <EOL> self . asimbaJksPass , <EOL> '<STR_LIT>' % self . certFolder , <EOL> '<STR_LIT>' % self . certFolder , <EOL> '<STR_LIT>' ) <EOL> self . run ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , self . certFolder ] ) <EOL> self . run ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , self . certFolder ] ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def gen_keystore ( self , suffix , keystoreFN , keystorePW , inKey , inCert , user = '<STR_LIT:root>' ) : <EOL> self . logIt ( "<STR_LIT>" % suffix ) <EOL> pkcs_fn = '<STR_LIT>' % ( self . certFolder , suffix ) <EOL> self . run ( [ self . opensslCommand , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> inKey , <EOL> '<STR_LIT>' , <EOL> inCert , <EOL> '<STR_LIT>' , <EOL> pkcs_fn , <EOL> '<STR_LIT>' , <EOL> self . hostname , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % keystorePW <EOL> ] ) <EOL> self . run ( [ self . keytoolCommand , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % ( self . certFolder , suffix ) , <EOL> '<STR_LIT>' , <EOL> keystorePW , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> keystoreFN , <EOL> '<STR_LIT>' , <EOL> keystorePW , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] ) <EOL> self . run ( [ "<STR_LIT>" , '<STR_LIT>' % ( user , user ) , pkcs_fn ] ) <EOL> self . run ( [ "<STR_LIT>" , '<STR_LIT>' , pkcs_fn ] ) <EOL> self . run ( [ "<STR_LIT>" , '<STR_LIT>' % ( user , user ) , keystoreFN ] ) <EOL> self . run ( [ "<STR_LIT>" , '<STR_LIT>' , keystoreFN ] ) <EOL> def gen_openid_keys ( self ) : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , self . tomcat_user_home_lib ) <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , self . tomcat_user_home_lib ) <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , self . tomcat_user_home_lib ) <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , self . tomcat_user_home_lib ) <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , self . tomcat_user_home_lib ) <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , self . tomcat_user_home_lib ) <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , self . tomcat_user_home_lib ) <EOL> self . change_ownership ( ) <EOL> requiredJars = [ '<STR_LIT>' % self . tomcat_user_home_lib , <EOL> '<STR_LIT>' % self . tomcat_user_home_lib , <EOL> '<STR_LIT>' % self . tomcat_user_home_lib , <EOL> '<STR_LIT>' % self . tomcat_user_home_lib , <EOL> '<STR_LIT>' % self . tomcat_user_home_lib , <EOL> '<STR_LIT>' % self . tomcat_user_home_lib , <EOL> '<STR_LIT>' % self . tomcat_user_home_lib ] <EOL> cmd = "<STR_LIT:U+0020>" . join ( [ "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT::>" . join ( requiredJars ) , <EOL> "<STR_LIT>" ] ) <EOL> args = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:-c>" , cmd ] <EOL> self . logIt ( "<STR_LIT>" % "<STR_LIT:U+0020>" . join ( args ) ) <EOL> try : <EOL> p = subprocess . Popen ( args , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) <EOL> output , err = p . communicate ( ) <EOL> p . wait ( ) <EOL> if err : <EOL> self . logIt ( err , True ) <EOL> if output : <EOL> return output . split ( os . linesep ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % "<STR_LIT:U+0020>" . join ( args ) , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> return None <EOL> def write_openid_keys ( self , fn , jwks ) : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> if not jwks : <EOL> self . logIt ( "<STR_LIT>" % fn ) <EOL> return <EOL> try : <EOL> jwks_text = '<STR_LIT:\n>' . join ( jwks ) <EOL> f = open ( fn , '<STR_LIT:w>' ) <EOL> f . write ( jwks_text ) <EOL> f . close ( ) <EOL> self . run ( [ "<STR_LIT>" , '<STR_LIT>' , fn ] ) <EOL> self . run ( [ "<STR_LIT>" , '<STR_LIT>' , fn ] ) <EOL> self . logIt ( "<STR_LIT>" % fn ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % fn , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def generate_oxauth_openid_keys ( self ) : <EOL> jwks = self . gen_openid_keys ( ) <EOL> self . write_openid_keys ( self . oxauth_openid_key_json , jwks ) <EOL> def generate_base64_string ( self , lines , num_spaces ) : <EOL> if not lines : <EOL> return None <EOL> plain_text = '<STR_LIT>' . join ( lines ) <EOL> plain_b64encoded_text = plain_text . encode ( '<STR_LIT>' ) . strip ( ) <EOL> if num_spaces > <NUM_LIT:0> : <EOL> plain_b64encoded_text = self . reindent ( plain_b64encoded_text , num_spaces ) <EOL> return plain_b64encoded_text <EOL> def genRandomString ( self , N ) : <EOL> return '<STR_LIT>' . join ( random . SystemRandom ( ) . choice ( string . ascii_lowercase <EOL> + string . ascii_uppercase <EOL> + string . digits ) for _ in range ( N ) ) <EOL> def generate_scim_configuration ( self ) : <EOL> self . scim_rs_client_jwks = self . gen_openid_keys ( ) <EOL> self . scim_rp_client_jwks = self . gen_openid_keys ( ) <EOL> self . scim_rs_client_base64_jwks = self . generate_base64_string ( self . scim_rs_client_jwks , <NUM_LIT:1> ) <EOL> self . scim_rp_client_base64_jwks = self . generate_base64_string ( self . scim_rp_client_jwks , <NUM_LIT:1> ) <EOL> self . write_openid_keys ( self . scim_rp_client_openid_key_json , self . scim_rp_client_jwks ) <EOL> def getPrompt ( self , prompt , defaultValue = None ) : <EOL> try : <EOL> if defaultValue : <EOL> user_input = raw_input ( "<STR_LIT>" % ( prompt , defaultValue ) ) . strip ( ) <EOL> if user_input == '<STR_LIT>' : <EOL> return defaultValue <EOL> else : <EOL> return user_input <EOL> else : <EOL> input = False <EOL> while not input : <EOL> user_input = raw_input ( "<STR_LIT>" % prompt ) . strip ( ) <EOL> if user_input != '<STR_LIT>' : <EOL> input = True <EOL> return user_input <EOL> except KeyboardInterrupt : <EOL> sys . exit ( ) <EOL> except : <EOL> return None <EOL> def getPW ( self , size = <NUM_LIT:12> , chars = string . ascii_uppercase + string . digits + string . lowercase ) : <EOL> return '<STR_LIT>' . join ( random . choice ( chars ) for _ in range ( size ) ) <EOL> def getQuad ( self ) : <EOL> return str ( uuid . uuid4 ( ) ) [ : <NUM_LIT:4> ] . upper ( ) <EOL> def import_ldif ( self ) : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> ldifFolder = '<STR_LIT>' % self . ldapBaseFolder <EOL> for ldif_file_fn in self . ldif_files : <EOL> ldifFolder = '<STR_LIT>' % self . ldapBaseFolder <EOL> self . copyFile ( ldif_file_fn , ldifFolder ) <EOL> ldif_file_fullpath = "<STR_LIT>" % ( self . ldapBaseFolder , <EOL> os . path . split ( ldif_file_fn ) [ - <NUM_LIT:1> ] ) <EOL> self . run ( [ '<STR_LIT>' , '<STR_LIT>' , ldif_file_fullpath ] ) <EOL> importParams = [ '<STR_LIT>' % self . ldapBaseFolder , <EOL> self . loadLdifCommand , <EOL> '<STR_LIT>' , <EOL> self . ldap_hostname , <EOL> '<STR_LIT>' , <EOL> self . ldap_admin_port , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % self . ldap_binddn , <EOL> '<STR_LIT>' , <EOL> self . ldapPassFn , <EOL> '<STR_LIT>' ] <EOL> if self . opendj_version == "<STR_LIT>" : <EOL> importParams . append ( '<STR_LIT>' ) <EOL> importParams . append ( '<STR_LIT>' ) <EOL> importParams . append ( '<STR_LIT>' ) <EOL> importParams . append ( '<STR_LIT>' ) <EOL> importParams . append ( ldif_file_fullpath ) <EOL> else : <EOL> importParams . append ( '<STR_LIT>' ) <EOL> importParams . append ( '<STR_LIT>' ) <EOL> importParams . append ( '<STR_LIT>' ) <EOL> importParams . append ( '<STR_LIT>' ) <EOL> importParams . append ( ldif_file_fullpath ) <EOL> importCmd = "<STR_LIT:U+0020>" . join ( importParams ) <EOL> self . run ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:-c>' , <EOL> '<STR_LIT:%s>' % importCmd ] ) <EOL> self . logIt ( "<STR_LIT>" ) <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , ldifFolder ) <EOL> site_ldif_fn = "<STR_LIT>" % ldifFolder <EOL> self . run ( [ '<STR_LIT>' , '<STR_LIT>' , site_ldif_fn ] ) <EOL> importParams = [ '<STR_LIT>' % self . ldapBaseFolder , <EOL> self . importLdifCommand , <EOL> '<STR_LIT>' , <EOL> site_ldif_fn , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> self . ldap_hostname , <EOL> '<STR_LIT>' , <EOL> self . ldap_admin_port , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % self . ldap_binddn , <EOL> '<STR_LIT>' , <EOL> self . ldapPassFn , <EOL> '<STR_LIT>' ] <EOL> if self . opendj_version == "<STR_LIT>" : <EOL> importParams . append ( '<STR_LIT>' ) <EOL> importCmd = "<STR_LIT:U+0020>" . join ( importParams ) <EOL> self . run ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:-c>' , <EOL> '<STR_LIT:%s>' % importCmd ] ) <EOL> def index_opendj ( self , backend ) : <EOL> if self . opendj_version == "<STR_LIT>" : <EOL> index_command = '<STR_LIT>' <EOL> else : <EOL> index_command = '<STR_LIT>' <EOL> try : <EOL> self . logIt ( "<STR_LIT>" + backend + "<STR_LIT>" ) <EOL> index_json = self . load_json ( self . indexJson ) <EOL> if index_json : <EOL> for attrDict in index_json : <EOL> attr_name = attrDict [ '<STR_LIT>' ] <EOL> index_types = attrDict [ '<STR_LIT:index>' ] <EOL> for index_type in index_types : <EOL> backend_names = attrDict [ '<STR_LIT>' ] <EOL> for backend_name in backend_names : <EOL> if ( backend_name == backend ) : <EOL> self . logIt ( "<STR_LIT>" % ( index_type , attr_name ) ) <EOL> indexCmd = "<STR_LIT:U+0020>" . join ( [ '<STR_LIT>' % self . ldapBaseFolder , <EOL> self . ldapDsconfigCommand , <EOL> index_command , <EOL> '<STR_LIT>' , <EOL> backend , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> attr_name , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % index_type , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> self . ldap_hostname , <EOL> '<STR_LIT>' , <EOL> self . ldap_admin_port , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % self . ldap_binddn , <EOL> '<STR_LIT>' , self . ldapPassFn , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> self . run ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:-c>' , <EOL> indexCmd ] ) <EOL> else : <EOL> self . logIt ( '<STR_LIT>' % self . indexJson , True ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" + backend + "<STR_LIT>" , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def install_saml ( self ) : <EOL> if self . installSaml : <EOL> identityWar = '<STR_LIT>' <EOL> distIdentityPath = '<STR_LIT>' % ( self . tomcatWebAppFolder , identityWar ) <EOL> tmpIdentityDir = '<STR_LIT>' % self . distFolder <EOL> self . logIt ( "<STR_LIT>" % ( '<STR_LIT>' , identityWar ) ) <EOL> self . removeDirs ( tmpIdentityDir ) <EOL> self . createDirs ( tmpIdentityDir ) <EOL> identityConfFilePattern = '<STR_LIT>' % self . oxVersion <EOL> self . run ( [ self . jarCommand , <EOL> '<STR_LIT>' , <EOL> distIdentityPath , identityConfFilePattern ] , tmpIdentityDir ) <EOL> self . logIt ( "<STR_LIT>" % '<STR_LIT>' ) <EOL> self . run ( [ self . jarCommand , <EOL> '<STR_LIT>' , <EOL> identityConfFilePattern ] , tmpIdentityDir ) <EOL> self . logIt ( "<STR_LIT>" ) <EOL> self . removeDirs ( '<STR_LIT>' % self . tomcatHome ) <EOL> self . createDirs ( '<STR_LIT>' % self . tomcatHome ) <EOL> self . copyTree ( '<STR_LIT>' % tmpIdentityDir , '<STR_LIT>' % self . tomcatHome ) <EOL> self . removeDirs ( tmpIdentityDir ) <EOL> idpWar = "<STR_LIT>" <EOL> distIdpPath = '<STR_LIT>' % ( self . idpWarFolder , idpWar ) <EOL> tmpIdpDir = '<STR_LIT>' % self . distFolder <EOL> self . logIt ( "<STR_LIT>" % idpWar ) <EOL> self . removeDirs ( tmpIdpDir ) <EOL> self . createDirs ( tmpIdpDir ) <EOL> self . run ( [ self . jarCommand , <EOL> '<STR_LIT>' , <EOL> distIdpPath ] , tmpIdpDir ) <EOL> self . logIt ( "<STR_LIT>" % self . idpLibFolder ) <EOL> self . copyTree ( '<STR_LIT>' % tmpIdpDir , self . idpLibFolder ) <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , self . idpLibFolder ) <EOL> self . copyFile ( "<STR_LIT>" % self . install_dir , self . idpLibFolder ) <EOL> self . removeDirs ( tmpIdpDir ) <EOL> def install_asimba_war ( self ) : <EOL> if self . installAsimba : <EOL> asimbaWar = '<STR_LIT>' <EOL> distAsimbaPath = '<STR_LIT>' % ( self . distFolder , asimbaWar ) <EOL> if not os . path . exists ( distAsimbaPath ) : <EOL> print "<STR_LIT>" <EOL> self . run ( [ '<STR_LIT>' , self . asimba_war , '<STR_LIT>' , '<STR_LIT>' % self . distFolder ] ) <EOL> tmpAsimbaDir = '<STR_LIT>' % self . distFolder <EOL> self . logIt ( "<STR_LIT>" % asimbaWar ) <EOL> self . removeDirs ( tmpAsimbaDir ) <EOL> self . createDirs ( tmpAsimbaDir ) <EOL> self . run ( [ self . jarCommand , <EOL> '<STR_LIT>' , <EOL> distAsimbaPath ] , tmpAsimbaDir ) <EOL> self . logIt ( "<STR_LIT>" ) <EOL> self . copyFile ( self . asimba_configuration , '<STR_LIT>' % tmpAsimbaDir ) <EOL> self . copyFile ( self . asimba_properties , '<STR_LIT>' % tmpAsimbaDir ) <EOL> self . logIt ( "<STR_LIT>" ) <EOL> self . run ( [ self . jarCommand , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % tmpAsimbaDir , <EOL> '<STR_LIT:.>' ] , self . distFolder ) <EOL> self . logIt ( "<STR_LIT>" ) <EOL> self . copyFile ( '<STR_LIT>' % self . distFolder , self . tomcatWebAppFolder ) <EOL> self . removeDirs ( tmpAsimbaDir ) <EOL> self . removeFile ( '<STR_LIT>' % self . distFolder ) <EOL> def install_cas_war ( self ) : <EOL> if self . installCas : <EOL> casWar = '<STR_LIT>' <EOL> distCasPath = '<STR_LIT>' % ( self . distFolder , casWar ) <EOL> tmpCasDir = '<STR_LIT>' % self . distFolder <EOL> self . logIt ( "<STR_LIT>" % casWar ) <EOL> self . removeDirs ( tmpCasDir ) <EOL> self . createDirs ( tmpCasDir ) <EOL> self . run ( [ self . jarCommand , <EOL> '<STR_LIT>' , <EOL> distCasPath ] , tmpCasDir ) <EOL> self . logIt ( "<STR_LIT>" ) <EOL> casTemplatePropertiesPath = '<STR_LIT>' % self . outputFolder <EOL> casWarPropertiesPath = '<STR_LIT>' % tmpCasDir <EOL> self . copyFile ( casTemplatePropertiesPath , casWarPropertiesPath ) <EOL> self . logIt ( "<STR_LIT>" ) <EOL> self . run ( [ self . jarCommand , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % tmpCasDir , <EOL> '<STR_LIT:.>' ] , self . distFolder ) <EOL> self . logIt ( "<STR_LIT>" ) <EOL> self . copyFile ( '<STR_LIT>' % self . distFolder , self . tomcatWebAppFolder ) <EOL> self . removeDirs ( tmpCasDir ) <EOL> self . removeFile ( '<STR_LIT>' % self . distFolder ) <EOL> def install_oxauth_rp_war ( self ) : <EOL> if self . installOxAuthRP : <EOL> oxAuthRPWar = '<STR_LIT>' <EOL> distOxAuthRpPath = '<STR_LIT>' % ( self . distFolder , oxAuthRPWar ) <EOL> if not os . path . exists ( distOxAuthRpPath ) : <EOL> print "<STR_LIT>" <EOL> self . run ( [ '<STR_LIT>' , self . oxauth_rp_war , '<STR_LIT>' , '<STR_LIT>' % self . distFolder ] ) <EOL> self . logIt ( "<STR_LIT>" ) <EOL> self . copyFile ( '<STR_LIT>' % self . distFolder , self . tomcatWebAppFolder ) <EOL> self . removeFile ( '<STR_LIT>' % self . distFolder ) <EOL> def isIP ( self , address ) : <EOL> try : <EOL> socket . inet_aton ( address ) <EOL> return True <EOL> except socket . error : <EOL> return False <EOL> def logIt ( self , msg , errorLog = False ) : <EOL> if errorLog : <EOL> f = open ( self . logError , '<STR_LIT:a>' ) <EOL> f . write ( '<STR_LIT>' % ( time . strftime ( '<STR_LIT>' ) , msg ) ) <EOL> f . close ( ) <EOL> f = open ( self . log , '<STR_LIT:a>' ) <EOL> f . write ( '<STR_LIT>' % ( time . strftime ( '<STR_LIT>' ) , msg ) ) <EOL> f . close ( ) <EOL> def ldap_encode ( self , password ) : <EOL> salt = os . urandom ( <NUM_LIT:4> ) <EOL> sha = hashlib . sha1 ( password ) <EOL> sha . update ( salt ) <EOL> b64encoded = '<STR_LIT>' . format ( sha . digest ( ) , salt ) . encode ( '<STR_LIT>' ) . strip ( ) <EOL> encrypted_password = '<STR_LIT>' . format ( b64encoded ) <EOL> return encrypted_password <EOL> def load_properties ( self , fn ) : <EOL> self . logIt ( '<STR_LIT>' % fn ) <EOL> p = Properties . Properties ( ) <EOL> try : <EOL> p . load ( open ( fn ) ) <EOL> properties_list = p . keys ( ) <EOL> for prop in properties_list : <EOL> try : <EOL> self . __dict__ [ prop ] = p [ prop ] <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % prop ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def load_json ( self , fn ) : <EOL> self . logIt ( '<STR_LIT>' % fn ) <EOL> try : <EOL> json_file = open ( fn ) <EOL> json_text = json_file . read ( ) <EOL> json_file . close ( ) <EOL> return json . loads ( json_text ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % fn , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> return None <EOL> def makeFolders ( self ) : <EOL> try : <EOL> mkdir = '<STR_LIT>' <EOL> chown = '<STR_LIT>' <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . configFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . certFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . outputFolder ] ) <EOL> if self . installOxTrust | self . installOxAuth : <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . gluuOptFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . gluuOptBinFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . tomcat_user_home_lib ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . oxPhotosFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . oxTrustRemovedFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . oxTrustCacheRefreshFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . oxCustomizationFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , "<STR_LIT>" % self . oxCustomizationFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , "<STR_LIT>" % self . oxCustomizationFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , "<STR_LIT>" % self . oxCustomizationFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , "<STR_LIT>" % self . oxCustomizationFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , "<STR_LIT>" % self . oxCustomizationFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , "<STR_LIT>" % self . oxCustomizationFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , "<STR_LIT>" % self . oxCustomizationFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , "<STR_LIT>" % self . oxCustomizationFolder ] ) <EOL> self . run ( [ chown , '<STR_LIT>' , '<STR_LIT>' , self . oxCustomizationFolder ] ) <EOL> if self . installSaml : <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . idpFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . idpMetadataFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . idpLogsFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . idpLibFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . idpConfFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . idpSslFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . idpTempMetadataFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . idpWarFolder ] ) <EOL> self . run ( [ mkdir , '<STR_LIT>' , self . idpSPFolder ] ) <EOL> self . run ( [ chown , '<STR_LIT>' , '<STR_LIT>' , self . idpFolder ] ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def make_salt ( self ) : <EOL> try : <EOL> f = open ( "<STR_LIT>" % self . tomcatHome , '<STR_LIT:w>' ) <EOL> f . write ( '<STR_LIT>' % self . encode_salt ) <EOL> f . close ( ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> sys . exit ( ) <EOL> def make_oxauth_salt ( self ) : <EOL> self . oxauth_jsf_salt = os . urandom ( <NUM_LIT:16> ) . encode ( '<STR_LIT>' ) <EOL> self . pairwiseCalculationKey = self . genRandomString ( random . randint ( <NUM_LIT:20> , <NUM_LIT:30> ) ) <EOL> self . pairwiseCalculationSalt = self . genRandomString ( random . randint ( <NUM_LIT:20> , <NUM_LIT:30> ) ) <EOL> def promptForProperties ( self ) : <EOL> if self . installHttpd : <EOL> self . ip = self . get_ip ( ) <EOL> detectedHostname = None <EOL> try : <EOL> detectedHostname = socket . gethostbyaddr ( socket . gethostname ( ) ) [ <NUM_LIT:0> ] <EOL> except : <EOL> try : <EOL> detectedHostname = os . popen ( "<STR_LIT>" ) . read ( ) . strip ( ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> if detectedHostname : <EOL> self . hostname = self . getPrompt ( "<STR_LIT>" , detectedHostname ) <EOL> else : <EOL> self . hostname = self . getPrompt ( "<STR_LIT>" ) <EOL> self . city = self . getPrompt ( "<STR_LIT>" ) <EOL> self . state = self . getPrompt ( "<STR_LIT>" ) <EOL> long_enough = False <EOL> while not long_enough : <EOL> countryCode = self . getPrompt ( "<STR_LIT>" ) <EOL> if len ( countryCode ) != <NUM_LIT:2> : <EOL> print "<STR_LIT>" <EOL> else : <EOL> self . countryCode = countryCode <EOL> long_enough = True <EOL> self . orgName = self . getPrompt ( "<STR_LIT>" ) <EOL> self . admin_email = self . getPrompt ( '<STR_LIT>' ) <EOL> self . tomcat_max_ram = self . getPrompt ( "<STR_LIT>" , '<STR_LIT>' ) <EOL> randomPW = self . getPW ( ) <EOL> self . ldapPass = self . getPrompt ( "<STR_LIT>" , randomPW ) <EOL> promptForOxAuth = self . getPrompt ( "<STR_LIT>" , "<STR_LIT>" ) [ <NUM_LIT:0> ] . lower ( ) <EOL> if promptForOxAuth == '<STR_LIT:y>' : <EOL> self . installOxAuth = True <EOL> else : <EOL> self . installOxAuth = False <EOL> promptForOxTrust = self . getPrompt ( "<STR_LIT>" , "<STR_LIT>" ) [ <NUM_LIT:0> ] . lower ( ) <EOL> if promptForOxTrust == '<STR_LIT:y>' : <EOL> self . installOxTrust = True <EOL> else : <EOL> self . installOxTrust = False <EOL> promptForLDAP = self . getPrompt ( "<STR_LIT>" , "<STR_LIT>" ) [ <NUM_LIT:0> ] . lower ( ) <EOL> if promptForLDAP == '<STR_LIT:y>' : <EOL> self . installLdap = True <EOL> else : <EOL> self . installLdap = False <EOL> promptForHTTPD = self . getPrompt ( "<STR_LIT>" , "<STR_LIT>" ) [ <NUM_LIT:0> ] . lower ( ) <EOL> if promptForHTTPD == '<STR_LIT:y>' : <EOL> self . installHttpd = True <EOL> else : <EOL> self . installHttpd = False <EOL> promptForShibIDP = self . getPrompt ( "<STR_LIT>" , "<STR_LIT>" ) [ <NUM_LIT:0> ] . lower ( ) <EOL> if promptForShibIDP == '<STR_LIT:y>' : <EOL> self . installSaml = True <EOL> else : <EOL> self . installSaml = False <EOL> promptForAsimba = self . getPrompt ( "<STR_LIT>" , "<STR_LIT>" ) [ <NUM_LIT:0> ] . lower ( ) <EOL> if promptForAsimba == '<STR_LIT:y>' : <EOL> self . installAsimba = True <EOL> else : <EOL> self . installAsimba = False <EOL> promptForCAS = self . getPrompt ( "<STR_LIT>" , "<STR_LIT>" ) [ <NUM_LIT:0> ] . lower ( ) <EOL> if promptForCAS == '<STR_LIT:y>' : <EOL> self . installCas = True <EOL> else : <EOL> self . installCas = False <EOL> promptForOxAuthRP = self . getPrompt ( "<STR_LIT>" , "<STR_LIT>" ) [ <NUM_LIT:0> ] . lower ( ) <EOL> if promptForOxAuthRP == '<STR_LIT:y>' : <EOL> self . installOxAuthRP = True <EOL> else : <EOL> self . installOxAuthRP = False <EOL> def removeDirs ( self , name ) : <EOL> try : <EOL> if os . path . exists ( name ) : <EOL> shutil . rmtree ( name ) <EOL> self . logIt ( '<STR_LIT>' % name ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % name , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def removeFile ( self , fileName ) : <EOL> try : <EOL> if os . path . exists ( fileName ) : <EOL> os . remove ( fileName ) <EOL> self . logIt ( '<STR_LIT>' % fileName ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % fileName , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def get_filepaths ( self , directory ) : <EOL> file_paths = [ ] <EOL> for root , directories , files in os . walk ( directory ) : <EOL> for filename in files : <EOL> file_paths . append ( filename ) <EOL> return file_paths <EOL> def renderTemplate ( self , filePath ) : <EOL> self . logIt ( "<STR_LIT>" % filePath ) <EOL> fn = os . path . split ( filePath ) [ - <NUM_LIT:1> ] <EOL> f = open ( os . path . join ( self . templateFolder , fn ) ) <EOL> template_text = f . read ( ) <EOL> f . close ( ) <EOL> newFn = open ( os . path . join ( self . outputFolder , fn ) , '<STR_LIT>' ) <EOL> newFn . write ( template_text % self . __dict__ ) <EOL> newFn . close ( ) <EOL> def render_templates ( self ) : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> for fullPath in self . ce_templates . keys ( ) : <EOL> try : <EOL> self . renderTemplate ( fullPath ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % fullPath , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def render_configuration_template ( self ) : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> fullPath = self . ldif_configuration <EOL> try : <EOL> self . renderTemplate ( fullPath ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % fullPath , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def render_test_templates ( self ) : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> testTepmplatesFolder = '<STR_LIT>' % self . templateFolder <EOL> for templateBase , templateDirectories , templateFiles in os . walk ( testTepmplatesFolder ) : <EOL> for templateFile in templateFiles : <EOL> fullPath = '<STR_LIT>' % ( templateBase , templateFile ) <EOL> try : <EOL> self . logIt ( "<STR_LIT>" % fullPath ) <EOL> fn = fullPath [ <NUM_LIT:12> : ] <EOL> f = open ( os . path . join ( self . templateFolder , fn ) ) <EOL> template_text = f . read ( ) <EOL> f . close ( ) <EOL> fullOutputFile = os . path . join ( self . outputFolder , fn ) <EOL> fullOutputDir = os . path . dirname ( fullOutputFile ) <EOL> if not os . path . exists ( fullOutputDir ) : <EOL> os . makedirs ( fullOutputDir ) <EOL> newFn = open ( fullOutputFile , '<STR_LIT>' ) <EOL> newFn . write ( template_text % self . __dict__ ) <EOL> newFn . close ( ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % fullPath , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def reindent ( self , text , num_spaces ) : <EOL> text = string . split ( text , '<STR_LIT:\n>' ) <EOL> text = [ ( num_spaces * '<STR_LIT:U+0020>' ) + string . lstrip ( line ) for line in text ] <EOL> text = string . join ( text , '<STR_LIT:\n>' ) <EOL> return text <EOL> def generate_base64_file ( self , fn , num_spaces ) : <EOL> self . logIt ( '<STR_LIT>' % fn ) <EOL> plain_file_b64encoded_text = None <EOL> try : <EOL> plain_file = open ( fn ) <EOL> plain_file_text = plain_file . read ( ) <EOL> plain_file_b64encoded_text = plain_file_text . encode ( '<STR_LIT>' ) . strip ( ) <EOL> plain_file . close ( ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> if num_spaces > <NUM_LIT:0> : <EOL> plain_file_b64encoded_text = self . reindent ( plain_file_b64encoded_text , num_spaces ) <EOL> return plain_file_b64encoded_text <EOL> def generate_base64_ldap_file ( self , fn ) : <EOL> return self . generate_base64_file ( fn , <NUM_LIT:1> ) <EOL> def generate_base64_configuration ( self ) : <EOL> self . oxauth_config_base64 = self . generate_base64_ldap_file ( self . oxauth_config_json ) <EOL> self . oxauth_static_conf_base64 = self . generate_base64_ldap_file ( self . oxauth_static_conf_json ) <EOL> self . oxauth_error_base64 = self . generate_base64_ldap_file ( self . oxauth_error_json ) <EOL> self . oxauth_openid_key_base64 = self . generate_base64_ldap_file ( self . oxauth_openid_key_json ) <EOL> self . oxtrust_config_base64 = self . generate_base64_ldap_file ( self . oxtrust_config_json ) ; <EOL> self . oxtrust_cache_refresh_base64 = self . generate_base64_ldap_file ( self . oxtrust_cache_refresh_json ) <EOL> self . oxtrust_import_person_base64 = self . generate_base64_ldap_file ( self . oxtrust_import_person_json ) <EOL> self . oxidp_config_base64 = self . generate_base64_ldap_file ( self . oxidp_config_json ) <EOL> self . oxcas_config_base64 = self . generate_base64_ldap_file ( self . oxcas_config_json ) <EOL> self . oxasimba_config_base64 = self . generate_base64_ldap_file ( self . oxasimba_config_json ) <EOL> def run ( self , args , cwd = None ) : <EOL> self . logIt ( '<STR_LIT>' % '<STR_LIT:U+0020>' . join ( args ) ) <EOL> try : <EOL> p = subprocess . Popen ( args , stdout = subprocess . PIPE , stderr = subprocess . PIPE , cwd = cwd ) <EOL> output , err = p . communicate ( ) <EOL> if output : <EOL> self . logIt ( output ) <EOL> if err : <EOL> self . logIt ( err , True ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % "<STR_LIT:U+0020>" . join ( args ) , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def save_properties ( self ) : <EOL> self . logIt ( '<STR_LIT>' % self . savedProperties ) <EOL> def getString ( object ) : <EOL> if type ( object ) == type ( "<STR_LIT>" ) : <EOL> return object . strip ( ) <EOL> else : <EOL> return '<STR_LIT>' <EOL> try : <EOL> p = Properties . Properties ( ) <EOL> keys = self . __dict__ . keys ( ) <EOL> keys . sort ( ) <EOL> for key in keys : <EOL> value = getString ( self . __dict__ [ key ] ) <EOL> if value != '<STR_LIT>' : <EOL> p [ key ] = value <EOL> p . store ( open ( self . savedProperties , '<STR_LIT:w>' ) ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def setup_opendj ( self ) : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> try : <EOL> self . add_ldap_schema ( ) <EOL> except : <EOL> self . logIt ( '<STR_LIT>' , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> setupPropsFN = os . path . join ( self . ldapBaseFolder , '<STR_LIT>' ) <EOL> shutil . copy ( "<STR_LIT>" % self . outputFolder , setupPropsFN ) <EOL> self . change_ownership ( ) <EOL> try : <EOL> setupCmd = "<STR_LIT>" + "<STR_LIT:U+0020>" . join ( [ self . ldapSetupCommand , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> setupPropsFN , <EOL> '<STR_LIT>' ] ) <EOL> self . run ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:-c>' , <EOL> setupCmd ] ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> try : <EOL> dsjavaCmd = "<STR_LIT>" % self . ldapDsJavaPropCommand <EOL> self . run ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:-c>' , <EOL> dsjavaCmd <EOL> ] ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" , True ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> if self . os_type in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] and self . os_initdaemon == '<STR_LIT>' : <EOL> self . run ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . run ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> else : <EOL> self . run ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> def setup_init_scripts ( self ) : <EOL> if self . os_type in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] and self . os_initdaemon == '<STR_LIT>' : <EOL> script_name = os . path . split ( self . tomcat_template_centos7 ) [ - <NUM_LIT:1> ] <EOL> dest_folder = os . path . dirname ( self . tomcat_service_centos7 ) <EOL> try : <EOL> self . copyFile ( self . tomcat_template_centos7 , dest_folder ) <EOL> self . run ( [ "<STR_LIT>" , "<STR_LIT>" , self . tomcat_service_centos7 ] ) <EOL> self . run ( [ self . tomcat_service_centos7 , "<STR_LIT>" ] ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % ( self . tomcat_template_centos7 , dest_folder ) ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> else : <EOL> for init_file in self . init_files : <EOL> try : <EOL> script_name = os . path . split ( init_file ) [ - <NUM_LIT:1> ] <EOL> self . copyFile ( init_file , "<STR_LIT>" ) <EOL> self . run ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" % script_name ] ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" % init_file ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> if self . os_type in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> for service in self . redhat_services : <EOL> self . run ( [ "<STR_LIT>" , service , "<STR_LIT>" ] ) <EOL> elif self . os_type in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> self . run ( [ "<STR_LIT>" , '<STR_LIT>' , '<STR_LIT:start>' , '<STR_LIT>' , '<STR_LIT:3>' , "<STR_LIT:.>" ] ) <EOL> for service in self . debian_services : <EOL> self . run ( [ "<STR_LIT>" , service , '<STR_LIT>' ] ) <EOL> def start_services ( self ) : <EOL> service_path = '<STR_LIT>' <EOL> apache_service_name = '<STR_LIT>' <EOL> if self . os_type in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] and self . os_initdaemon == '<STR_LIT>' : <EOL> service_path = '<STR_LIT>' <EOL> apache_service_name = '<STR_LIT>' <EOL> elif self . os_type in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> service_path = '<STR_LIT>' <EOL> apache_service_name = '<STR_LIT>' <EOL> if self . os_type in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] and self . os_initdaemon == '<STR_LIT>' : <EOL> self . run ( [ service_path , '<STR_LIT>' , apache_service_name ] ) <EOL> self . run ( [ service_path , '<STR_LIT:start>' , apache_service_name ] ) <EOL> else : <EOL> self . run ( [ service_path , apache_service_name , '<STR_LIT:start>' ] ) <EOL> if self . os_type in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] and self . os_initdaemon == '<STR_LIT>' : <EOL> self . run ( [ service_path , '<STR_LIT:start>' , '<STR_LIT>' ] ) <EOL> else : <EOL> self . run ( [ service_path , '<STR_LIT>' , '<STR_LIT:start>' ] ) <EOL> try : <EOL> i = <NUM_LIT:0> <EOL> wait_time = <NUM_LIT:5> <EOL> while i < wait_time : <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> print "<STR_LIT:.>" , <EOL> i = i + <NUM_LIT:1> <EOL> if self . os_type in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] and self . os_initdaemon == '<STR_LIT>' : <EOL> self . run ( [ service_path , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . run ( [ service_path , '<STR_LIT:start>' , '<STR_LIT>' ] ) <EOL> else : <EOL> self . run ( [ service_path , '<STR_LIT>' , '<STR_LIT:start>' ] ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> self . logIt ( traceback . format_exc ( ) , True ) <EOL> def update_hostname ( self ) : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> if self . os_initdaemon == '<STR_LIT>' : <EOL> self . run ( [ '<STR_LIT>' , '<STR_LIT>' , self . hostname ] ) <EOL> else : <EOL> if self . os_type in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> self . copyFile ( "<STR_LIT>" % self . outputFolder , self . etc_hostname ) <EOL> if self . os_type in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> self . copyFile ( "<STR_LIT>" % self . outputFolder , self . network ) <EOL> self . run ( [ '<STR_LIT>' , self . hostname ] ) <EOL> self . copyFile ( "<STR_LIT>" % self . outputFolder , self . etc_hosts ) <EOL> def configure_opendj_install ( self ) : <EOL> if self . opendj_version == "<STR_LIT>" : <EOL> self . loadLdifCommand = self . importLdifCommand <EOL> self . ldap_backend_type = '<STR_LIT>' <EOL> else : <EOL> self . loadLdifCommand = self . ldapModifyCommand <EOL> self . ldap_backend_type = '<STR_LIT>' <EOL> try : <EOL> f = open ( self . ldapPassFn , '<STR_LIT:w>' ) <EOL> f . write ( self . ldapPass ) <EOL> f . close ( ) <EOL> self . run ( [ "<STR_LIT>" , '<STR_LIT>' , self . ldapPassFn ] ) <EOL> except : <EOL> self . logIt ( "<STR_LIT>" ) <EOL> def print_help ( ) : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> def getOpts ( argv , setupOptions ) : <EOL> try : <EOL> opts , args = getopt . getopt ( argv , "<STR_LIT>" ) <EOL> except getopt . GetoptError : <EOL> print_help ( ) <EOL> sys . exit ( <NUM_LIT:2> ) <EOL> for opt , arg in opts : <EOL> if opt == '<STR_LIT>' : <EOL> setupOptions [ '<STR_LIT>' ] = True <EOL> elif opt == '<STR_LIT:-c>' : <EOL> setupOptions [ '<STR_LIT>' ] = True <EOL> elif opt == '<STR_LIT>' : <EOL> if os . path . exists ( arg ) : <EOL> setupOptions [ '<STR_LIT>' ] = arg <EOL> else : <EOL> print '<STR_LIT>' % ( arg , os . getcwd ( ) ) <EOL> elif opt == '<STR_LIT>' : <EOL> print_help ( ) <EOL> sys . exit ( ) <EOL> elif opt == "<STR_LIT>" : <EOL> try : <EOL> if os . path . isfile ( arg ) : <EOL> setupOptions [ '<STR_LIT>' ] = arg <EOL> print "<STR_LIT>" % arg <EOL> else : <EOL> print "<STR_LIT>" % arg <EOL> except : <EOL> print "<STR_LIT>" % arg <EOL> elif opt == "<STR_LIT>" : <EOL> setupOptions [ '<STR_LIT>' ] = True <EOL> elif opt == "<STR_LIT>" : <EOL> setupOptions [ '<STR_LIT>' ] = False <EOL> elif opt == "<STR_LIT>" : <EOL> setupOptions [ '<STR_LIT>' ] = True <EOL> elif opt == "<STR_LIT>" : <EOL> setupOptions [ '<STR_LIT>' ] = True <EOL> elif opt == '<STR_LIT>' : <EOL> setupOptions [ '<STR_LIT>' ] = True <EOL> return setupOptions <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> setupOptions = { <EOL> '<STR_LIT>' : '<STR_LIT:.>' , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False <EOL> } <EOL> if len ( sys . argv ) > <NUM_LIT:1> : <EOL> setupOptions = getOpts ( sys . argv [ <NUM_LIT:1> : ] , setupOptions ) <EOL> installObject = Setup ( setupOptions [ '<STR_LIT>' ] ) <EOL> installObject . downloadWars = setupOptions [ '<STR_LIT>' ] <EOL> installObject . installOxAuth = setupOptions [ '<STR_LIT>' ] <EOL> installObject . installOxTrust = setupOptions [ '<STR_LIT>' ] <EOL> installObject . installLdap = setupOptions [ '<STR_LIT>' ] <EOL> installObject . installHttpd = setupOptions [ '<STR_LIT>' ] <EOL> installObject . installSaml = setupOptions [ '<STR_LIT>' ] <EOL> installObject . installAsimba = setupOptions [ '<STR_LIT>' ] <EOL> installObject . installCas = setupOptions [ '<STR_LIT>' ] <EOL> installObject . installOxAuthRP = setupOptions [ '<STR_LIT>' ] <EOL> installObject . os_type = installObject . detect_os_type ( ) <EOL> installObject . os_initdaemon = installObject . detect_initd ( ) <EOL> installObject . apache_version = installObject . determineApacheVersionForOS ( ) <EOL> installObject . opendj_version = installObject . determineOpenDJVersion ( ) <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" % installObject . os_type <EOL> print "<STR_LIT>" % installObject . os_initdaemon <EOL> print "<STR_LIT>" % installObject . apache_version <EOL> print "<STR_LIT>" % installObject . opendj_version <EOL> print "<STR_LIT>" % ( installObject . log , installObject . logError ) <EOL> print "<STR_LIT>" % installObject . savedProperties <EOL> try : <EOL> os . remove ( installObject . log ) <EOL> installObject . logIt ( '<STR_LIT>' % installObject . log ) <EOL> except : <EOL> pass <EOL> try : <EOL> os . remove ( installObject . logError ) <EOL> installObject . logIt ( '<STR_LIT>' % installObject . logError ) <EOL> except : <EOL> pass <EOL> installObject . logIt ( "<STR_LIT>" , True ) <EOL> if setupOptions [ '<STR_LIT>' ] : <EOL> installObject . logIt ( '<STR_LIT>' % setupOptions [ '<STR_LIT>' ] ) <EOL> installObject . load_properties ( setupOptions [ '<STR_LIT>' ] ) <EOL> elif os . path . isfile ( installObject . setup_properties_fn ) : <EOL> installObject . logIt ( '<STR_LIT>' % installObject . setup_properties_fn ) <EOL> installObject . load_properties ( installObject . setup_properties_fn ) <EOL> else : <EOL> installObject . logIt ( "<STR_LIT>" % installObject . setup_properties_fn ) <EOL> installObject . promptForProperties ( ) <EOL> installObject . check_properties ( ) <EOL> print '<STR_LIT>' % ` installObject ` <EOL> proceed = "<STR_LIT>" <EOL> if not setupOptions [ '<STR_LIT>' ] : <EOL> proceed = raw_input ( '<STR_LIT>' ) . lower ( ) . strip ( ) <EOL> if ( setupOptions [ '<STR_LIT>' ] or not len ( proceed ) or ( len ( proceed ) and ( proceed [ <NUM_LIT:0> ] == '<STR_LIT:y>' ) ) ) : <EOL> try : <EOL> installObject . makeFolders ( ) <EOL> installObject . make_salt ( ) <EOL> installObject . make_oxauth_salt ( ) <EOL> installObject . downloadWarFiles ( ) <EOL> installObject . configure_opendj_install ( ) <EOL> installObject . copy_scripts ( ) <EOL> installObject . encode_passwords ( ) <EOL> installObject . generate_scim_configuration ( ) <EOL> installObject . configure_oxtrust ( ) <EOL> installObject . render_templates ( ) <EOL> installObject . render_test_templates ( ) <EOL> installObject . generate_crypto ( ) <EOL> installObject . generate_oxauth_openid_keys ( ) <EOL> installObject . generate_base64_configuration ( ) <EOL> installObject . render_configuration_template ( ) <EOL> installObject . update_hostname ( ) <EOL> installObject . configure_httpd ( ) <EOL> installObject . setup_opendj ( ) <EOL> installObject . configure_opendj ( ) <EOL> installObject . index_opendj ( '<STR_LIT>' ) <EOL> installObject . index_opendj ( '<STR_LIT>' ) <EOL> installObject . import_ldif ( ) <EOL> installObject . deleteLdapPw ( ) <EOL> installObject . export_opendj_public_cert ( ) <EOL> installObject . install_saml ( ) <EOL> installObject . copy_output ( ) <EOL> installObject . setup_init_scripts ( ) <EOL> installObject . copy_static ( ) <EOL> installObject . install_cas_war ( ) <EOL> installObject . install_asimba_war ( ) <EOL> installObject . install_oxauth_rp_war ( ) <EOL> installObject . change_ownership ( ) <EOL> installObject . change_permissions ( ) <EOL> installObject . start_services ( ) <EOL> installObject . save_properties ( ) <EOL> except : <EOL> installObject . logIt ( "<STR_LIT>" , True ) <EOL> installObject . logIt ( traceback . format_exc ( ) , True ) <EOL> print "<STR_LIT>" % installObject . hostname <EOL> else : <EOL> installObject . save_properties ( ) <EOL> print "<STR_LIT>" % ( installObject . savedProperties , installObject . setup_properties_fn ) </s>
