Users
Create User
curl -s -H "Content-Type: application/json" -u "$admin_user:$admin_pass" -X PUT "$url/_opendistro/_security/api/internalusers/$user" -d '{"password": "$user_pass","backend_roles": ["$role_name"]}' | jq
curl -s -H "Content-Type: application/json" -u "$user:$pass" -X GET "$url/_opendistro/_security/api/user"|jq
Create role
curl -s -H "Content-Type: application/json" -u "$admin_user:$admin_pass" -X PUT "$url/_opendistro/_security/api/roles/$role_name" -d
'{
"cluster_permissions": [],
"index_permissions": [{"index_patterns": ["graylog_*"],"allowed_actions": ["read","write","delete","manage","index","create","update","manage_aliases","manage_settings"]}],
"tenant_permissions": []
}'|jq
curl -s -H "Content-Type: application/json" -u "$user:$pass" -X GET "$url/_opendistro/_security/api/roles"|jq
Attach user to role
curl -s -H "Content-Type: application/json" -u "$admin_user:$admin_pass" -X PUT "$url/_opendistro/_security/api/rolesmapping/$role_name" -d '{"backend_roles": ["$role_name"],"users": ["$user"],"hosts": []}'|jq
curl -s -H "Content-Type: application/json" -u "$user:$pass" -X GET "$url/_opendistro/_security/api/rolesmapping"|jq
Indese
List Indese
curl -s -H "Content-Type: application/json" -u "$user:$pass" -X GET "$url/_cat/indices?v"
Delete Index
curl -s -H "Content-Type: application/json" -u "$user:$pass" -X DELETE "$url/graylog_0"|jq