Skip to content

Commit b739d4b

Browse files
authored
Create opensearch.sh
1 parent 06768b8 commit b739d4b

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

opensearch.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
. .env
3+
doco exec -it opensearch curl -XPUT -u admin:${OPENSEARCH_PASSWORD} "opensearch:9200/_plugins/_security/api/roles/indexer_${BRAND}" -H "Content-Type: application/json" -d "$(cat <<EOF
4+
{
5+
"cluster_permissions": [
6+
"cluster_composite_ops_monitor",
7+
"cluster:monitor/main",
8+
"cluster:monitor/state",
9+
"cluster:monitor/health"
10+
],
11+
"index_permissions": [
12+
{
13+
"index_patterns": ["indexer_${BRAND}*"],
14+
"fls": [],
15+
"masked_fields": [],
16+
"allowed_actions": ["*"]
17+
},
18+
{
19+
"index_patterns": ["*"],
20+
"fls": [],
21+
"masked_fields": [],
22+
"allowed_actions": [
23+
"indices:admin/aliases/get",
24+
"indices:data/read/search",
25+
"indices:admin/get"]
26+
}
27+
],
28+
"tenant_permissions": []
29+
}
30+
EOF
31+
32+
)"
33+
34+
doco exec -it opensearch curl -XPUT admin:${OPENSEARCH_PASSWORD} -XPUT "http://opensearch:9200/_plugins/_security/api/internalusers/indexer_${BRAND}" \
35+
-H "Content-Type: application/json" \
36+
-d "$(cat <<EOF
37+
{
38+
"password": "${INDEXER_PASSWORD}",
39+
"opendistro_security_roles": ["indexer_${BRAND}", "own_index"]
40+
}
41+
EOF
42+
)"

0 commit comments

Comments
 (0)