Skip to content

Commit 6588ee5

Browse files
Add host-based role mapping section to create role mapping API (#10289) (#10308)
* Add host-based role mapping section to create role mapping API * Update _security/access-control/api.md --------- (cherry picked from commit 5ab3d50) Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 5dcd75f commit 6588ee5

File tree

1 file changed

+16
-0
lines changed
  • _security/access-control

1 file changed

+16
-0
lines changed

_security/access-control/api.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,22 @@ PUT _plugins/_security/api/rolesmapping/<role>
940940
```
941941
{% include copy-curl.html %}
942942

943+
#### Host-based role mapping
944+
945+
The `hosts` parameter maps requests originating from specific IP addresses or hostnames to the given role. CIDR blocks are not supported, but you can use wildcard patterns (globs), such as `192.168.*.*` or `*.example.com`. This is useful when you want to assign roles based on the client's source address:
946+
947+
* To match by IP address (for example, `"192.168.1.10"`), no additional configuration is needed.
948+
* To match by hostname (for example, `"myserver.example.com"`), you must set the cluster-level configuration parameter:
949+
950+
```yaml
951+
opensearch_security.host_resolver_mode: ip-hostname
952+
```
953+
954+
This enables reverse DNS lookups to resolve hostnames. For more information, see [Configuring OpenSearch](https://docs.opensearch.org/docs/latest/install-and-configure/configuring-opensearch/index/).
955+
956+
Using `"*"` in `hosts` matches all client IPs and hostnames, meaning this role will be applied to every request, regardless of user. This can unintentionally overgrant access if used alongside `users: ["someuser"]`. Avoid setting `hosts: ["*"]` unless you're intentionally granting the role to all client IPs.
957+
{: .warning}
958+
943959
#### Example response
944960

945961
```json

0 commit comments

Comments
 (0)