canzea 0.1.35 → 0.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0359469554bf74e4bd0f49da18e91fdabf7a0574
4
- data.tar.gz: 96c5b165b2747774ed948cb4f2363a260f6c97c2
3
+ metadata.gz: 5030adbff33693ff30ed168720e7ad3a2d9b5640
4
+ data.tar.gz: c340d70b8c103d1fe1251097a9d3c8f349ca2d90
5
5
  SHA512:
6
- metadata.gz: 76853ea471c1afcf111ab0093681cc4165988823493202246cff65935720e9ac38ff2141b7ffa35d0b60177552cc03e9702e5a26dbe19cf326b23a969db37b9e
7
- data.tar.gz: bb3f2e612b73ccbb70a5692769e36cf65329d9d50b52d8696a820e93e6a9bcdf20c287951c41434b68dd17087d1b6284b7a82c562ef9c98a3acf7cadca7255e1
6
+ metadata.gz: 7f4fccf38a1b4d29b32f67c697de1107c87c77cd96019910278897a649d6ba9ddd1b2efe3b83f484aa2e5fdc326eaf8608d90912cc4202456ff324b026e7cf51
7
+ data.tar.gz: c669cf776d17fa056a5c249bb72ff53f4410e68f3aef5fb2fc790fc33da93546facfa191dc2792d858ad647fea03d1e4be4e6f4a28658b638735b837550c433d
data/lib/canzea/config.rb CHANGED
@@ -10,7 +10,12 @@ module Canzea
10
10
  :catalog_branch => "develop",
11
11
  :git_repo => "/opt/cloud-profile",
12
12
  :logging_root => Dir.home,
13
- :pwd => Dir.pwd
13
+ :pwd => Dir.pwd,
14
+ :consul_tls_ca_file => "/etc/consul.d/ssl/ca.cert",
15
+ :consul_tls_cert_file => "/etc/consul.d/ssl/consul.cert",
16
+ :consul_tls_key_file => "/etc/consul.d/ssl/consul.key",
17
+ :vault_tls_cert_file => "/etc/consul.d/ssl/vault.cert",
18
+ :vault_tls_key_file => "/etc/consul.d/ssl/vault.key"
14
19
  }
15
20
  @valid_config_keys = @config.keys
16
21
 
@@ -1,3 +1,3 @@
1
1
  module Canzea
2
- VERSION = "0.1.35"
2
+ VERSION = "0.1.36"
3
3
  end
@@ -41,8 +41,21 @@ class PrepareEnvironment
41
41
 
42
42
  puts "-- Looking up...#{svc['name']}"
43
43
 
44
- url = ENV["CONSUL_URL"] + '/v1/catalog/service/' + svc['name']
45
- resp = Net::HTTP.get_response(URI.parse(url))
44
+ pemCert = File.read(Canzea::config[:consul_tls_cert_file])
45
+ pemKey = File.read(Canzea::config[:consul_tls_key_file])
46
+
47
+ uri = URI.parse(ENV["CONSUL_URL"] + '/v1/catalog/service/' + svc['name'])
48
+ http = Net::HTTP.new(uri.host, uri.port)
49
+ http.use_ssl = true
50
+ http.ca_file = Canzea::config[:consul_tls_ca_file]
51
+ http.cert = OpenSSL::X509::Certificate.new(pemCert)
52
+ http.key = OpenSSL::PKey::RSA.new(pemKey)
53
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
54
+ http.set_debug_output($stdout)
55
+ http.ssl_version = :SSLv23
56
+ request = Net::HTTP::Get.new(uri.request_uri)
57
+ resp = http.request(request)
58
+
46
59
  services = JSON.parse(resp.body)
47
60
 
48
61
  if (services.nil? == false)
@@ -76,15 +89,25 @@ class PrepareEnvironment
76
89
 
77
90
  puts "-- Looking up secret...#{svc['name']}"
78
91
 
79
- url = URI(ENV['VAULT_URL'] + '/v1/secret/' + svc['name'])
92
+ pemCert = File.read(Canzea::config[:vault_tls_cert_file])
93
+ pemKey = File.read(Canzea::config[:vault_tls_key_file])
94
+
95
+ uri = URI.parse(ENV["VAULT_URL"] + '/v1/secret/' + svc['name'])
96
+ http = Net::HTTP.new(uri.host, uri.port)
97
+ http.use_ssl = true
98
+ http.ca_file = Canzea::config[:consul_tls_ca_file]
99
+ http.cert = OpenSSL::X509::Certificate.new(pemCert)
100
+ http.key = OpenSSL::PKey::RSA.new(pemKey)
101
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
102
+ http.set_debug_output($stdout)
103
+ http.ssl_version = :SSLv23
104
+ request = Net::HTTP::Get.new(uri.request_uri)
105
+
106
+ request['X-Vault-Token'] = ENV["VAULT_TOKEN"]
107
+ request['Content-type'] = 'application/json'
80
108
 
81
- req = Net::HTTP::Get.new(url)
82
- req['X-Vault-Token'] = ENV["VAULT_TOKEN"]
83
- req['Content-type'] = 'application/json'
109
+ resp = http.request(request)
84
110
 
85
- resp = Net::HTTP.start(url.hostname, url.port) {|http|
86
- http.request(req)
87
- }
88
111
  # puts resp.body
89
112
 
90
113
  if (Integer(resp.code) == 200)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canzea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.35
4
+ version: 0.1.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Canzea Technologies
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-07 00:00:00.000000000 Z
11
+ date: 2016-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler