Changeset 452
- Timestamp:
- 02/16/07 16:35:20 (2 years ago)
- Files:
-
- branches/branch-https-dev/bin/debian-base-hefeweizen-installation.sh (modified) (1 diff)
- branches/branch-https-dev/bin/run-check-dependencies.sh (modified) (1 diff)
- branches/branch-https-dev/defaults/hefeweizen-defaults (modified) (1 diff)
- branches/branch-https-dev/src/hefeweizen_library_cpa.rb (modified) (1 diff)
- branches/branch-https-dev/src/hefeweizen_library_cpa_manager.rb (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/branch-https-dev/bin/debian-base-hefeweizen-installation.sh
r450 r452 4 4 5 5 echo "some handy tools" 6 apt-get install -y ssh screen less openssl6 apt-get install -y ssh screen less emacs21 7 7 8 8 echo "install HefeWeizen debian package dependencies" 9 apt-get install -y uuid wget bzip2 xmlstarlet ruby libopenssl-ruby gcc make perl-modules libgmime-2.0-2 libgmime-2.0-2-dev libxml2 libxml2-dev libxmlsec1 libxmlsec1-dev libxmlsec1-openssl subversion hwinfo rubygems9 apt-get install -y uuid wget openssl bzip2 xmlstarlet ruby libopenssl-ruby gcc make perl-modules libgmime-2.0-2 libgmime-2.0-2-dev libxml2 libxml2-dev libxmlsec1 libxmlsec1-dev libxmlsec1-openssl subversion hwinfo rubygems 10 10 11 11 echo "install HefeWeizen ruby gems dependencies" branches/branch-https-dev/bin/run-check-dependencies.sh
r356 r452 43 43 else 44 44 echo "The http client wget is not available. Please install that package first." 45 exit -1 46 fi 47 48 which openssl 1>/dev/null 49 if [ $? -eq 0 ]; then 50 echo "openssl binary is available. good." 51 else 52 echo "The openssl tool is not available. Please install that package first." 45 53 exit -1 46 54 fi branches/branch-https-dev/defaults/hefeweizen-defaults
r297 r452 23 23 CONVERSATION_DIR=/var/run/hefeweizen/conversations 24 24 DIRECTIVE_DIR=/var/run/hefeweizen/directives 25 CPA_DIR=/var/run/hefeweizen/cpas 25 26 SPOOL_DIR=/var/spool/hefeweizen 26 27 TRANSACTION_DIR=/var/run/hefeweizen/transactions branches/branch-https-dev/src/hefeweizen_library_cpa.rb
r451 r452 54 54 return nil 55 55 end 56 end 57 58 # Setting up the certificate locations for this CPA. 59 # These locations will be used at run time. 60 # First usecase is SSL trust anchors. 61 def create_certificate_locations party_name, cpa_runtime_dir 62 # this party 63 # get trust anchors -> will be needed for SSL client to validate 64 # server SSL certificate against 65 this_party_info = nil 66 if party_name == @xml_cpa.partyInfo.first.xmlattr_partyName then 67 this_party_info = @xml_cpa.partyInfo[0] 68 other_party_info = @xml_cpa.partyInfo[1] 69 else 70 this_party_info = @xml_cpa.partyInfo[1] 71 other_party_info = @xml_cpa.partyInfo[0] 72 end 73 74 if this_party_info.respond_to? "securityDetails" then 75 sec_details = this_party_info.securityDetails.class == Array ? this_party_info.securityDetails : [this_party_info.securityDetails] 76 sec_details.each{ | sec_detail | 77 security_id = sec_detail.xmlattr_securityId 78 new_dir = "#{cpa_runtime_dir}/#{security_id}" 79 FileUtils.mkdir new_dir 80 # adding individual certificates 81 if sec_detail.trustAnchors.respond_to? "anchorCertificateRef" then 82 anchors = sec_detail.trustAnchors.anchorCertificateRef.class == Array ? sec_detail.trustAnchors.anchorCertificateRef : [sec_detail.trustAnchors.anchorCertificateRef] 83 anchors.each{ | anchor | 84 cert_id = anchor.xmlattr_certId 85 add_pem_cert_to_dir new_dir, cert_id 86 } 87 # TODO a system command 88 # Not criticial right here. 89 command = "c_rehash #{cpa_runtime_dir}/#{security_id}" 90 system command 91 end 92 } 93 94 end 95 96 # other party 97 if other_party_info.respond_to? "certificate" then 98 certs = other_party_info.certificate.class == Array ? other_party_info.certificate : [other_party_info.certificate] 99 certs.each{ | cert | 100 cert_id = cert.xmlattr_certId 101 # new_dir = "#{cpa_runtime_dir}" 102 # FileUtils.mkdir new_dir 103 add_pem_cert_to_dir cpa_runtime_dir, cert_id 104 } 105 end 106 107 # get each XML certificate and create .pem file 108 109 end 110 111 def add_pem_cert_to_dir new_dir, cert_id 112 @xml_cpa.partyInfo.each{ | party_info | 113 if party_info.respond_to? "certificate" then 114 certs = party_info.certificate.class == Array ? party_info.certificate : [party_info.certificate] 115 certs.each{ | cert | 116 if cert.xmlattr_certId.strip == cert_id then 117 text = cert.keyInfo.x509Data.x509Certificate.strip 118 output_file = File.new "#{new_dir}/#{cert.xmlattr_certId}.pem", "w" 119 output_file << "-----BEGIN CERTIFICATE-----\n" 120 text.each_line{ | line | 121 output_file << line.strip << "\n" 122 } 123 output_file << "-----END CERTIFICATE-----\n" 124 output_file.close 125 end 126 } 127 end 128 } 56 129 end 57 130 branches/branch-https-dev/src/hefeweizen_library_cpa_manager.rb
r451 r452 29 29 # 30 30 ############################################################################## 31 32 require 'digest/md5' 31 33 32 34 module HefeWeizen … … 47 49 48 50 require @config['LIB_DIR'].strip + "/hefeweizen_library_cpa" 51 52 @cpas_runtime_dir = "#{@config['CPA_DIR']}/#{party_name}" 53 FileUtils.mkdir_p @cpas_runtime_dir 49 54 55 # Lookup table for CPA id to md5sum 56 @cpa_id_md5sum = Hash.new 50 57 end 51 58 … … 100 107 @cpas[cpa.id] = Hash.new 101 108 @cpas[cpa.id]['cpa'] = cpa 109 result = nil 102 110 begin 103 111 result = cpa.setup_all_ebMS_header_infos cpa.id, @party_name, @party_identities … … 107 115 @logger.error "#{me}: CPA with id '#{cpa.id}' is not installed into the system." 108 116 end 117 109 118 if result.nil? then 119 @cpas.delete[cpa.id] 110 120 @logger.error "#{me}: Unable to successfully read ebXML CPA." 111 121 else 122 md5sum = Digest::MD5.hexdigest cpa.id 123 @cpa_id_md5sum[cpa.id] = md5sum 124 cpa_runtime_dir = "#{@cpas_runtime_dir}/#{md5sum}" 125 FileUtils.mkdir_p cpa_runtime_dir 126 mapping_file = "#{@cpas_runtime_dir}/mapping_file" 127 file = File.open mapping_file, "a" 128 file << "#{md5sum} - #{cpa.id}\n" 129 file.close 130 cpa.create_certificate_locations @party_name, cpa_runtime_dir 112 131 @logger.info "#{me}: Loaded CPA '#{cpa_filename}' with id: '#{cpa.id}'" 113 132 end … … 121 140 end 122 141 return @cpas 142 end 143 144 def get_cpa_runtime_dir cpa_id 145 if @cpa_id_md5sum.has_key? cpa_id then 146 return "#{@cpas_runtime_dir}/#{@cpa_id_md5sum[cpa_id]}" 147 else 148 return nil 149 end 123 150 end 124 151
