-
Notifications
You must be signed in to change notification settings - Fork 484
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
Configuring Anonymous Authentication in OpenSearch blog post #2517
Open
smortex
wants to merge
1
commit into
opensearch-project:main
Choose a base branch
from
smortex:configure-anonymous-authentication
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
_posts/xxxx-xx-xx-configure-anonymous-authentication.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
--- | ||
layout: post | ||
title: Configuring Anonymous Authentication in OpenSearch | ||
authors: | ||
- smortex | ||
date: 2023-12-28 16:20:00 -1000 | ||
category: | ||
- technical-posts | ||
meta_keywords: anonymous, authentication, authorization | ||
meta_description: Learn how to set up OpenSearch for anonymous authentication | ||
--- | ||
|
||
The OpenSearch Security plugin has support multiple authentication backends. | ||
It is also possible to enable anonymous authentication to allow access to OpenSearch without prior identification. | ||
In this article, we configure anonymous authentication which is disabled by default. | ||
|
||
## Enable anonymous authentication in OpenSearch | ||
|
||
Anonymous access to OpenSearch is done in the Security plugin by modifying `opensearch-security/config.yml` and reloading the configuration with `securityadmin.sh`. | ||
|
||
Ensure `anonymous_auth_enabled` is set to true: | ||
|
||
```yaml | ||
config: | ||
# [...] | ||
dynamic: | ||
# [...] | ||
http: | ||
# [...] | ||
anonymous_auth_enabled: true | ||
``` | ||
|
||
Then inject the new configuration (this will replace the configuration, exercise caution if you have changed OpenSearch configuration outside of these files): | ||
|
||
``` | ||
OPENSEARCH_JAVA_HOME=/usr/share/opensearch/jdk /usr/share/opensearch/plugins/opensearch-security/tools/securityadmin.sh \ | ||
-cacert /etc/opensearch/root-ca.pem \ | ||
-cert /etc/opensearch/kirk.pem \ | ||
-key /etc/opensearch/kirk-key.pem \ | ||
-cd /etc/opensearch/opensearch-security | ||
``` | ||
|
||
## Enable anonymous authentication in OpenSearch Dashboards | ||
|
||
|
||
Now that OpenSearch anonymous access is enabled, we must enable it in OpenSearch Dashboards by modifying `opensearch_dashboards.yml` and adding the following line: | ||
|
||
```yaml | ||
opensearch_security.auth.anonymous_auth_enabled: true | ||
``` | ||
|
||
When done, we restart the `opensearch-dashboards` service. | ||
|
||
When accessing OpenSearch Dashboards from a browser, you will automatically log in as the **opendistro_security_anonymous** user. It is possible to authenticate as another user after logging out: the usual log in screen will be presented, with a new "Log in as anonymous" button. | ||
|
||
## Adjust permissions of anonymous users | ||
|
||
With the default OpenSearch configuration, the **opendistro_security_anonymous** user has the *backend role* `opendistro_security_anonymous_backendrole` and the *role* `own_index`. | ||
This is not sufficient to access OpenSearch data and roles must be mapped to the `opendistro_security_anonymous_backendrole` *backend role* to grant access. | ||
|
||
There is no one-size-fit-all configuration, so we will consider some simple use cases. | ||
|
||
Configuration can be done using the OpenSearch Dashboards user interface as an administrator, or by modifying the Security plugin configuration in `opensearch-security/roles_mapping.yml` and applying changes with `securityadmin.sh`. | ||
|
||
### Provide read-only access to anonymous users | ||
|
||
Map the `readall` and `kibana_user` roles to the `opendistro_security_anonymous_backendrole` backend role: | ||
|
||
```yaml | ||
kibana_user: | ||
reserved: false | ||
backend_roles: | ||
- "kibanauser" | ||
- "opendistro_security_anonymous_backendrole" # <--- added | ||
description: "Maps kibanauser to kibana_user" | ||
|
||
readall: | ||
reserved: false | ||
backend_roles: | ||
- "readall" | ||
- "opendistro_security_anonymous_backendrole" # <--- added | ||
``` | ||
|
||
### Provide full access to anonymous users | ||
|
||
Map the `all_access` role to the `opendistro_security_anonymous_backendrole` backend role: | ||
|
||
```yaml | ||
all_access: | ||
reserved: false | ||
backend_roles: | ||
- "admin" | ||
- "opendistro_security_anonymous_backendrole" # <--- added | ||
description: "Maps admin to all_access" | ||
``` | ||
|
||
## Conclusion | ||
|
||
In this article, we saw how to enable anonymous access to OpenSearch Dashboards. | ||
|
||
In your deployment, you will likely create custom roles to give access to a subset of your data through [document-level](https://opensearch.org/docs/latest/security/access-control/document-level-security/) or [field-level](https://opensearch.org/docs/latest/security/access-control/field-level-security/) security. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to adjust this and rename the file accordingly.