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

[Extensions] Add support for extension_dns list in extensions.yml file #2730

Closed
cwperks opened this issue May 2, 2023 · 7 comments
Closed
Labels
enhancement New feature or request triaged Issues labeled as 'Triaged' have been reviewed and are deemed actionable.

Comments

@cwperks
Copy link
Member

cwperks commented May 2, 2023

Similar to the setting plugins.security.nodes_dn which lets a cluster admin define the list of distinguished names that a node of the cluster can use to join the cluster with, extensions need an analogous mechanism. The distinguished name is extracted from the node's transport certificate and identifies a request as coming from a node (though not uniquely - nodes can connect with the same distinguished name and this is even done in the demo configuration!).

This new setting will initially be static, though this needs to also be dynamic in future iterations similar to the nodes_dn.yml dynamic configuration file.

This setting can reside in the extensions/extensions.yml file like so:

extensions:
  - name: hello-world
    uniqueId: hw
    hostAddress: '127.0.0.1'
    port: '4532'
    version: '1.0'
    opensearchVersion: '3.0.0'
    minimumCompatibleVersion: '3.0.0'
    extension_dns:
      - 'CN=extension-01,OU=SECURITY,O=OPENSEARCH,L=BROOKLYN,ST=NEW YORK,C=US'
@cwperks cwperks added enhancement New feature or request untriaged Require the attention of the repository maintainers and may need to be prioritized labels May 2, 2023
@cwperks
Copy link
Member Author

cwperks commented May 2, 2023

This PR introduced a mechanism for an extension to perform transport requests with the cluster and the request is identified through the threadcontext header extension_unique_id which is checked against the registry of installed extensions. In addition to that check it would be strong to also have a check against the distinguished name of the peer certificate used in the transport request.

@peternied
Copy link
Member

I would recommend to avoid using acronyms in config files so they are easy to search / gain context on such as distinguished name. DNS also means domain name service which can be miss leading for those unfamiliar.

@cwperks
Copy link
Member Author

cwperks commented May 2, 2023

@peternied How about support for both extension_dns and extension_distinguished_names? Error out if both are set as an invalid config?

@peternied
Copy link
Member

That proposal is overly complicated, I'm just providing feedback about the name

@stephen-crawford stephen-crawford self-assigned this May 5, 2023
@davidlago davidlago added triaged Issues labeled as 'Triaged' have been reviewed and are deemed actionable. and removed untriaged Require the attention of the repository maintainers and may need to be prioritized labels May 8, 2023
@davidlago davidlago moved this to In Progress in Security for Extensions May 10, 2023
@stephen-crawford stephen-crawford removed their assignment May 17, 2023
samuelcostae added a commit to samuelcostae/security that referenced this issue Jun 15, 2023
…nsion settings bwcPluginMode and extensionDistinguishedNames

Signed-off-by: scosta <[email protected]>
@samuelcostae
Copy link
Contributor

Just commenting here for awareness, im adding this setting at the same time as adding bwcPluginMode setting from issue #2616

samuelcostae added a commit to samuelcostae/security that referenced this issue Jul 5, 2023
…nsion settings bwcPluginMode

Signed-off-by: scosta <[email protected]>
cwperks pushed a commit that referenced this issue Aug 23, 2023
Description

Add support for extension domain name check, similar to how it's done
for admin certificate or for nodes from different clusters More about
that in the task:
#2730
Issues Resolved

#2730

Currently the implementation looks like this:

During extension initialization via REST call, DNs are passed in the
request body:

curl -XPOST -k -u user:password
"https://localhost:9200/_extensions/initialize" -H
"Content-Type:application/json" --data '{ "name":"hello-world",
"uniqueId":"hello-world2", "hostAddress":"127.0.0.1", "port":"4500",
"version":"1.0", "opensearchVersion":"3.0.0",
"minimumCompatibleVersion":"3.0.0",
"dependencies":[{"uniqueId":"test1","version":"2.0.0"},{"uniqueId":"test2","version":"3.0.0"}],
"distinguishedNames":
["CN=extension-0.example.com,OU=node,O=node,L=test,DC=de"] }'

In next iterations I'd like to store configuration in index and make it
dynamic.

PR on openserch-core side: 
Here's old PR that I created at the beginning of working on the task,
additional input from @cwperks is there.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and
signing off your commits, please check
[here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).

---------

Signed-off-by: Maciej Mierzwa <[email protected]>
@MaciejMierzwa
Copy link
Contributor

Merged: #3031

@davidlago
Copy link

@MaciejMierzwa does that mean this issue is ready to be closed? or are there other PRs needed before we do so?

@github-project-automation github-project-automation bot moved this from In Progress to Done in Security for Extensions Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triaged Issues labeled as 'Triaged' have been reviewed and are deemed actionable.
Projects
Status: Done
Development

No branches or pull requests

6 participants