Skip to content

Commit 620aa58

Browse files
karesrobbavey
andauthored
Feat: TLSv1.3 support (#146)
Co-authored-by: Rob Bavey <rob.bavey@elastic.co>
1 parent 22534b1 commit 620aa58

23 files changed

+660
-49
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 3.5.0
2+
- Feat: TLSv1.3 support [#146](https://github.com/logstash-plugins/logstash-input-http/pull/146)
3+
14
## 3.4.5
25
- Build: do not package log4j-api dependency [#149](https://github.com/logstash-plugins/logstash-input-http/pull/149).
36
Logstash provides the log4j framework and the dependency is not needed except testing and compiling.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.4.5
1+
3.5.0

docs/index.asciidoc

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,11 @@ and no codec for the request's content-type is found
134134
===== `cipher_suites`
135135

136136
* Value type is <<array,array>>
137-
* Default value is `java.lang.String[TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256]@459cfcca`
137+
* Default value is `[TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384, TLS_CHACHA20_POLY1305_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256]`
138138

139139
The list of ciphers suite to use, listed by priorities.
140+
The default values applies for OpenJDK 11.0.14 and higher, for older versions the list does not include suites
141+
not supported by the JDK, such as the ChaCha20 family of ciphers.
140142

141143
[id="plugins-{type}s-{plugin}-ecs_compatibility"]
142144
===== `ecs_compatibility`
@@ -357,7 +359,7 @@ Time in milliseconds for an incomplete ssl handshake to timeout
357359
* There is no default value for this setting.
358360

359361
SSL key to use.
360-
NOTE: This key need to be in the PKCS8 format, you can convert it with https://www.openssl.org/docs/man1.1.0/apps/pkcs8.html[OpenSSL]
362+
NOTE: This key need to be in the PKCS8 format, you can convert it with https://www.openssl.org/docs/man1.1.1/man1/openssl-pkcs8.html[OpenSSL]
361363
for more information.
362364

363365
[id="plugins-{type}s-{plugin}-ssl_key_passphrase"]
@@ -396,19 +398,19 @@ Number of threads to use for both accepting connections and handling requests
396398
===== `tls_max_version`
397399

398400
* Value type is <<number,number>>
399-
* Default value is `1.2`
401+
* Default value is `1.3`
400402

401-
The maximum TLS version allowed for the encrypted connections. The value must be the one of the following:
402-
1.0 for TLS 1.0, 1.1 for TLS 1.1, 1.2 for TLS 1.2
403+
The maximum TLS version allowed for the encrypted connections.
404+
The value must be the one of the following: 1.1 for TLS 1.1, 1.2 for TLS 1.2, 1.3 for TLSv1.3
403405

404406
[id="plugins-{type}s-{plugin}-tls_min_version"]
405407
===== `tls_min_version`
406408

407409
* Value type is <<number,number>>
408-
* Default value is `1`
410+
* Default value is `1.2`
409411

410-
The minimum TLS version allowed for the encrypted connections. The value must be one of the following:
411-
1.0 for TLS 1.0, 1.1 for TLS 1.1, 1.2 for TLS 1.2
412+
The minimum TLS version allowed for the encrypted connections.
413+
The value must be one of the following: 1.1 for TLS 1.1, 1.2 for TLS 1.2, 1.3 for TLSv1.3
412414

413415
[id="plugins-{type}s-{plugin}-user"]
414416
===== `user`

lib/logstash/inputs/http.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
8787
config :ssl_handshake_timeout, :validate => :number, :default => 10000
8888

8989
# The minimum TLS version allowed for the encrypted connections. The value must be one of the following:
90-
# 1.0 for TLS 1.0, 1.1 for TLS 1.1, 1.2 for TLS 1.2
90+
# 1.0 for TLS 1.0, 1.1 for TLS 1.1, 1.2 for TLS 1.2, 1.3 for TLS 1.3
9191
config :tls_min_version, :validate => :number, :default => TLS.min.version
9292

9393
# The maximum TLS version allowed for the encrypted connections. The value must be the one of the following:
94-
# 1.0 for TLS 1.0, 1.1 for TLS 1.1, 1.2 for TLS 1.2
94+
# 1.0 for TLS 1.0, 1.1 for TLS 1.1, 1.2 for TLS 1.2, 1.3 for TLS 1.3
9595
config :tls_max_version, :validate => :number, :default => TLS.max.version
9696

9797
# The list of ciphers suite to use, listed by priorities.

lib/logstash/inputs/http/tls.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ def <=>(other)
1818
TLS_PROTOCOL_OPTIONS = [
1919
TLSOption.new("TLSv1", 1),
2020
TLSOption.new("TLSv1.1", 1.1),
21-
TLSOption.new("TLSv1.2", 1.2)
21+
TLSOption.new("TLSv1.2", 1.2),
22+
TLSOption.new("TLSv1.3", 1.3)
2223
]
2324

2425
def self.min

logstash-input-http.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ HTTP_INPUT_VERSION = File.read(File.expand_path(File.join(File.dirname(__FILE__)
22

33
Gem::Specification.new do |s|
44
s.name = 'logstash-input-http'
5-
s.version = HTTP_INPUT_VERSION
5+
s.version = HTTP_INPUT_VERSION
66
s.licenses = ['Apache License (2.0)']
77
s.summary = "Receives events over HTTP or HTTPS"
88
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"

spec/fixtures/certs/generate.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# warning: do not use the certificates produced by this tool in production.
2+
# This is for testing purposes only
3+
set -e
4+
5+
rm -rf generated
6+
mkdir generated
7+
cd generated
8+
9+
echo "GENERATED CERTIFICATES FOR TESTING ONLY." >> ./README.txt
10+
echo "DO NOT USE THESE CERTIFICATES IN PRODUCTION" >> ./README.txt
11+
12+
# certificate authority
13+
openssl genrsa -out root.key 4096
14+
openssl req -new -x509 -days 1826 -extensions ca -key root.key -out root.crt -subj "/C=LS/ST=NA/L=Http Input/O=Logstash/CN=root" -config ../openssl.cnf
15+
16+
# server certificate from root
17+
openssl genrsa -out server_from_root.key 4096
18+
openssl req -new -key server_from_root.key -out server_from_root.csr -subj "/C=LS/ST=NA/L=Http Input/O=Logstash/CN=server" -config ../openssl.cnf
19+
openssl x509 -req -extensions server_cert -extfile ../openssl.cnf -days 1096 -in server_from_root.csr -CA root.crt -CAkey root.key -set_serial 03 -out server_from_root.crt
20+
21+
# client certificate from root
22+
openssl genrsa -out client_from_root.key 4096
23+
openssl req -new -key client_from_root.key -out client_from_root.csr -subj "/C=LS/ST=NA/L=Http Input/O=Logstash/CN=client" -config ../openssl.cnf
24+
openssl x509 -req -extensions client_cert -extfile ../openssl.cnf -days 1096 -in client_from_root.csr -CA root.crt -CAkey root.key -set_serial 04 -out client_from_root.crt
25+
26+
# verify :allthethings
27+
openssl verify -CAfile root.crt server_from_root.crt
28+
29+
# create pkcs8 versions of all keys
30+
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in client_from_root.key -out client_from_root.key.pkcs8
31+
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in server_from_root.key -out server_from_root.key.pkcs8
32+
33+
# create pkcs12 keystores (pass:12345678)
34+
openssl pkcs12 -export -in client_from_root.crt -inkey client_from_root.key -out client_from_root.p12 -name "client_from_root" -passout 'pass:12345678'
35+
36+
# use java keytool to convert all pkcs12 keystores to jks-format keystores (pass:12345678)
37+
keytool -importkeystore -srckeystore client_from_root.p12 -srcstoretype pkcs12 -srcstorepass 12345678 -destkeystore client_from_root.jks -deststorepass 12345678 -alias client_from_root
38+
39+
# cleanup csr, we don't need them
40+
rm -rf *.csr
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
GENERATED CERTIFICATES FOR TESTING ONLY.
2+
DO NOT USE THESE CERTIFICATES IN PRODUCTION
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIGATCCA+mgAwIBAgIBBDANBgkqhkiG9w0BAQsFADBRMQswCQYDVQQGEwJMUzEL
3+
MAkGA1UECAwCTkExEzARBgNVBAcMCkh0dHAgSW5wdXQxETAPBgNVBAoMCExvZ3N0
4+
YXNoMQ0wCwYDVQQDDARyb290MB4XDTIxMTEyNDEwMjEzMloXDTI0MTEyNDEwMjEz
5+
MlowUzELMAkGA1UEBhMCTFMxCzAJBgNVBAgMAk5BMRMwEQYDVQQHDApIdHRwIElu
6+
cHV0MREwDwYDVQQKDAhMb2dzdGFzaDEPMA0GA1UEAwwGY2xpZW50MIICIjANBgkq
7+
hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAzz7tc52SXN84bP8/009HnfkDMGhqvNgi
8+
oO+kza7PT1O7jcA3i0hh1r2N4xUIllc3cSvcfFK/sw8mAFPGE6lMIPAWHnsFipd1
9+
6rrk7jIVEgBE7ZUYuqWRRQ7ULV1a3LTxCn7XUrtk1bbrLgPRcoUev81L19AQZQ6R
10+
DGv9MyFE2X71lvchj09eLh4RcR7/5Myj6ODt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fh8/sh0ZooFy791japEtec8HJIBHNPrJprqYnzosKTRnYSLJpiCP9ksordMS
27+
rTHWGDRnUXu1ggWanopt5wZfICG92gi8rROEk4fwFUy93E+WEzv8XCXpRxZqhdJf
28+
V+jPoUHo4ZOnM8uFna5Y/o+DiVOdPXgn9xspe5qhEvU8upsvKRVNlfAXVGWjiG13
29+
ZdR3PvGITplFhNkBAuPIf1Z/xTF0e8JzQSSC2CtThGuCJz9uSB6zpnxjODKxAqFX
30+
IbbH8Tnf8q6nEJm0RbMOyAc/HvX2eei1TV1XD9StL/M/2n0bCn/+s4peT4/qOy2T
31+
zqQYTe45RknishUiMiv00//W5LNImjb0THHxQ1kQxi7Tlk0dZ5CPUjMfBVCt+Gdo
32+
EQMjeGjvjfRvKtGzhtMDmkA3Oc8iOiaaR7mSU+ZjslDlRYnPKicbls673ttL3rx8
33+
R//PwWeZcBWkbowOYNJnjaiySpoO3WVEGMA8mUw4SEtlga6760cN4+e4pKnzo1sR
34+
P1W1gRQ=
35+
-----END CERTIFICATE-----
4.32 KB
Binary file not shown.

0 commit comments

Comments
 (0)