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

Support blacklisting fingerprinters #1949

Merged

Conversation

carlpett
Copy link
Contributor

@carlpett carlpett commented Nov 8, 2016

Currently there is a client option fingerprint.whitelist. It would be useful to extend it with a blacklisting option as well.

Use case: we would like to disable env_aws since it picks up things from our Openstack platform which are nonsensical. Currently we need to figure out the list of available fingerprinters on the host, and then whitelist all of them except the aws one.

@dadgar
Copy link
Contributor

dadgar commented Nov 7, 2016

Hey thanks for reporting this. If you are comfortable with Go a PR is welcome. You can mainly follow the code path of the white list to implement this.

@carlpett
Copy link
Contributor Author

carlpett commented Nov 8, 2016

@dadgar I gave it a shot. Added driver blacklisting at the same time since it was very similar, but I could pull that out if there is some different thinking about those.

(It seems the github cli transformed this from an issue into a pull request? Not sure what happened...)

@carlpett
Copy link
Contributor Author

carlpett commented Nov 8, 2016

I don't really understand the test failures, they seem unrelated to my changes? Or is master broken?

@@ -720,6 +720,9 @@ func (c *Client) reservePorts() {
func (c *Client) fingerprint() error {
whitelist := c.config.ReadStringListToMap("fingerprint.whitelist")
whitelistEnabled := len(whitelist) > 0
blacklist := c.config.ReadStringListToMap("fingerprint.blacklist")
blacklistEnabled := len(blacklist) > 0
Copy link
Contributor

Choose a reason for hiding this comment

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

White list needs this since you need to know both if the whitelist is active and if the fingerprinter is whitelisted (if not active nothing will be whitelisted). For blacklist you just need to know if it is contained in the map. so remove this variable and change :737 to if _, ok := blacklist[name]; ok {

Copy link
Contributor

Choose a reason for hiding this comment

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

Same below and update the comments on those lines

@@ -133,6 +133,19 @@ see the [drivers documentation](/docs/drivers/index.html).
}
```

- `"driver.blacklist"` `(string: "")` - Specifies a comma-separated list of
blacklisted drivers . If specified, drivers in the blacklist will be
disabled. If the blacklist is empty, all drivers are fingerprinted and enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

I would remove the last sentences in both of these since it is pretty clear what the behavior will be and the fingerprinters/drivers still need to take into account the whitelist

@dadgar
Copy link
Contributor

dadgar commented Nov 8, 2016

Awesome job! We will be cutting the RC2 soon, so depending when the comments get addressed this might make it

@carlpett
Copy link
Contributor Author

carlpett commented Nov 9, 2016

@dadgar I've implemented the changes now, good points!

@dadgar
Copy link
Contributor

dadgar commented Nov 9, 2016

Awesome! Thank you so much!

@dadgar dadgar merged commit 96b5840 into hashicorp:master Nov 9, 2016
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants