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

[receiver/jmxreceiver] Limit parameters for JMX receiver to reduce security risk #9721

Merged
merged 26 commits into from
May 18, 2022

Conversation

dehaansa
Copy link
Contributor

@dehaansa dehaansa commented May 4, 2022

Description: Update the JMX Receiver as a part of the effort to reduce its attack surface. This PR removes the generic properties parameter, removes the ability to use a user-defined groovy script, and communicates with the subprocess via a properties file rather than command line parameters.

Link to tracking Issue: #9686 #9685

Testing: Manually validated in addition to updates to the unit tests. Integration tests for JMX receiver are currently flaky and require improvement.

@dehaansa dehaansa requested review from a team and dmitryax May 4, 2022 00:51
@djaglowski djaglowski self-requested a review May 4, 2022 18:38
receiver/jmxreceiver/config.go Outdated Show resolved Hide resolved
receiver/jmxreceiver/config.go Show resolved Hide resolved
receiver/jmxreceiver/receiver.go Show resolved Hide resolved
Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

This LGTM. @rmfitzpatrick do you want to have a look?

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

Thanks for taking this up! Please update the README file as well.

ResourceAttributes map[string]string `mapstructure:"resource_attributes"`
// Log level used by the JMX metric gatherer. Should be one of:
// `"trace"`, `"debug"`, `"info"`, `"warn"`, `"error"`, `"off"`
LogLevel string `mapstructure:"log_level"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Any thoughts on whether this should re-use the log level set in the collector's service.logging setting instead of adding its own?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm open to it. The only drawbacks I see are that there's no Trace equivalent in zap.Level and several levels (fatal, panic, dpanic, error) would probably all map to error (or possibly panic/dpanic to "off").

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@codeboten implemented it so if no user config is provided, it attempts to translate from zap logger level, otherwise it uses the user provided config. Let me know what you think!

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 looks good to me

receiver/jmxreceiver/config.go Outdated Show resolved Hide resolved
@djaglowski
Copy link
Member

@codeboten, mind taking another look?

@dehaansa dehaansa requested a review from codeboten May 17, 2022 13:19
@codeboten codeboten merged commit 72da4da into open-telemetry:main May 18, 2022
@dehaansa dehaansa deleted the jmx-lockdown branch May 18, 2022 18:38
jamesmoessis pushed a commit to jamesmoessis/opentelemetry-collector-contrib that referenced this pull request May 20, 2022
…curity risk (open-telemetry#9721)

* Remove options considered too permissive for security in jmx receiver

* Use config file for communicating to JMX metrics gatherer

* Fix small issues with jmx receiver

* Ensure property files are generated correctly with multiline input

* Update changelog

* minor changes to receiver to support more config in properties file

* Update properties file generation

* Address PR feedback and address environment variable attack surface

* Update receiver/jmxreceiver/config.go

Co-authored-by: Alex Boten <aboten@lightstep.com>
kentquirk pushed a commit to McSick/opentelemetry-collector-contrib that referenced this pull request Jun 14, 2022
…curity risk (open-telemetry#9721)

* Remove options considered too permissive for security in jmx receiver

* Use config file for communicating to JMX metrics gatherer

* Fix small issues with jmx receiver

* Ensure property files are generated correctly with multiline input

* Update changelog

* minor changes to receiver to support more config in properties file

* Update properties file generation

* Address PR feedback and address environment variable attack surface

* Update receiver/jmxreceiver/config.go

Co-authored-by: Alex Boten <aboten@lightstep.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants