fluent-plugin-sumologic-cloud-syslog 0.1.5 → 0.1.7
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: 9fbd5d2765b6436b661f0ba85d2643d241860b78
|
4
|
+
data.tar.gz: 19331eadf81f8686a4c74390d1beb29a5d8c0cf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4c2423730252990ac8e09d24c14bf00858933b778d61680895ea646f131557718ad43f892ef5a5ab0888f3f9ba16a4170cf0ec4ab4c0f89af7f84476c86887f
|
7
|
+
data.tar.gz: f31e290ca1de21be6bdf6686273256da3ab1dbfd318d7086715ce21719da6c19a8809886f60dd81abf12257f28bc7101223f15eff5bef79965d1331d45f8e4dc
|
@@ -105,13 +105,17 @@ module Fluent
|
|
105
105
|
'INFO'
|
106
106
|
end
|
107
107
|
|
108
|
-
# Send message to
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
108
|
+
# Send message to Sumologic
|
109
|
+
begin
|
110
|
+
logger(tag).log(severity, format(tag, time, record), time: Time.at(time)) do |header|
|
111
|
+
# Map syslog headers from record
|
112
|
+
@mappings.each do |name, record_key|
|
113
|
+
header.send("#{name}=", record[record_key]) unless record[record_key].nil?
|
114
|
+
end
|
113
115
|
end
|
114
|
-
|
116
|
+
rescue => e
|
117
|
+
log.error e.to_s
|
118
|
+
end
|
115
119
|
end
|
116
120
|
end
|
117
121
|
end
|
@@ -18,7 +18,9 @@ require 'date'
|
|
18
18
|
require 'minitest/mock'
|
19
19
|
require 'fluent/plugin/out_sumologic_cloud_syslog'
|
20
20
|
|
21
|
-
class SumologicCloudSyslogOutput <
|
21
|
+
class SumologicCloudSyslogOutput < Test::Unit::TestCase
|
22
|
+
include SSLTestHelper
|
23
|
+
|
22
24
|
def setup
|
23
25
|
Fluent::Test.setup
|
24
26
|
@driver = nil
|
data/test/ssl.rb
CHANGED
@@ -1,53 +1,51 @@
|
|
1
1
|
require 'socket'
|
2
2
|
require 'openssl'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
4
|
+
module SSLTestHelper
|
5
|
+
def ssl_server
|
6
|
+
@ssl_server ||= begin
|
7
|
+
tcp_server = TCPServer.new("localhost", 33000 + Random.rand(1000))
|
8
|
+
ssl_context = OpenSSL::SSL::SSLContext.new
|
9
|
+
ssl_context.cert = certificate
|
10
|
+
ssl_context.key = rsa_key
|
11
|
+
OpenSSL::SSL::SSLServer.new(tcp_server, ssl_context)
|
13
12
|
end
|
13
|
+
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
def rsa_key
|
25
|
-
@rsa_key ||= OpenSSL::PKey::RSA.new(2048)
|
26
|
-
end
|
15
|
+
def ssl_client
|
16
|
+
tcp = TCPSocket.new("localhost", ssl_server.addr[1])
|
17
|
+
ctx = OpenSSL::SSL::SSLContext.new
|
18
|
+
ctx.set_params(verify_mode: OpenSSL::SSL::VERIFY_NONE)
|
19
|
+
ctx.cert = certificate
|
20
|
+
ctx.key = rsa_key
|
21
|
+
OpenSSL::SSL::SSLSocket.new(tcp, ctx)
|
22
|
+
end
|
27
23
|
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
def rsa_key
|
25
|
+
@rsa_key ||= OpenSSL::PKey::RSA.new(2048)
|
26
|
+
end
|
31
27
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
28
|
+
def certificate
|
29
|
+
@cert ||= begin
|
30
|
+
cert = OpenSSL::X509::Certificate.new
|
31
|
+
cert.subject = cert.issuer = OpenSSL::X509::Name.parse("/C=BE/O=Test/OU=Test/CN=Test")
|
32
|
+
cert.not_before = Time.now
|
33
|
+
cert.not_after = Time.now + 365 * 24 * 60 * 60
|
34
|
+
cert.public_key = rsa_key.public_key
|
35
|
+
cert.serial = 0x0
|
36
|
+
cert.version = 2
|
39
37
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
38
|
+
ef = OpenSSL::X509::ExtensionFactory.new
|
39
|
+
ef.subject_certificate = cert
|
40
|
+
ef.issuer_certificate = cert
|
41
|
+
cert.extensions = [
|
42
|
+
ef.create_extension("basicConstraints","CA:TRUE", true),
|
43
|
+
ef.create_extension("subjectKeyIdentifier", "hash"),
|
44
|
+
# ef.create_extension("keyUsage", "cRLSign,keyCertSign", true),
|
45
|
+
]
|
46
|
+
cert.add_extension ef.create_extension("authorityKeyIdentifier", "keyid:always,issuer:always")
|
47
|
+
cert.sign(rsa_key, OpenSSL::Digest::SHA1.new)
|
48
|
+
cert
|
52
49
|
end
|
50
|
+
end
|
53
51
|
end
|
@@ -16,7 +16,9 @@ require 'helper'
|
|
16
16
|
require 'ssl'
|
17
17
|
require 'sumologic_cloud_syslog/ssl_transport'
|
18
18
|
|
19
|
-
class SSLTransport <
|
19
|
+
class SSLTransport < Test::Unit::TestCase
|
20
|
+
include SSLTestHelper
|
21
|
+
|
20
22
|
def test_ok_connection
|
21
23
|
server = ssl_server
|
22
24
|
st = Thread.new {
|
@@ -34,7 +36,6 @@ class SSLTransport < SSLTest
|
|
34
36
|
|
35
37
|
def test_retry
|
36
38
|
client = Object.new
|
37
|
-
client.class.module_eval { attr_accessor :retries }
|
38
39
|
def client.connect
|
39
40
|
true
|
40
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-sumologic-cloud-syslog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Acquia Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|