wget -qO test.sh \
https://gist.githubusercontent.com/risdenk/bd2c48dea8a5c60d2b7746d8b96c7ac2/raw/a2d62088e35cfed4536132e77d6a47821195e831/test.sh \
&& chmod +x test.sh \
&& ./test.sh
Last active
October 31, 2016 20:21
-
-
Save risdenk/bd2c48dea8a5c60d2b7746d8b96c7ac2 to your computer and use it in GitHub Desktop.
SOLR-9481 Testing
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
{ | |
"authentication":{ | |
"class":"solr.BasicAuthPlugin", | |
"credentials":{"solr":"MB6K1vwaLSPBKGMb4HnHRFX5dGpFZ3NuUFC2g3unnVI= Cugexuj22Y8gsKMxFcrx/2LcqBz4lz1rHif0EShcUII="}, | |
"":{"v":0}}, | |
"authorization":{ | |
"class":"solr.RuleBasedAuthorizationPlugin", | |
"permissions":[{ | |
"name":"all", | |
"role":"admin", | |
"index":1}], | |
"user-role":{"solr":["admin"]}, | |
"":{"v":0}}} |
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
#!/usr/bin/env bash | |
wget -qO security.json https://gist.githubusercontent.com/risdenk/bd2c48dea8a5c60d2b7746d8b96c7ac2/raw/eb33a5cc30d23bfc0db171b272b7285aa20b3397/security.json | |
# Start solr | |
docker run -d --name solr-9481 -p 8983:8983 -v $PWD/security.json:/opt/solr/server/solr/security.json risdenk/docker-solr:master-alpine bin/solr start -f | |
sleep 15 | |
# Create collection | |
docker exec -it solr-9481 bin/solr create -c foo | |
# Add user | |
curl http://localhost:8983/solr/admin/authentication \ | |
-H 'Content-type:application/json' \ | |
-d '{"set-user": {"solr" : "solr"}}' | |
# Verify security.json | |
docker exec -it solr-9481 cat /opt/solr/server/solr/security.json | |
# Set permissions | |
curl http://localhost:8983/solr/admin/authorization \ | |
-H 'Content-type:application/json' \ | |
-d '{ "set-permission": {"name":"all", "role": "admin"}, "set-user-role" : {"solr": ["admin"]}}' | |
# Should return error | |
curl http://localhost:8983/solr/admin/info/system | |
# Should succeed | |
curl -u solr:solr http://localhost:8983/solr/admin/info/system | |
# Remove solr | |
docker rm -f solr-9481 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment