Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated SSL settings and simplify SSL configuration #213

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

donoghuc
Copy link
Contributor

@donoghuc donoghuc commented Nov 12, 2024

Get rid of the deprecated parameters and document their removal. Ensure the integration and unit tests pass and that the removals are clearly documented.

Closes #210

@donoghuc
Copy link
Contributor Author

Got a failure on 7.x https://app.travis-ci.com/github/logstash-plugins/logstash-input-elasticsearch/jobs/628037127 that looked unrelated and suspiciously like a race condition. I reloaded that cell.

@donoghuc
Copy link
Contributor Author

For reviewer: I found reviewing this work to be very helpful in making sense of the removals https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/185/files

@@ -404,10 +393,9 @@ def validate_authentication
def setup_client_ssl
ssl_options = {}
ssl_options[:ssl] = true if @ssl_enabled
ssl_options[:trust_strategy] = trust_strategy_for_ca_trusted_fingerprint
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, i should only set this if @ssl_enabled. I'll move that back to where it was before.

Copy link
Contributor

@robbavey robbavey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review while we finalize the exact wording in docs, but let's get started with marking old settings as obsolete before removal

@@ -198,23 +198,12 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
# Set the address of a forward HTTP proxy.
config :proxy, :validate => :uri_or_empty

# SSL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than remove, let's mark as obsolete. We typically go from deprecated -> obsolete -> final removal

Marking a setting as obsolete triggers a specific error message in Logstash that prevents Logstash from starting, but gives an informative error message to the user:

https://github.com/elastic/logstash/blob/2a23680cfd12438dc1a4429a1717a31e06e47816/logstash-core/locales/en.yml#L146

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I totally missed that. Will get this fixed up!

@donoghuc
Copy link
Contributor Author

donoghuc commented Nov 14, 2024

TODO:

@@ -52,6 +52,19 @@
end
end

describe 'handling obsolete settings' do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@donoghuc donoghuc force-pushed the GH-210-remove-obsolet-ssl-settings branch 3 times, most recently from c74627d to 6caee6d Compare November 14, 2024 17:30
@@ -264,6 +253,11 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
# If set, the _source of each hit will be added nested under the target instead of at the top-level
config :target, :validate => :field_reference

# Obsolete Settings
config :ssl, :validate => :boolean, :default => false, :obsolete => "Set 'ssl_enabled' instead."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this, we can probably skip the :validate and :default parts, and stick with :obsolete to avoid users fixing up settings, only to find they were obsolete anyway. WDYT?

(My only caveat is to keep :password and :uri (not applicable here), as they are considered secret, and are obfuscated on discovery)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, yeah i got tripped up on this writing tests. I was surprised to find that :validate would trigger when the option is :obsolete. I may be misunderstanding the test scenario but it looks to me like as a user I may be frustrated with a case whereby i set the wrong thing, then get a validation error that its the wrong form, only to be rewarded with a "this is no longer a valid option" once I satisfy the input validation. Not a huge deal but certainly a surprise if that is the case.

@donoghuc donoghuc force-pushed the GH-210-remove-obsolet-ssl-settings branch 2 times, most recently from 57654c7 to 9b1f74c Compare November 18, 2024 17:42
@@ -608,12 +610,12 @@ option when authenticating to the Elasticsearch server. If set to an
empty string authentication will be disabled.


[id="plugins-{type}s-{plugin}-deprecated-options"]
==== Elasticsearch Input deprecated configuration options
[id="plugins-{type}s-{plugin}-removed-options"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the docs update, let's follow the example in logstash-plugins/logstash-output-http@2fae93e#diff-cae5619b3d18ec99c5ccd0a9f6de0c6d3f53343c64692444551a7d29da6863e7

ie, remove all inline references to deprecated settings, and add a dedicated section at the bottom, above "common options", with a link to that section just before the config table.

cc @karenzone

This commit updates SSL settings to be marked as obsolete:
- Replace `ssl` with `ssl_enabled`
- Replace `ca_file` with `ssl_certificate_authorities`
- Replace `ssl_certificate_verification` with `ssl_verification_mode`

`setup_ssl_params!` has been updated to only handle SSL inference
when not explicitly configured.

All changes have been updated in tests and in docs. The preparation for
releasing a new major version is also included.
This commit updates the documentation to follow the pattern established in
logstash-plugins/logstash-output-http#147 for
documenting obsolete options.
@donoghuc donoghuc force-pushed the GH-210-remove-obsolet-ssl-settings branch from 9b1f74c to c2bd0e6 Compare December 2, 2024 22:42
@donoghuc
Copy link
Contributor Author

donoghuc commented Dec 2, 2024

Rebased and updated documentation to match logstash-plugins/logstash-output-http#147

@donoghuc
Copy link
Contributor Author

donoghuc commented Dec 2, 2024

Corresponding docs PR elastic/logstash#16744 in LS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove deprecated SSL settings from Elasticsearch input plugin
2 participants