le 2.1.9 → 2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LE.gemspec +1 -1
- data/lib/le.rb +2 -1
- data/lib/le/host.rb +2 -2
- data/lib/le/host/http.rb +48 -4
- metadata +41 -22
data/LE.gemspec
CHANGED
data/lib/le.rb
CHANGED
@@ -10,9 +10,10 @@ module Le
|
|
10
10
|
|
11
11
|
opt_local = options[:local] || false
|
12
12
|
opt_debug = options[:debug] || false
|
13
|
+
opt_ssl = options[:ssl] || false
|
13
14
|
opt_log_level = options[:log_level] || Logger::DEBUG
|
14
15
|
|
15
|
-
host = Le::Host.new(token, opt_local, opt_debug)
|
16
|
+
host = Le::Host.new(token, opt_local, opt_debug, opt_ssl)
|
16
17
|
logger = Logger.new(host)
|
17
18
|
|
18
19
|
logger.level = opt_log_level
|
data/lib/le/host.rb
CHANGED
data/lib/le/host/http.rb
CHANGED
@@ -8,10 +8,43 @@ module Le
|
|
8
8
|
class HTTP
|
9
9
|
API_SERVER = 'api.logentries.com'
|
10
10
|
API_PORT = 10000
|
11
|
+
API_SSL_PORT = 20000
|
12
|
+
API_CERT = '-----BEGIN CERTIFICATE-----
|
13
|
+
MIIFSjCCBDKgAwIBAgIDBQMSMA0GCSqGSIb3DQEBBQUAMGExCzAJBgNVBAYTAlVT
|
14
|
+
MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMR0wGwYDVQQLExREb21haW4gVmFsaWRh
|
15
|
+
dGVkIFNTTDEbMBkGA1UEAxMSR2VvVHJ1c3QgRFYgU1NMIENBMB4XDTEyMDkxMDE5
|
16
|
+
NTI1N1oXDTE2MDkxMTIxMjgyOFowgcExKTAnBgNVBAUTIEpxd2ViV3RxdzZNblVM
|
17
|
+
ek1pSzNiL21hdktiWjd4bEdjMRMwEQYDVQQLEwpHVDAzOTM4NjcwMTEwLwYDVQQL
|
18
|
+
EyhTZWUgd3d3Lmdlb3RydXN0LmNvbS9yZXNvdXJjZXMvY3BzIChjKTEyMS8wLQYD
|
19
|
+
VQQLEy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b20vZ3Rzc2xkdi5jcnQwTAYD
|
34
|
+
VR0gBEUwQzBBBgpghkgBhvhFAQc2MDMwMQYIKwYBBQUHAgEWJWh0dHA6Ly93d3cu
|
35
|
+
Z2VvdHJ1c3QuY29tL3Jlc291cmNlcy9jcHMwDQYJKoZIhvcNAQEFBQADggEBAAo0
|
36
|
+
rOkIeIDrhDYN8o95+6Y0QhVCbcP2GcoeTWu+ejC6I9gVzPFcwdY6Dj+T8q9I1WeS
|
37
|
+
VeVMNtwJt26XXGAk1UY9QOklTH3koA99oNY3ARcpqG/QwYcwaLbFrB1/JkCGcK1+
|
38
|
+
Ag3GE3dIzAGfRXq8fC9SrKia+PCdDgNIAFqe+kpa685voTTJ9xXvNh7oDoVM2aip
|
39
|
+
v1xy+6OfZyGudXhXag82LOfiUgU7hp+RfyUG2KXhIRzhMtDOHpyBjGnVLB0bGYcC
|
40
|
+
566Nbe7Alh38TT7upl/O5lA29EoSkngtUWhUnzyqYmEMpay8yZIV4R9AuUk2Y4HB
|
41
|
+
kAuBvDPPm+C0/M4RLYs=
|
42
|
+
-----END CERTIFICATE-----'
|
43
|
+
|
11
44
|
include Le::Host::InstanceMethods
|
12
|
-
attr_accessor :token, :queue, :started, :thread, :conn, :local, :debug
|
45
|
+
attr_accessor :token, :queue, :started, :thread, :conn, :local, :debug, :ssl
|
13
46
|
|
14
|
-
def initialize(token, local, debug)
|
47
|
+
def initialize(token, local, debug, ssl)
|
15
48
|
if defined?(Rails)
|
16
49
|
@logger_console = Logger.new("log/#{Rails.env}.log")
|
17
50
|
else
|
@@ -20,6 +53,7 @@ module Le
|
|
20
53
|
@token = token
|
21
54
|
@local = local
|
22
55
|
@debug = debug
|
56
|
+
@ssl = ssl
|
23
57
|
@queue = Queue.new
|
24
58
|
@started = false
|
25
59
|
@thread = nil
|
@@ -77,8 +111,18 @@ module Le
|
|
77
111
|
|
78
112
|
def openConnection
|
79
113
|
dbg "LE: Reopening connection to Logentries API server"
|
80
|
-
@
|
81
|
-
|
114
|
+
if @ssl then port = API_SSL_PORT else port = API_PORT end
|
115
|
+
socket = TCPSocket.new(API_SERVER, port)
|
116
|
+
if @ssl then
|
117
|
+
ssl_context = OpenSSL::SSL::SSLContext.new()
|
118
|
+
ssl_context.cert = OpenSSL::X509::Certificate.new(API_CERT)
|
119
|
+
ssl_socket = OpenSSL::SSL::SSLSocket.new(socket, ssl_context)
|
120
|
+
ssl_socket.sync_close = true
|
121
|
+
ssl_socket.connect
|
122
|
+
@conn = ssl_socket
|
123
|
+
else
|
124
|
+
@conn = socket
|
125
|
+
end
|
82
126
|
dbg "LE: Connection established"
|
83
127
|
end
|
84
128
|
|
metadata
CHANGED
@@ -1,50 +1,69 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: le
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 2
|
9
|
+
version: "2.2"
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- Mark Lacomber (Logentries)
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
16
|
+
|
17
|
+
date: 2013-08-12 00:00:00 Z
|
13
18
|
dependencies: []
|
14
|
-
description: ! '
|
15
19
|
|
16
|
-
|
20
|
+
description: |
|
21
|
+
|
22
|
+
|
17
23
|
email: marklacomber@gmail.com
|
18
24
|
executables: []
|
25
|
+
|
19
26
|
extensions: []
|
27
|
+
|
20
28
|
extra_rdoc_files: []
|
21
|
-
|
29
|
+
|
30
|
+
files:
|
22
31
|
- LE.gemspec
|
23
|
-
- ./lib/le.rb
|
24
|
-
- ./lib/le/host.rb
|
25
32
|
- ./lib/le/host/http.rb
|
33
|
+
- ./lib/le/host.rb
|
34
|
+
- ./lib/le.rb
|
26
35
|
homepage:
|
27
36
|
licenses: []
|
37
|
+
|
28
38
|
post_install_message:
|
29
39
|
rdoc_options: []
|
30
|
-
|
40
|
+
|
41
|
+
require_paths:
|
31
42
|
- lib
|
32
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
44
|
none: false
|
34
|
-
requirements:
|
35
|
-
- -
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
|
38
|
-
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
hash: 3
|
49
|
+
segments:
|
50
|
+
- 0
|
51
|
+
version: "0"
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
53
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
44
61
|
requirements: []
|
62
|
+
|
45
63
|
rubyforge_project:
|
46
|
-
rubygems_version: 1.8.
|
64
|
+
rubygems_version: 1.8.15
|
47
65
|
signing_key:
|
48
66
|
specification_version: 3
|
49
67
|
summary: Logentries plugin
|
50
68
|
test_files: []
|
69
|
+
|