simbiotes 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea86cc934275ad9bee68dff9df9394f5a3c206b8
|
4
|
+
data.tar.gz: 7a70964b49e63fe9c4f4d828967c36b0fa223719
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 961f8ba083b6d2fa0b78051ccb2c71c96dccf26b51c462bfd6ad2087d4603acd6b03adc883c6a875689ddf13b1b0d85f484ac76f82a6e5683948f30601db03d2
|
7
|
+
data.tar.gz: aa0c4a2f70947fd66b06a37e071a7084c508af9f9bdc04e163595a55904a768af4cd3fa6c96b8dad57b3fb0d41197588f171c9325c5a6734c7c7f05286ab6e84
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Simbiotes
|
2
2
|
class Configuration
|
3
3
|
|
4
|
-
attr_accessor :public_key, :private_key, :local_logging, :targets, :local_port, :server, :server_port, :portal, :push, :tls
|
4
|
+
attr_accessor :public_key, :private_key, :local_logging, :targets, :local_port, :server, :server_port, :portal, :push, :tls, :verify_peer
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
@public_key = nil
|
@@ -14,6 +14,7 @@ module Simbiotes
|
|
14
14
|
@portal = "http://www.simbiotes.com/"
|
15
15
|
@push = false
|
16
16
|
@tls = true
|
17
|
+
@verify_peer = true
|
17
18
|
end
|
18
19
|
|
19
20
|
end
|
data/lib/simbiotes/portal.rb
CHANGED
@@ -146,5 +146,11 @@ module Simbiotes
|
|
146
146
|
return instance_hash["certificate"]
|
147
147
|
end
|
148
148
|
|
149
|
+
def self.ca_certificate
|
150
|
+
response = HTTParty.post("#{Simbiotes.configuration.portal}api/ca_certificate", :query => {:public_key => Simbiotes.configuration.public_key, :private_key => Simbiotes.configuration.private_key}).body
|
151
|
+
hash = JSON.parse(response)
|
152
|
+
return hash["ca_certificate"]
|
153
|
+
end
|
154
|
+
|
149
155
|
end
|
150
156
|
end
|
data/lib/simbiotes/server.rb
CHANGED
@@ -12,8 +12,10 @@ module Simbiotes
|
|
12
12
|
context = OpenSSL::SSL::SSLContext.new
|
13
13
|
context.key = Server.key
|
14
14
|
context.cert = Server.cert
|
15
|
-
|
16
|
-
|
15
|
+
if Simbiotes.configuration.verify_peer == true
|
16
|
+
context.ca_file = Server.ca_cert
|
17
|
+
context.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
18
|
+
end
|
17
19
|
server = OpenSSL::SSL::SSLSocket.new socket, context
|
18
20
|
server.sync_close = true
|
19
21
|
server.connect
|
@@ -143,7 +145,7 @@ module Simbiotes
|
|
143
145
|
def self.ca_cert
|
144
146
|
ca_cert = SimbiotesSetting.find_by(key: "ca_cert")
|
145
147
|
if ca_cert == nil
|
146
|
-
ca_cert = Simbiotes::Portal.
|
148
|
+
ca_cert = Simbiotes::Portal.ca_certificate
|
147
149
|
c = SimbiotesSetting.new
|
148
150
|
c.key = "ca_cert"
|
149
151
|
c.value = ca_cert
|
data/lib/simbiotes/version.rb
CHANGED