Skip to content

Commit 844204e

Browse files
committed
Run tests with custom user attribute serialization
Signed-off-by: Craig Perkins <[email protected]>
1 parent aeb2d9c commit 844204e

File tree

4 files changed

+80
-1
lines changed

4 files changed

+80
-1
lines changed

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import java.util.concurrent.TimeUnit
2727
buildscript {
2828
ext {
2929
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
30-
opensearch_version = System.getProperty("opensearch.version", "3.2.0-SNAPSHOT")
30+
opensearch_version = System.getProperty("opensearch.version", "3.3.0-SNAPSHOT")
3131
buildVersionQualifier = System.getProperty("build.version_qualifier", "")
3232
// 2.2.0-SNAPSHOT -> 2.2.0.0-SNAPSHOT
3333
version_tokens = opensearch_version.tokenize('-')
@@ -375,6 +375,7 @@ afterEvaluate {
375375
node.extraConfigFile("esnode.pem", file("build/resources/main/esnode.pem"))
376376
node.extraConfigFile("esnode-key.pem", file("build/resources/main/esnode-key.pem"))
377377
node.extraConfigFile("root-ca.pem", file("build/resources/main/root-ca.pem"))
378+
node.extraConfigFile("opensearch-security/internal_users.yml", file("build/resources/test/security/internal_users.yml"))
378379
node.setting("plugins.security.ssl.transport.pemcert_filepath", "esnode.pem")
379380
node.setting("plugins.security.ssl.transport.pemkey_filepath", "esnode-key.pem")
380381
node.setting("plugins.security.ssl.transport.pemtrustedcas_filepath", "root-ca.pem")
@@ -391,6 +392,7 @@ afterEvaluate {
391392
node.setting("plugins.security.check_snapshot_restore_write_privileges", "true")
392393
node.setting("plugins.security.restapi.roles_enabled", "[\"all_access\", \"security_rest_api_access\"]")
393394
node.setting("plugins.security.system_indices.enabled", "true")
395+
node.setting("plugins.security.user_attribute_serialization.enabled", "true")
394396
// node.setting("plugins.security.system_indices.indices", "[\".opendistro-ism-config\"]")
395397
}
396398
}

src/main/resources/mappings/opendistro-ism-config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,11 @@
644644
"type" : "keyword"
645645
}
646646
}
647+
},
648+
"custom_attributes": {
649+
"type": "object",
650+
"properties": {},
651+
"dynamic": "true"
647652
}
648653
}
649654
}

src/main/resources/mappings/opensearch-control-center.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@
5353
"type" : "keyword"
5454
}
5555
}
56+
},
57+
"custom_attributes": {
58+
"type": "object",
59+
"properties": {},
60+
"dynamic": "true"
5661
}
5762
}
5863
},
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
# This is the internal user database
3+
# The hash value is a bcrypt hash and can be generated with plugin/tools/hash.sh
4+
5+
_meta:
6+
type: "internalusers"
7+
config_version: 2
8+
9+
# Define your internal users here
10+
11+
## Demo users
12+
13+
admin:
14+
hash: "$2a$12$VcCDgh2NDk07JGN0rjGbM.Ad41qVR/YFJcgHp0UGns5JDymv..TOG"
15+
reserved: true
16+
backend_roles:
17+
- "admin"
18+
description: "Demo admin user"
19+
attributes:
20+
attribute1: "value1"
21+
attribute2: "value2"
22+
attribute3: "value3"
23+
24+
anomalyadmin:
25+
hash: "$2y$12$TRwAAJgnNo67w3rVUz4FIeLx9Dy/llB79zf9I15CKJ9vkM4ZzAd3."
26+
reserved: false
27+
opendistro_security_roles:
28+
- "anomaly_full_access"
29+
description: "Demo anomaly admin user, using internal role"
30+
31+
kibanaserver:
32+
hash: "$2a$12$4AcgAt3xwOWadA5s5blL6ev39OXDNhmOesEoo33eZtrq2N0YrU3H."
33+
reserved: true
34+
description: "Demo OpenSearch Dashboards user"
35+
36+
kibanaro:
37+
hash: "$2a$12$JJSXNfTowz7Uu5ttXfeYpeYE0arACvcwlPBStB1F.MI7f0U9Z4DGC"
38+
reserved: false
39+
backend_roles:
40+
- "kibanauser"
41+
- "readall"
42+
attributes:
43+
attribute1: "value1"
44+
attribute2: "value2"
45+
attribute3: "value3"
46+
description: "Demo OpenSearch Dashboards read only user, using external role mapping"
47+
48+
logstash:
49+
hash: "$2a$12$u1ShR4l4uBS3Uv59Pa2y5.1uQuZBrZtmNfqB3iM/.jL0XoV9sghS2"
50+
reserved: false
51+
backend_roles:
52+
- "logstash"
53+
description: "Demo logstash user, using external role mapping"
54+
55+
readall:
56+
hash: "$2a$12$ae4ycwzwvLtZxwZ82RmiEunBbIPiAmGZduBAjKN0TXdwQFtCwARz2"
57+
reserved: false
58+
backend_roles:
59+
- "readall"
60+
description: "Demo readall user, using external role mapping"
61+
62+
snapshotrestore:
63+
hash: "$2y$12$DpwmetHKwgYnorbgdvORCenv4NAK8cPUg8AI6pxLCuWf/ALc0.v7W"
64+
reserved: false
65+
backend_roles:
66+
- "snapshotrestore"
67+
description: "Demo snapshotrestore user, using external role mapping"

0 commit comments

Comments
 (0)