simbiotes 0.1.13 → 0.1.14

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: 8f028c07d80e2884bd21c62df4e7fd57ab430acb
4
- data.tar.gz: 27bf53c35b2c5c2610c370611eadd437d1717cec
3
+ metadata.gz: e232c7fdf51c37df9dfb0d07f144eaabf521032b
4
+ data.tar.gz: 96c89e62feb57de8aa9bc3352a57bfe64ff2203e
5
5
  SHA512:
6
- metadata.gz: 06a5a118bb788f37653af8cc1ac5a9c631e63812f486ff67ccc897f27b31d70e8891a04da4b59b764532a8b49c63f926caa884a83bda61aee9854178242465f7
7
- data.tar.gz: 8b4e1746a2f89eb828e3735d7c4b7c5189ccb577df5cbdf7a413ee09e207ead666652735b0ee4bc953be3742bda77541e3ca85b8d6e0567d2bdae7f207813f98
6
+ metadata.gz: 76530d0667b5547448545667d811abc508bcda776e16eee2b7e1e68cd1c72f6035ff9300c18837c5984058875c6226efccaf4950c88a47dae6379ab6a2820d8c
7
+ data.tar.gz: 4108aed32cd6d41a9513b2ac5d2d7a2b4da1263a5ac25ade88ee0ad975c3ab6993015475a24c60f2a2b504592b8ad897d9a711ca2300b2a19496f6ab7f1827c7
@@ -15,12 +15,12 @@ module Simbiotes
15
15
  if rgs == nil
16
16
  server_details = Server.lookup
17
17
  if server_details["status"] == "ok"
18
- rgs = server_details["rgs"]
18
+ rgs = server_details["IP"]
19
19
  c = SimbiotesSetting.new
20
20
  c.key = "server"
21
21
  c.value = rgs
22
22
  c.save
23
- rgs_port = server_details["rgs_port"]
23
+ rgs_port = server_details["port"]
24
24
  c = SimbiotesSetting.new
25
25
  c.key = "port"
26
26
  c.value = rgs_port
@@ -35,12 +35,18 @@ module Simbiotes
35
35
  context.key = Server.key
36
36
  context.cert = Server.cert
37
37
  if Simbiotes.configuration.verify_peer == true
38
- context.ca_file = Server.ca_cert
38
+ ca_tempfile = Tempfile.new
39
+ ca_tempfile.write Server.ca_cert.to_pem
40
+ ca_tempfile.rewind
41
+ context.ca_file = ca_tempfile.path
39
42
  context.verify_mode = OpenSSL::SSL::VERIFY_PEER
40
43
  end
41
44
  server = OpenSSL::SSL::SSLSocket.new socket, context
42
45
  server.sync_close = true
43
46
  server.connect
47
+ if Simbiotes.configuration.verify_peer == true
48
+ ca_tempfile.close(true)
49
+ end
44
50
  else
45
51
  server = TCPSocket.open(rgs, rgs_port)
46
52
  end
@@ -114,7 +120,10 @@ module Simbiotes
114
120
  context.key = Server.key
115
121
  context.cert = Server.cert
116
122
  if Simbiotes.configuration.verify_peer == true
117
- context.ca_file = Server.ca_cert.to_s
123
+ ca_tempfile = Tempfile.new
124
+ ca_tempfile.write Server.ca_cert.to_pem
125
+ ca_tempfile.rewind
126
+ context.ca_file = ca_tempfile.path
118
127
  context.verify_mode = OpenSSL::SSL::VERIFY_PEER
119
128
  end
120
129
  server = OpenSSL::SSL::SSLSocket.new socket, context
@@ -127,6 +136,9 @@ module Simbiotes
127
136
  msg = server.gets
128
137
  hash = JSON.parse(msg)
129
138
  server.close
139
+ if Simbiotes.configuration.verify_peer == true
140
+ ca_tempfile.close(true)
141
+ end
130
142
  return hash
131
143
  end
132
144
 
@@ -145,11 +157,8 @@ module Simbiotes
145
157
  def self.cert
146
158
  cert = SimbiotesSetting.find_by(key: "cert")
147
159
  if cert == nil
148
- key = SimbiotesSetting.find_by(key: "key").value
149
- pass_phrase = SimbiotesSetting.find_by(key: "key_pass_phrase").value
150
- key = OpenSSL::PKey::RSA.new key, pass_phrase
151
- public_key = SimbiotesSetting.find_by(key: "public_key").value
152
- public_key = OpenSSL::PKey::RSA.new public_key
160
+ key = Server.key
161
+ public_key = key.public_key
153
162
  cert = Server.generate_cert(key, public_key)
154
163
  c = SimbiotesSetting.new
155
164
  c.key = "cert"
@@ -1,3 +1,3 @@
1
1
  module Simbiotes
2
- VERSION = '0.1.13'
2
+ VERSION = '0.1.14'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simbiotes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - MicroArx Corporation