logstash-output-elasticsearch 11.4.1-java → 11.7.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/docs/index.asciidoc +53 -8
- data/lib/logstash/outputs/elasticsearch/http_client.rb +2 -2
- data/lib/logstash/outputs/elasticsearch/http_client_builder.rb +7 -0
- data/lib/logstash/outputs/elasticsearch/templates/ecs-v8/elasticsearch-7x.json +1 -1
- data/lib/logstash/outputs/elasticsearch/templates/ecs-v8/elasticsearch-8x.json +1 -1
- data/lib/logstash/outputs/elasticsearch.rb +8 -0
- data/lib/logstash/plugin_mixins/elasticsearch/api_configs.rb +21 -3
- data/lib/logstash/plugin_mixins/elasticsearch/common.rb +7 -2
- data/logstash-output-elasticsearch.gemspec +2 -2
- data/spec/fixtures/test_certs/ca.crt +27 -30
- data/spec/fixtures/test_certs/ca.der.sha256 +1 -0
- data/spec/fixtures/test_certs/renew.sh +13 -0
- data/spec/fixtures/test_certs/test.crt +28 -34
- data/spec/fixtures/test_certs/test.der.sha256 +1 -0
- data/spec/fixtures/test_certs/test.p12 +0 -0
- data/spec/integration/outputs/index_spec.rb +131 -9
- data/spec/unit/outputs/elasticsearch_ssl_spec.rb +1 -1
- data/spec/unit/outputs/error_whitelist_spec.rb +2 -2
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0002c4b7258cc2493f3ab5e1ddadf6dc3f3e6d51c3585af9c93f9d9a578cf01f
|
4
|
+
data.tar.gz: 1f4b7e4587ee5831ac32f499dba2e73324f5b00578db20369b46e2b53b0fa874
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a45147a1fc1f7d73bae911f05417d36150796edae9bd7622c11dbeb35bebbc938c3eddc7d7f65652743dfe94425ba4b1cc6905eaae4390116e2fa19d5c1f4be3
|
7
|
+
data.tar.gz: 2ad8fec97436ac571436407711793d8a97055f7a2fbe986ce9f75417d0ce414a01467c900c47c08e1caa7eb6ffd7884edcabedb12b3684c5b40ed543c040fc21
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 11.7.0
|
2
|
+
- Feature: deprecates the `failure_type_logging_whitelist` configuration option, renaming it `silence_errors_in_log` [#1068](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1068)
|
3
|
+
|
4
|
+
## 11.6.0
|
5
|
+
- Added support for `ca_trusted_fingerprint` when run on Logstash 8.3+ [#1074](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1074)
|
6
|
+
|
7
|
+
## 11.5.0
|
8
|
+
- Feat: add ssl_supported_protocols option [#1055](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1055)
|
9
|
+
|
10
|
+
## 11.4.2
|
11
|
+
- [DOC] Add `v8` to supported values for ecs_compatiblity defaults [#1059](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1059)
|
12
|
+
|
1
13
|
## 11.4.1
|
2
14
|
- Feat: upgrade manticore (http-client) library [#1063](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1063)
|
3
15
|
- the underlying changes include latest HttpClient (4.5.13)
|
data/docs/index.asciidoc
CHANGED
@@ -307,6 +307,7 @@ This plugin supports the following configuration options plus the
|
|
307
307
|
| <<plugins-{type}s-{plugin}-api_key>> |<<password,password>>|No
|
308
308
|
| <<plugins-{type}s-{plugin}-bulk_path>> |<<string,string>>|No
|
309
309
|
| <<plugins-{type}s-{plugin}-cacert>> |a valid filesystem path|No
|
310
|
+
| <<plugins-{type}s-{plugin}-ca_trusted_fingerprint>> |<<string,string>>|No
|
310
311
|
| <<plugins-{type}s-{plugin}-cloud_auth>> |<<password,password>>|No
|
311
312
|
| <<plugins-{type}s-{plugin}-cloud_id>> |<<string,string>>|No
|
312
313
|
| <<plugins-{type}s-{plugin}-custom_headers>> |<<hash,hash>>|No
|
@@ -331,6 +332,7 @@ This plugin supports the following configuration options plus the
|
|
331
332
|
| <<plugins-{type}s-{plugin}-index>> |<<string,string>>|No
|
332
333
|
| <<plugins-{type}s-{plugin}-keystore>> |a valid filesystem path|No
|
333
334
|
| <<plugins-{type}s-{plugin}-keystore_password>> |<<password,password>>|No
|
335
|
+
| <<plugins-{type}s-{plugin}-silence_errors_in_log>> |<<array,array>>|No
|
334
336
|
| <<plugins-{type}s-{plugin}-manage_template>> |<<boolean,boolean>>|No
|
335
337
|
| <<plugins-{type}s-{plugin}-parameters>> |<<hash,hash>>|No
|
336
338
|
| <<plugins-{type}s-{plugin}-parent>> |<<string,string>>|No
|
@@ -355,6 +357,7 @@ This plugin supports the following configuration options plus the
|
|
355
357
|
| <<plugins-{type}s-{plugin}-sniffing_path>> |<<string,string>>|No
|
356
358
|
| <<plugins-{type}s-{plugin}-ssl>> |<<boolean,boolean>>|No
|
357
359
|
| <<plugins-{type}s-{plugin}-ssl_certificate_verification>> |<<boolean,boolean>>|No
|
360
|
+
| <<plugins-{type}s-{plugin}-ssl_supported_protocols>> |<<string,string>>|No
|
358
361
|
| <<plugins-{type}s-{plugin}-template>> |a valid filesystem path|No
|
359
362
|
| <<plugins-{type}s-{plugin}-template_name>> |<<string,string>>|No
|
360
363
|
| <<plugins-{type}s-{plugin}-template_overwrite>> |<<boolean,boolean>>|No
|
@@ -421,6 +424,15 @@ this defaults to a concatenation of the path parameter and "_bulk"
|
|
421
424
|
|
422
425
|
The .cer or .pem file to validate the server's certificate.
|
423
426
|
|
427
|
+
[id="plugins-{type}s-{plugin}-ca_trusted_fingerprint"]
|
428
|
+
===== `ca_trusted_fingerprint`
|
429
|
+
|
430
|
+
* Value type is <<string,string>>, and must contain exactly 64 hexadecimal characters.
|
431
|
+
* There is no default value for this setting.
|
432
|
+
* Use of this option _requires_ Logstash 8.3+
|
433
|
+
|
434
|
+
The SHA-256 fingerprint of an SSL Certificate Authority to trust, such as the autogenerated self-signed CA for an Elasticsearch cluster.
|
435
|
+
|
424
436
|
[id="plugins-{type}s-{plugin}-cloud_auth"]
|
425
437
|
===== `cloud_auth`
|
426
438
|
|
@@ -554,7 +566,7 @@ If you don't set a value for this option:
|
|
554
566
|
* Value type is <<string,string>>
|
555
567
|
* Supported values are:
|
556
568
|
** `disabled`: does not provide ECS-compatible templates
|
557
|
-
** `v1`:
|
569
|
+
** `v1`,`v8`: Elastic Common Schema-compliant behavior
|
558
570
|
* Default value depends on which version of Logstash is running:
|
559
571
|
** When Logstash provides a `pipeline.ecs_compatibility` setting, its value is used as the default
|
560
572
|
** Otherwise, the default value is `disabled`.
|
@@ -573,9 +585,7 @@ of this setting affects the _default_ values of:
|
|
573
585
|
* Value type is <<array,array>>
|
574
586
|
* Default value is `[]`
|
575
587
|
|
576
|
-
|
577
|
-
A useful example is when you want to skip all 409 errors
|
578
|
-
which are `document_already_exists_exception`.
|
588
|
+
NOTE: Deprecated, refer to <<plugins-{type}s-{plugin}-silence_errors_in_log>>.
|
579
589
|
|
580
590
|
[id="plugins-{type}s-{plugin}-custom_headers"]
|
581
591
|
===== `custom_headers`
|
@@ -732,8 +742,7 @@ Indexes may not contain uppercase characters.
|
|
732
742
|
For weekly indexes ISO 8601 format is recommended, eg. logstash-%{+xxxx.ww}.
|
733
743
|
Logstash uses
|
734
744
|
http://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html[Joda
|
735
|
-
formats]
|
736
|
-
|
745
|
+
formats] and the `@timestamp` field of each event is being used as source for the date.
|
737
746
|
|
738
747
|
[id="plugins-{type}s-{plugin}-keystore"]
|
739
748
|
===== `keystore`
|
@@ -952,6 +961,25 @@ Set variable name passed to script (scripted update)
|
|
952
961
|
|
953
962
|
if enabled, script is in charge of creating non-existent document (scripted update)
|
954
963
|
|
964
|
+
[id="plugins-{type}s-{plugin}-silence_errors_in_log"]
|
965
|
+
===== `silence_errors_in_log`
|
966
|
+
|
967
|
+
* Value type is <<array,array>>
|
968
|
+
* Default value is `[]`
|
969
|
+
|
970
|
+
Defines the list of Elasticsearch errors that you don't want to log.
|
971
|
+
A useful example is when you want to skip all 409 errors
|
972
|
+
which are `document_already_exists_exception`.
|
973
|
+
|
974
|
+
[source,ruby]
|
975
|
+
output {
|
976
|
+
elasticsearch {
|
977
|
+
silence_errors_in_log => ["document_already_exists_exception"]
|
978
|
+
}
|
979
|
+
}
|
980
|
+
|
981
|
+
NOTE: Deprecates <<plugins-{type}s-{plugin}-failure_type_logging_whitelist>>.
|
982
|
+
|
955
983
|
[id="plugins-{type}s-{plugin}-sniffing"]
|
956
984
|
===== `sniffing`
|
957
985
|
|
@@ -1004,6 +1032,23 @@ Option to validate the server's certificate. Disabling this severely compromises
|
|
1004
1032
|
For more information on disabling certificate verification please read
|
1005
1033
|
https://www.cs.utexas.edu/~shmat/shmat_ccs12.pdf
|
1006
1034
|
|
1035
|
+
[id="plugins-{type}s-{plugin}-ssl_supported_protocols"]
|
1036
|
+
===== `ssl_supported_protocols`
|
1037
|
+
|
1038
|
+
* Value type is <<string,string>>
|
1039
|
+
* Allowed values are: `'TLSv1.1'`, `'TLSv1.2'`, `'TLSv1.3'`
|
1040
|
+
* Default depends on the JDK being used. With up-to-date Logstash, the default is `['TLSv1.2', 'TLSv1.3']`.
|
1041
|
+
`'TLSv1.1'` is not considered secure and is only provided for legacy applications.
|
1042
|
+
|
1043
|
+
List of allowed SSL/TLS versions to use when establishing a connection to the Elasticsearch cluster.
|
1044
|
+
|
1045
|
+
For Java 8 `'TLSv1.3'` is supported only since **8u262** (AdoptOpenJDK), but requires that you set the
|
1046
|
+
`LS_JAVA_OPTS="-Djdk.tls.client.protocols=TLSv1.3"` system property in Logstash.
|
1047
|
+
|
1048
|
+
NOTE: If you configure the plugin to use `'TLSv1.1'` on any recent JVM, such as the one packaged with Logstash,
|
1049
|
+
the protocol is disabled by default and needs to be enabled manually by changing `jdk.tls.disabledAlgorithms` in
|
1050
|
+
the *$JDK_HOME/conf/security/java.security* configuration file. That is, `TLSv1.1` needs to be removed from the list.
|
1051
|
+
|
1007
1052
|
[id="plugins-{type}s-{plugin}-template"]
|
1008
1053
|
===== `template`
|
1009
1054
|
|
@@ -1018,8 +1063,8 @@ If not set, the included template will be used.
|
|
1018
1063
|
|
1019
1064
|
* Value type is <<string,string>>
|
1020
1065
|
* Default value depends on whether <<plugins-{type}s-{plugin}-ecs_compatibility>> is enabled:
|
1021
|
-
|
1022
|
-
|
1066
|
+
** ECS Compatibility disabled: `logstash`
|
1067
|
+
** ECS Compatibility enabled: `ecs-logstash`
|
1023
1068
|
|
1024
1069
|
|
1025
1070
|
This configuration option defines how the template is named inside Elasticsearch.
|
@@ -283,11 +283,11 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
283
283
|
end
|
284
284
|
|
285
285
|
def client_settings
|
286
|
-
@options[:client_settings] || {}
|
286
|
+
@_client_settings ||= @options[:client_settings] || {}
|
287
287
|
end
|
288
288
|
|
289
289
|
def ssl_options
|
290
|
-
client_settings.fetch(:ssl, {})
|
290
|
+
@_ssl_options ||= client_settings.fetch(:ssl, {})
|
291
291
|
end
|
292
292
|
|
293
293
|
def http_compression
|
@@ -132,11 +132,18 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
132
132
|
ssl_options[:keystore] = keystore
|
133
133
|
ssl_options[:keystore_password] = keystore_password.value if keystore_password
|
134
134
|
end
|
135
|
+
|
135
136
|
if !params["ssl_certificate_verification"]
|
136
137
|
logger.warn "You have enabled encryption but DISABLED certificate verification, " +
|
137
138
|
"to make sure your data is secure remove `ssl_certificate_verification => false`"
|
138
139
|
ssl_options[:verify] = :disable # false accepts self-signed but still validates hostname
|
139
140
|
end
|
141
|
+
|
142
|
+
ssl_options[:trust_strategy] = params["ssl_trust_strategy"] if params.include?("ssl_trust_strategy")
|
143
|
+
|
144
|
+
protocols = params['ssl_supported_protocols']
|
145
|
+
ssl_options[:protocols] = protocols if protocols && protocols.any?
|
146
|
+
|
140
147
|
{ ssl: ssl_options }
|
141
148
|
end
|
142
149
|
|
@@ -266,6 +266,14 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
266
266
|
end
|
267
267
|
|
268
268
|
def register
|
269
|
+
if !failure_type_logging_whitelist.empty?
|
270
|
+
log_message = "'failure_type_logging_whitelist' is deprecated and in a future version of Elasticsearch " +
|
271
|
+
"output plugin will be removed, please use 'silence_errors_in_log' instead."
|
272
|
+
@deprecation_logger.deprecated log_message
|
273
|
+
@logger.warn log_message
|
274
|
+
@silence_errors_in_log = silence_errors_in_log | failure_type_logging_whitelist
|
275
|
+
end
|
276
|
+
|
269
277
|
@after_successful_connection_done = Concurrent::AtomicBoolean.new(false)
|
270
278
|
@stopping = Concurrent::AtomicBoolean.new(false)
|
271
279
|
|
@@ -1,3 +1,6 @@
|
|
1
|
+
|
2
|
+
require 'logstash/plugin_mixins/ca_trusted_fingerprint_support'
|
3
|
+
|
1
4
|
module LogStash; module PluginMixins; module ElasticSearch
|
2
5
|
module APIConfigs
|
3
6
|
|
@@ -52,6 +55,9 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
52
55
|
# The .cer or .pem file to validate the server's certificate
|
53
56
|
:cacert => { :validate => :path },
|
54
57
|
|
58
|
+
# One or more hex-encoded SHA256 fingerprints to trust as Certificate Authorities
|
59
|
+
:ca_trusted_fingerprint => LogStash::PluginMixins::CATrustedFingerprintSupport,
|
60
|
+
|
55
61
|
# The JKS truststore to validate the server's certificate.
|
56
62
|
# Use either `:truststore` or `:cacert`
|
57
63
|
:truststore => { :validate => :path },
|
@@ -66,6 +72,8 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
66
72
|
# Set the keystore password
|
67
73
|
:keystore_password => { :validate => :password },
|
68
74
|
|
75
|
+
:ssl_supported_protocols => { :validate => ['TLSv1.1', 'TLSv1.2', 'TLSv1.3'], :default => [], :list => true },
|
76
|
+
|
69
77
|
# This setting asks Elasticsearch for the list of all cluster nodes and adds them to the hosts list.
|
70
78
|
# Note: This will return ALL nodes with HTTP enabled (including master nodes!). If you use
|
71
79
|
# this with master nodes, you probably want to disable HTTP on them by setting
|
@@ -91,10 +99,14 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
91
99
|
# a timeout occurs, the request will be retried.
|
92
100
|
:timeout => { :validate => :number, :default => 60 },
|
93
101
|
|
94
|
-
#
|
102
|
+
# Deprecated, refer to `silence_errors_in_log`.
|
103
|
+
:failure_type_logging_whitelist => { :validate => :array, :default => [] },
|
104
|
+
|
105
|
+
# Defines the list of Elasticsearch errors that you don't want to log.
|
95
106
|
# A useful example is when you want to skip all 409 errors
|
96
107
|
# which are `document_already_exists_exception`.
|
97
|
-
|
108
|
+
# Deprecates `failure_type_logging_whitelist`.
|
109
|
+
:silence_errors_in_log => { :validate => :array, :default => [] },
|
98
110
|
|
99
111
|
# While the output tries to reuse connections efficiently we have a maximum.
|
100
112
|
# This sets the maximum number of open connections the output will create.
|
@@ -161,7 +173,13 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
161
173
|
}.freeze
|
162
174
|
|
163
175
|
def self.included(base)
|
164
|
-
CONFIG_PARAMS.each
|
176
|
+
CONFIG_PARAMS.each do |name, opts|
|
177
|
+
if opts.kind_of?(Module)
|
178
|
+
base.include(opts)
|
179
|
+
else
|
180
|
+
base.config(name, opts)
|
181
|
+
end
|
182
|
+
end
|
165
183
|
end
|
166
184
|
end
|
167
185
|
end; end; end
|
@@ -27,6 +27,11 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
27
27
|
fill_hosts_from_cloud_id
|
28
28
|
setup_hosts
|
29
29
|
|
30
|
+
# inject the TrustStrategy from CATrustedFingerprintSupport
|
31
|
+
if trust_strategy_for_ca_trusted_fingerprint
|
32
|
+
params["ssl_trust_strategy"] = trust_strategy_for_ca_trusted_fingerprint
|
33
|
+
end
|
34
|
+
|
30
35
|
params["metric"] = metric
|
31
36
|
if @proxy.eql?('')
|
32
37
|
@logger.warn "Supplied proxy setting (proxy => '') has no effect"
|
@@ -165,7 +170,7 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
165
170
|
|
166
171
|
sleep_interval = @retry_initial_interval
|
167
172
|
|
168
|
-
while submit_actions && submit_actions.
|
173
|
+
while submit_actions && submit_actions.size > 0
|
169
174
|
|
170
175
|
# We retry with whatever is didn't succeed
|
171
176
|
begin
|
@@ -279,7 +284,7 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
279
284
|
end
|
280
285
|
|
281
286
|
def log_failure_type?(failure)
|
282
|
-
!
|
287
|
+
!silence_errors_in_log.include?(failure["type"])
|
283
288
|
end
|
284
289
|
|
285
290
|
# Rescue retryable errors during bulk submission
|
@@ -1,7 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-elasticsearch'
|
3
|
-
s.version = '11.
|
4
|
-
|
3
|
+
s.version = '11.7.0'
|
5
4
|
s.licenses = ['apache-2.0']
|
6
5
|
s.summary = "Stores logs in Elasticsearch"
|
7
6
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
@@ -26,6 +25,7 @@ Gem::Specification.new do |s|
|
|
26
25
|
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
|
27
26
|
s.add_runtime_dependency 'logstash-mixin-ecs_compatibility_support', '~>1.0'
|
28
27
|
s.add_runtime_dependency 'logstash-mixin-deprecation_logger_support', '~>1.0'
|
28
|
+
s.add_runtime_dependency 'logstash-mixin-ca_trusted_fingerprint_support', '~>1.0'
|
29
29
|
|
30
30
|
s.add_development_dependency 'logstash-codec-plain'
|
31
31
|
s.add_development_dependency 'logstash-devutils'
|
@@ -1,32 +1,29 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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emQka5bZH8PRZGBYUiIRVS7N8px
|
28
|
+
Y1ITp+FdSlJAm41UGChuF8Our31AqZYvLNRWAvLJRhR/kNM9HMeURz7zI/KKYhlA
|
32
29
|
-----END CERTIFICATE-----
|
@@ -0,0 +1 @@
|
|
1
|
+
3e1c908fb2d7f1634643bb75462119c55a7cc392cd1877dd91d9f15f87e86757
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
cd "$(dirname "$0")"
|
5
|
+
|
6
|
+
openssl x509 -x509toreq -in ca.crt -signkey ca.key -out ca.csr
|
7
|
+
openssl x509 -req -days 365 -in ca.csr -set_serial 0x01 -signkey ca.key -out ca.crt && rm ca.csr
|
8
|
+
openssl x509 -in ca.crt -outform der | sha256sum | awk '{print $1}' > ca.der.sha256
|
9
|
+
|
10
|
+
openssl x509 -x509toreq -in test.crt -signkey test.key -out test.csr
|
11
|
+
openssl x509 -req -days 365 -in test.csr -set_serial 0x01 -CA ca.crt -CAkey ca.key -out test.crt && rm test.csr
|
12
|
+
openssl x509 -in test.crt -outform der | sha256sum | awk '{print $1}' > test.der.sha256
|
13
|
+
openssl pkcs12 -export -inkey test.key -in test.crt -passout "pass:1234567890" -out test.p12
|
@@ -1,36 +1,30 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
/
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
y9hq2b49bYlcSQMtmlimCBDiu82z0aYtVFLalZ2L/W7CMaeE3jpyzu/bbygRv/Bp
|
31
|
-
lKSaUtaFIVgiuRBPwIBDMyai3CJ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tbDjw9qaSY58kGNj1cKV5eUnKOi9v0gDjrVyKVuesnDeOmoi25/YvBbBA5
|
28
|
+
TKgMUwSmJ2P5p6W4h0ftV/Nyy1Hx/rwJ7ZcvUJCtwgCNOeXw9e61Ys+C2ruLSPuh
|
29
|
+
wRncxHmbiw==
|
36
30
|
-----END CERTIFICATE-----
|
@@ -0,0 +1 @@
|
|
1
|
+
dca380f330bdf3d4b242b3c48d541c4698eaffa0d532316b27e6080443e601b5
|
Binary file
|
@@ -60,26 +60,63 @@ describe "indexing" do
|
|
60
60
|
|
61
61
|
let(:curl_opts) { nil }
|
62
62
|
|
63
|
+
let(:es_admin) { 'admin' } # default user added in ES -> 8.x requires auth credentials for /_refresh etc
|
64
|
+
let(:es_admin_pass) { 'elastic' }
|
65
|
+
|
63
66
|
def curl_and_get_json_response(url, method: :get); require 'open3'
|
67
|
+
cmd = "curl -s -v --show-error #{curl_opts} -X #{method.to_s.upcase} -k #{url}"
|
64
68
|
begin
|
65
|
-
|
69
|
+
out, err, status = Open3.capture3(cmd)
|
66
70
|
rescue Errno::ENOENT
|
67
71
|
fail "curl not available, make sure curl binary is installed and available on $PATH"
|
68
72
|
end
|
69
73
|
|
70
74
|
if status.success?
|
71
|
-
|
75
|
+
http_status = err.match(/< HTTP\/1.1 (\d+)/)[1] || '0' # < HTTP/1.1 200 OK\r\n
|
76
|
+
|
77
|
+
if http_status.strip[0].to_i > 2
|
78
|
+
error = (LogStash::Json.load(out)['error']) rescue nil
|
79
|
+
if error
|
80
|
+
fail "#{cmd.inspect} received an error: #{http_status}\n\n#{error.inspect}"
|
81
|
+
else
|
82
|
+
warn out
|
83
|
+
fail "#{cmd.inspect} unexpected response: #{http_status}\n\n#{err}"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
LogStash::Json.load(out)
|
72
88
|
else
|
73
|
-
|
89
|
+
warn out
|
90
|
+
fail "#{cmd.inspect} process failed: #{status}\n\n#{err}"
|
74
91
|
end
|
75
92
|
end
|
76
93
|
|
94
|
+
let(:initial_events) { [] }
|
95
|
+
|
96
|
+
let(:do_register) { true }
|
97
|
+
|
77
98
|
before do
|
78
|
-
subject.register
|
79
|
-
subject.multi_receive(
|
99
|
+
subject.register if do_register
|
100
|
+
subject.multi_receive(initial_events) if initial_events
|
80
101
|
end
|
81
|
-
|
102
|
+
|
103
|
+
after do
|
104
|
+
subject.do_close
|
105
|
+
end
|
106
|
+
|
82
107
|
shared_examples "an indexer" do |secure|
|
108
|
+
before(:each) do
|
109
|
+
host_unreachable_error_class = LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError
|
110
|
+
allow(host_unreachable_error_class).to receive(:new).with(any_args).and_wrap_original do |m, original, url|
|
111
|
+
if original.message.include?("PKIX path building failed")
|
112
|
+
$stderr.puts "Client not connecting due to PKIX path building failure; " +
|
113
|
+
"shutting plugin down to prevent infinite retries"
|
114
|
+
subject.close # premature shutdown to prevent infinite retry
|
115
|
+
end
|
116
|
+
m.call(original, url)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
83
120
|
it "ships events" do
|
84
121
|
subject.multi_receive(events)
|
85
122
|
|
@@ -121,6 +158,32 @@ describe "indexing" do
|
|
121
158
|
end
|
122
159
|
end
|
123
160
|
|
161
|
+
shared_examples "PKIX path failure" do
|
162
|
+
let(:do_register) { false }
|
163
|
+
let(:host_unreachable_error_class) { LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError }
|
164
|
+
|
165
|
+
before(:each) do
|
166
|
+
limit_execution
|
167
|
+
end
|
168
|
+
|
169
|
+
let(:limit_execution) do
|
170
|
+
Thread.new { sleep 5; subject.close }
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'fails to establish TLS' do
|
174
|
+
allow(host_unreachable_error_class).to receive(:new).with(any_args).and_call_original.at_least(:once)
|
175
|
+
|
176
|
+
subject.register
|
177
|
+
limit_execution.join
|
178
|
+
|
179
|
+
sleep 1
|
180
|
+
|
181
|
+
expect(host_unreachable_error_class).to have_received(:new).at_least(:once) do |original, url|
|
182
|
+
expect(original.message).to include("PKIX path building failed")
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
124
187
|
describe "an indexer with custom index_type", :integration => true do
|
125
188
|
let(:config) {
|
126
189
|
{
|
@@ -146,17 +209,17 @@ describe "indexing" do
|
|
146
209
|
let(:user) { "simpleuser" }
|
147
210
|
let(:password) { "abc123" }
|
148
211
|
let(:cacert) { "spec/fixtures/test_certs/ca.crt" }
|
149
|
-
let(:es_url) {"https
|
212
|
+
let(:es_url) { "https://#{get_host_port}" }
|
150
213
|
let(:config) do
|
151
214
|
{
|
152
|
-
"hosts" => [
|
215
|
+
"hosts" => [ get_host_port ],
|
153
216
|
"user" => user,
|
154
217
|
"password" => password,
|
155
218
|
"ssl" => true,
|
156
219
|
"cacert" => cacert,
|
157
220
|
"index" => index
|
158
221
|
}
|
159
|
-
end
|
222
|
+
end
|
160
223
|
|
161
224
|
let(:curl_opts) { "-u #{user}:#{password}" }
|
162
225
|
|
@@ -197,6 +260,8 @@ describe "indexing" do
|
|
197
260
|
|
198
261
|
else
|
199
262
|
|
263
|
+
let(:curl_opts) { "#{super()} --tlsv1.2 --tls-max 1.3 -u #{es_admin}:#{es_admin_pass}" } # due ES 8.x we need user/password
|
264
|
+
|
200
265
|
it_behaves_like("an indexer", true)
|
201
266
|
|
202
267
|
describe "with a password requiring escaping" do
|
@@ -219,6 +284,63 @@ describe "indexing" do
|
|
219
284
|
include_examples("an indexer", true)
|
220
285
|
end
|
221
286
|
|
287
|
+
context "without providing `cacert`" do
|
288
|
+
let(:config) do
|
289
|
+
super().tap do |c|
|
290
|
+
c.delete("cacert")
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
it_behaves_like("PKIX path failure")
|
295
|
+
end
|
296
|
+
|
297
|
+
if Gem::Version.new(LOGSTASH_VERSION) >= Gem::Version.new("8.3.0")
|
298
|
+
context "with `ca_trusted_fingerprint` instead of `cacert`" do
|
299
|
+
let(:config) do
|
300
|
+
super().tap do |c|
|
301
|
+
c.delete("cacert")
|
302
|
+
c.update("ca_trusted_fingerprint" => ca_trusted_fingerprint)
|
303
|
+
end
|
304
|
+
end
|
305
|
+
let(:ca_trusted_fingerprint) { File.read("spec/fixtures/test_certs/test.der.sha256").chomp }
|
306
|
+
|
307
|
+
|
308
|
+
it_behaves_like("an indexer", true)
|
309
|
+
|
310
|
+
context 'with an invalid `ca_trusted_fingerprint`' do
|
311
|
+
let(:ca_trusted_fingerprint) { super().reverse }
|
312
|
+
|
313
|
+
it_behaves_like("PKIX path failure")
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
context 'with enforced TLSv1.3 protocol' do
|
319
|
+
let(:config) { super().merge 'ssl_supported_protocols' => [ 'TLSv1.3' ] }
|
320
|
+
|
321
|
+
it_behaves_like("an indexer", true)
|
322
|
+
end
|
323
|
+
|
324
|
+
context 'with enforced TLSv1.2 protocol (while ES only enabled TLSv1.3)' do
|
325
|
+
let(:config) { super().merge 'ssl_supported_protocols' => [ 'TLSv1.2' ] }
|
326
|
+
|
327
|
+
let(:initial_events) { nil }
|
328
|
+
|
329
|
+
it "does not ship events" do
|
330
|
+
curl_and_get_json_response index_url, method: :put # make sure index exists
|
331
|
+
Thread.start { subject.multi_receive(events) } # we'll be stuck in a retry loop
|
332
|
+
sleep 2.5
|
333
|
+
|
334
|
+
curl_and_get_json_response "#{es_url}/_refresh", method: :post
|
335
|
+
|
336
|
+
result = curl_and_get_json_response "#{index_url}/_count?q=*"
|
337
|
+
cur_count = result["count"]
|
338
|
+
expect(cur_count).to eq(0) # ES output keeps re-trying but ends up with a
|
339
|
+
# [Manticore::ClientProtocolException] Received fatal alert: protocol_version
|
340
|
+
end
|
341
|
+
|
342
|
+
end if ENV['ES_SSL_SUPPORTED_PROTOCOLS'] == 'TLSv1.3'
|
343
|
+
|
222
344
|
end
|
223
345
|
|
224
346
|
end
|
@@ -33,7 +33,7 @@ describe "SSL option" do
|
|
33
33
|
|
34
34
|
it "should pass the flag to the ES client" do
|
35
35
|
expect(::Manticore::Client).to receive(:new) do |args|
|
36
|
-
expect(args[:ssl]).to
|
36
|
+
expect(args[:ssl]).to match hash_including(:enabled => true, :verify => :disable)
|
37
37
|
end.and_return(manticore_double)
|
38
38
|
|
39
39
|
subject.register
|
@@ -45,8 +45,8 @@ describe "whitelisting error types in expected behavior" do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
describe "when failure logging is disabled for
|
49
|
-
let(:settings) { super().merge("
|
48
|
+
describe "when failure logging is disabled for document exists error" do
|
49
|
+
let(:settings) { super().merge("silence_errors_in_log" => ["document_already_exists_exception"]) }
|
50
50
|
|
51
51
|
it "should log a failure on the action" do
|
52
52
|
expect(subject.logger).not_to have_received(:warn).with("Failed action", anything)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.
|
4
|
+
version: 11.7.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,6 +98,20 @@ dependencies:
|
|
98
98
|
- - "~>"
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '1.0'
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - "~>"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '1.0'
|
107
|
+
name: logstash-mixin-ca_trusted_fingerprint_support
|
108
|
+
prerelease: false
|
109
|
+
type: :runtime
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - "~>"
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '1.0'
|
101
115
|
- !ruby/object:Gem::Dependency
|
102
116
|
requirement: !ruby/object:Gem::Requirement
|
103
117
|
requirements:
|
@@ -245,8 +259,11 @@ files:
|
|
245
259
|
- spec/fixtures/template-with-policy-es7x.json
|
246
260
|
- spec/fixtures/template-with-policy-es8x.json
|
247
261
|
- spec/fixtures/test_certs/ca.crt
|
262
|
+
- spec/fixtures/test_certs/ca.der.sha256
|
248
263
|
- spec/fixtures/test_certs/ca.key
|
264
|
+
- spec/fixtures/test_certs/renew.sh
|
249
265
|
- spec/fixtures/test_certs/test.crt
|
266
|
+
- spec/fixtures/test_certs/test.der.sha256
|
250
267
|
- spec/fixtures/test_certs/test.key
|
251
268
|
- spec/fixtures/test_certs/test.p12
|
252
269
|
- spec/fixtures/test_certs/test_invalid.crt
|
@@ -327,8 +344,11 @@ test_files:
|
|
327
344
|
- spec/fixtures/template-with-policy-es7x.json
|
328
345
|
- spec/fixtures/template-with-policy-es8x.json
|
329
346
|
- spec/fixtures/test_certs/ca.crt
|
347
|
+
- spec/fixtures/test_certs/ca.der.sha256
|
330
348
|
- spec/fixtures/test_certs/ca.key
|
349
|
+
- spec/fixtures/test_certs/renew.sh
|
331
350
|
- spec/fixtures/test_certs/test.crt
|
351
|
+
- spec/fixtures/test_certs/test.der.sha256
|
332
352
|
- spec/fixtures/test_certs/test.key
|
333
353
|
- spec/fixtures/test_certs/test.p12
|
334
354
|
- spec/fixtures/test_certs/test_invalid.crt
|