Skip to content

[WIP] Proof of concept for a generic password provider #82

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

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

Conversation

adenes
Copy link
Contributor

@adenes adenes commented Oct 25, 2016

One of the main security concerns regarding Flume is that currently passwords can only be set in plain text in the config file. I have a proof-of-concept to overcome this limitation with an extensible password provider.

The core of the solution is the PasswordProvider interface which has a default implementation (PlainTextPasswordProvider) which returns the value of the given key, thus taking care of backwards compatibility.
The other implementation is the ExternalProcessPasswordProvider which executes the configured command and returns its output.

Usage example can be seen in the AvroSource (see the 2nd commit of this PR):

- keystorePassword = context.getString(KEYSTORE_PASSWORD_KEY);
+ keystorePassword = PasswordConfigurator.getPassword(context, KEYSTORE_PASSWORD_KEY);

Example configuration to use the ExternalProcessPasswordProvider:

...
a.sources.avro.keystore-password.passwordProviderClass=org.apache.flume.conf.ExternalProcessPasswordProvider
a.sources.avro.keystore-password.command=get_avro_keystore_password.sh
...

Example configuration with no passwordProviderClass set:

...
a.sources.avro.keystore-password=SecretPassword
...

As no passwordProviderClass is set in this example the default PlainTextPasswordProvider is used which returns the value of a.sources.avro.keystore-password.


Note: this is still a work in progress, I wanted to sketch up my idea. Any questions/comments/suggestions are more than welcome.

Change-Id: I28a11ccbeb3bd19f8de14c66d4cf47dc6e1c7969
Change-Id: I0dadcb576c9b9eefb557cb8e111cb899cd415c0e

private String loadPassword(Context context, String key) {
String charsetKey = key + "." + CHARSET_KEY;
String charsetName = context.getString(charsetKey, "iso-8859-1");
Copy link
Member

Choose a reason for hiding this comment

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

Why iso-8859-1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As it's about the output of a shell script I don't expect to have non-ascii characters, that's why I decided to use iso-8859-1 by default. I might be wrong so I'm open to reconsider this.

Choose a reason for hiding this comment

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

+1 for Unicode standard and UTF-8 implementation even for defaults.

@mpercy
Copy link
Contributor

mpercy commented Nov 3, 2016

I didn't look at this much yet, but would this ultimately be compatible with standard JAAS credential providers, like the one Hadoop implements?

@asfgit
Copy link

asfgit commented Aug 17, 2018

Can one of the admins verify this patch?

waidr pushed a commit to waidr/flume that referenced this pull request Jul 24, 2019
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.

5 participants