Skip to content

Commit bf13f8d

Browse files
authored
Standardize and add SSL settings (#213)
This commit reviewed and deprecated the following SSL settings to comply with Logstash's naming convention: - ssl_enable in favor of ssl_enabled - ssl_cert in favor of ssl_certificate - ssl_verify in favor of ssl_client_authentication when mode is server - ssl_verify in favor of ssl_verification_mode when mode is client It also added a few SSL configuration validations: - Added a warning log when ssl_* configs are set but ssl_enabled => false - ssl_ceritifcate & ssl_key config validation, including checking if both files are readable. - Ensure no ssl_client_authentication when mode => client - Ensure no ssl_verification_mode when mode => server - Ensure an ssl_certificate is provided when mode => server - Ensure ssl_certificate_authorities is provided when mode => server and it's using the new configuration (ssl_client_authentication)
1 parent 26a711e commit bf13f8d

File tree

15 files changed

+832
-101
lines changed

15 files changed

+832
-101
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 6.4.0
2+
- Reviewed and deprecated SSL settings to comply with Logstash's naming convention [#213](https://github.com/logstash-plugins/logstash-input-tcp/pull/213)
3+
- Deprecated `ssl_enable` in favor of `ssl_enabled`
4+
- Deprecated `ssl_cert` in favor of `ssl_certificate`
5+
- Deprecated `ssl_verify` in favor of `ssl_client_authentication` when mode is `server`
6+
- Deprecated `ssl_verify` in favor of `ssl_verification_mode` when mode is `client`
7+
- Added SSL configuration validations
8+
19
## 6.3.5
210
- update netty to 4.1.94 and other dependencies [#216](https://github.com/logstash-plugins/logstash-input-tcp/pull/216)
311

build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ version Files.readAllLines(Paths.get("version")).first()
3030
sourceCompatibility = JavaVersion.VERSION_1_8
3131

3232
String nettyVersion = '4.1.94.Final'
33+
String junitVersion = '5.9.2'
3334

3435
buildscript {
3536
repositories {
@@ -44,6 +45,9 @@ repositories {
4445

4546
dependencies {
4647
testImplementation 'org.apache.logging.log4j:log4j-core:2.17.1'
48+
testImplementation 'org.hamcrest:hamcrest-library:2.2'
49+
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
50+
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
4751

4852
implementation "io.netty:netty-buffer:${nettyVersion}"
4953
implementation "io.netty:netty-codec:${nettyVersion}"
@@ -58,6 +62,14 @@ dependencies {
5862
compileOnly group: 'org.bouncycastle', name: 'bcpkix-jdk18on', version: "1.71" // provided by Logstash (JRuby-OpenSSL)
5963
}
6064

65+
test {
66+
useJUnitPlatform()
67+
}
68+
69+
configurations {
70+
testImplementation.extendsFrom compileOnly
71+
}
72+
6173
task generateGemJarRequiresFile {
6274
doLast {
6375
File jars_file = file('lib/logstash-input-tcp_jars.rb')

docs/index.asciidoc

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ Available when receiving events by proxy and
9595
l|[@metadata][input][tcp][proxy][port] l|[proxy_port]
9696

9797
.1+|SSL Subject Metadata from a secured TCP
98-
connection. Available when `ssl_enable => true`
99-
AND `ssl_verify => true` l|[@metadata][input][tcp][ssl][subject] l|[sslsubject]
98+
connection. Available when `ssl_enabled => true`
99+
AND `ssl_client_authentication => 'optional' or 'required'` l|[@metadata][input][tcp][ssl][subject] l|[sslsubject]
100100
|=======================================================================
101101

102102
For example, the Elastic Common Schema reserves the https://www.elastic.co/guide/en/ecs/current/ecs-host.html[top-level `host` field] for information about the host on which the event happened.
@@ -130,15 +130,19 @@ This plugin supports the following configuration options plus the <<plugins-{typ
130130
| <<plugins-{type}s-{plugin}-mode>> |<<string,string>>, one of `["server", "client"]`|No
131131
| <<plugins-{type}s-{plugin}-port>> |<<number,number>>|Yes
132132
| <<plugins-{type}s-{plugin}-proxy_protocol>> |<<boolean,boolean>>|No
133-
| <<plugins-{type}s-{plugin}-ssl_cert>> |a valid filesystem path|No
133+
| <<plugins-{type}s-{plugin}-ssl_cert>> |a valid filesystem path|__Deprecated__
134+
| <<plugins-{type}s-{plugin}-ssl_certificate>> |a valid filesystem path|No
134135
| <<plugins-{type}s-{plugin}-ssl_certificate_authorities>> |<<array,array>>|No
135136
| <<plugins-{type}s-{plugin}-ssl_cipher_suites>> |<<string,string>>|No
136-
| <<plugins-{type}s-{plugin}-ssl_enable>> |<<boolean,boolean>>|No
137+
| <<plugins-{type}s-{plugin}-ssl_client_authentication>> |<<string,string>>, one of `["none", "optional", "required"]`|No
138+
| <<plugins-{type}s-{plugin}-ssl_enable>> |<<boolean,boolean>>|__Deprecated__
139+
| <<plugins-{type}s-{plugin}-ssl_enabled>> |<<boolean,boolean>>|No
137140
| <<plugins-{type}s-{plugin}-ssl_extra_chain_certs>> |<<array,array>>|No
138141
| <<plugins-{type}s-{plugin}-ssl_key>> |a valid filesystem path|No
139142
| <<plugins-{type}s-{plugin}-ssl_key_passphrase>> |<<password,password>>|No
140143
| <<plugins-{type}s-{plugin}-ssl_supported_protocols>> |<<string,string>>|No
141-
| <<plugins-{type}s-{plugin}-ssl_verify>> |<<boolean,boolean>>|No
144+
| <<plugins-{type}s-{plugin}-ssl_verification_mode>> |<<string,string>>, one of `["full", "none"]`|No
145+
| <<plugins-{type}s-{plugin}-ssl_verify>> |<<boolean,boolean>>|__Deprecated__
142146
| <<plugins-{type}s-{plugin}-tcp_keep_alive>> |<<boolean,boolean>>|No
143147
|=======================================================================
144148

@@ -210,13 +214,23 @@ http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt
210214

211215
[id="plugins-{type}s-{plugin}-ssl_cert"]
212216
===== `ssl_cert`
217+
deprecated[6.4.0, Replaced by <<plugins-{type}s-{plugin}-ssl_certificate>>]
213218

214219
* Value type is <<path,path>>
215220
* There is no default value for this setting.
216221

217222
Path to certificate in PEM format. This certificate will be presented
218223
to the connecting clients.
219224

225+
[id="plugins-{type}s-{plugin}-ssl_certificate"]
226+
===== `ssl_certificate`
227+
228+
* Value type is <<path,path>>
229+
* There is no default value for this setting.
230+
231+
Path to certificate in PEM format. This certificate will be presented
232+
to the other part of the TLS connection.
233+
220234
[id="plugins-{type}s-{plugin}-ssl_certificate_authorities"]
221235
===== `ssl_certificate_authorities`
222236

@@ -238,8 +252,33 @@ the table of supported https://docs.oracle.com/en/java/javase/11/docs/specs/secu
238252

239253
NOTE: To check the supported cipher suites locally run the following script: `$LS_HOME/bin/ruby -e 'p javax.net.ssl.SSLServerSocketFactory.getDefault.getSupportedCipherSuites'`.
240254

255+
[id="plugins-{type}s-{plugin}-ssl_client_authentication"]
256+
===== `ssl_client_authentication`
257+
258+
* Value can be any of: `none`, `optional`, `required`
259+
* Default value is `required`
260+
261+
Controls the server's behavior in regard to requesting a certificate from client connections:
262+
`none` disables the client authentication. `required` forces a client to present a certificate, while `optional` requests a client certificate
263+
but the client is not required to present one.
264+
265+
When mutual TLS is enabled (`optional` or `required`), the certificate presented by the client must be signed by trusted
266+
<<plugins-{type}s-{plugin}-ssl_certificate_authorities>> (CAs).
267+
Please note that the server does not validate the client certificate CN (Common Name) or SAN (Subject Alternative Name).
268+
269+
NOTE: This setting can be used only if <<plugins-{type}s-{plugin}-mode>> is `server` and <<plugins-{type}s-{plugin}-ssl_certificate_authorities>> is set.
270+
241271
[id="plugins-{type}s-{plugin}-ssl_enable"]
242272
===== `ssl_enable`
273+
deprecated[6.4.0, Replaced by <<plugins-{type}s-{plugin}-ssl_enabled>>]
274+
275+
* Value type is <<boolean,boolean>>
276+
* Default value is `false`
277+
278+
Enable SSL (must be set for other `ssl_` options to take effect).
279+
280+
[id="plugins-{type}s-{plugin}-ssl_enabled"]
281+
===== `ssl_enabled`
243282

244283
* Value type is <<boolean,boolean>>
245284
* Default value is `false`
@@ -286,8 +325,27 @@ NOTE: If you configure the plugin to use `'TLSv1.1'` on any recent JVM, such as
286325
the protocol is disabled by default and needs to be enabled manually by changing `jdk.tls.disabledAlgorithms` in
287326
the *$JDK_HOME/conf/security/java.security* configuration file. That is, `TLSv1.1` needs to be removed from the list.
288327

328+
[id="plugins-{type}s-{plugin}-ssl_verification_mode"]
329+
===== `ssl_verification_mode`
330+
331+
* Value can be any of: `full`, `none`
332+
* Default value is `full`
333+
334+
Defines how to verify the certificates presented by another party in the TLS connection:
335+
336+
`full` validates that the server certificate has an issue date that's within
337+
the not_before and not_after dates; chains to a trusted Certificate Authority (CA), and
338+
has a hostname or IP address that matches the names within the certificate.
339+
340+
`none` performs no certificate validation.
341+
342+
This setting can be used only if <<plugins-{type}s-{plugin}-mode>> is `client`.
343+
344+
WARNING: Setting certificate verification to `none` disables many security benefits of SSL/TLS, which is very dangerous. For more information on disabling certificate verification please read https://www.cs.utexas.edu/~shmat/shmat_ccs12.pdf
345+
289346
[id="plugins-{type}s-{plugin}-ssl_verify"]
290-
===== `ssl_verify`
347+
===== `ssl_verify`
348+
deprecated[6.4.0, Replaced by <<plugins-{type}s-{plugin}-ssl_client_authentication>> and <<plugins-{type}s-{plugin}-ssl_verification_mode>>]
291349

292350
* Value type is <<boolean,boolean>>
293351
* Default value is `true`

0 commit comments

Comments
 (0)