-
Notifications
You must be signed in to change notification settings - Fork 7
MIR-1320 MIR support for Solr authentication and Solr cloud #1012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sebhofmann
merged 7 commits into
main
from
issues/MIR-1320-mir_support_for_solr_authentication_and_solr_cloud
Jul 31, 2024
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0e78038
MIR-1320 mir support for solr authentication and solr cloud
sebhofmann 8b4a217
MIR-1320 add tika server to wizard
sebhofmann 39194b3
MIR-1320 allow admin and indexer to search and admin to index
sebhofmann 70855b2
MIR-1320 translations and missing newlines
sebhofmann 66fba17
Update messages_de.properties
sebhofmann d1fcb20
MCR-1320 Update messages_de.properties
yagee-de 330e384
MCR-1320 Update messages_en.properties
yagee-de File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
upload local config set for main | ||
upload local config set for classification | ||
create collection for core main | ||
create collection for core classification |
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,14 @@ | ||
MCR.Solr.ServerURL=http\://localhost\:${solr.port}/ | ||
MCR.Solr.DelayIndexing_inMS=200 | ||
|
||
MCR.Solr.Server.Auth.Admin.Class=org.mycore.solr.auth.MCRSolrBasicPropertyAuthentication | ||
MCR.Solr.Server.Auth.Admin.Password=alleswirdgut | ||
MCR.Solr.Server.Auth.Admin.Username=admin | ||
MCR.Solr.Server.Auth.Index.Class=org.mycore.solr.auth.MCRSolrBasicPropertyAuthentication | ||
MCR.Solr.Server.Auth.Index.Password=alleswirdgut | ||
MCR.Solr.Server.Auth.Index.Username=indexer | ||
MCR.Solr.Server.Auth.Search.Class=org.mycore.solr.auth.MCRSolrBasicPropertyAuthentication | ||
MCR.Solr.Server.Auth.Search.Password=alleswirdgut | ||
MCR.Solr.Server.Auth.Search.Username=searcher | ||
|
||
|
This file contains hidden or 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
Submodule solr
deleted from
1f1a29
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM solr:8.11 | ||
USER root | ||
RUN apt-get update && \ | ||
apt-get -y install sudo | ||
COPY --chown=root:root docker-entrypoint.sh ./ | ||
RUN chmod 555 docker-entrypoint.sh | ||
CMD ["bash", "docker-entrypoint.sh"] |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
#!/usr/bin/bash | ||
# | ||
# This file is part of *** M y C o R e *** | ||
# See http://www.mycore.de/ for details. | ||
# | ||
# MyCoRe is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# MyCoRe is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with MyCoRe. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
set -e | ||
unset SOLR_USER SOLR_UID SOLR_GROUP SOLR_GID \ | ||
SOLR_CLOSER_URL SOLR_DIST_URL SOLR_ARCHIVE_URL SOLR_DOWNLOAD_URL SOLR_DOWNLOAD_SERVER SOLR_KEYS SOLR_SHA512 | ||
|
||
function fixDirectoryRights() { | ||
find "$1" \! -user "$2" -exec chown "$2:$2" '{}' + | ||
} | ||
|
||
echo "Running solr entry script as user: $(whoami)" | ||
if [ "$(id -u)" -eq 0 ]; then | ||
fixDirectoryRights /var/solr/ solr | ||
exec /usr/bin/sudo -E -u solr "PATH=$PATH" "$(pwd)/$0"; | ||
exit 0; | ||
fi | ||
|
||
function solrpass() { | ||
printf "%s %s" "$(echo -n "$2$1"|openssl dgst -sha256 -binary|openssl dgst -sha256 -binary|openssl base64)" "$(echo -n "$2"|openssl base64)" | ||
} | ||
|
||
secruity_json=/var/solr/data/security.json; | ||
|
||
|
||
echo "{" > $secruity_json | ||
echo " \"authentication\":{" >> $secruity_json | ||
echo " \"blockUnknown\": true," >> $secruity_json | ||
echo " \"class\":\"solr.BasicAuthPlugin\"," >> $secruity_json | ||
echo " \"credentials\": {" >> $secruity_json | ||
|
||
if [ -n "$SOLR_SEARCH_USER" ]; then | ||
echo " \"${SOLR_SEARCH_USER}\":\"$(solrpass $SOLR_SEARCH_PASSWORD $(openssl rand 10))\"," >> $secruity_json | ||
fi | ||
|
||
if [ -n "$SOLR_INDEX_USER" ]; then | ||
echo " \"${SOLR_INDEX_USER}\":\"$(solrpass $SOLR_INDEX_PASSWORD $(openssl rand 10))\"," >> $secruity_json | ||
fi | ||
|
||
if [ -n "$SOLR_ADMIN_USER" ]; then | ||
echo " \"${SOLR_ADMIN_USER}\":\"$(solrpass $SOLR_ADMIN_PASSWORD $(openssl rand 10))\"" >> $secruity_json | ||
fi | ||
|
||
echo " }," >> $secruity_json | ||
echo " \"realm\":\"My Solr users\"," >> $secruity_json | ||
echo " \"forwardCredentials\": false" >> $secruity_json | ||
echo " }," >> $secruity_json | ||
echo " \"authorization\":{" >> $secruity_json | ||
echo " \"class\":\"solr.RuleBasedAuthorizationPlugin\"," >> $secruity_json | ||
echo " \"permissions\":[" >> $secruity_json | ||
|
||
if [ -n "$SOLR_SEARCH_USER" ]; then | ||
echo " {" >> $secruity_json | ||
echo " \"name\":\"read\"," >> $secruity_json | ||
echo " \"role\":[\"searcher\",\"indexer\",\"admin\"]" >> $secruity_json | ||
echo " }," >> $secruity_json | ||
fi | ||
|
||
if [ -n "$SOLR_INDEX_USER" ]; then | ||
echo " {" >> $secruity_json | ||
echo " \"name\":\"update\"," >> $secruity_json | ||
echo " \"role\":[\"indexer\",\"admin\"]" >> $secruity_json | ||
echo " }," >> $secruity_json | ||
fi | ||
|
||
if [ -n "$SOLR_ADMIN_USER" ]; then | ||
echo " {" >> $secruity_json | ||
echo " \"name\":\"all\"," >> $secruity_json | ||
echo " \"role\":\"admin\"" >> $secruity_json | ||
echo " }" >> $secruity_json | ||
fi | ||
echo "]," >> $secruity_json | ||
echo " \"user-role\":{" >> $secruity_json | ||
|
||
if [ -n "$SOLR_SEARCH_USER" ]; then | ||
echo " \"${SOLR_SEARCH_USER}\":\"searcher\"," >> $secruity_json | ||
fi | ||
|
||
if [ -n "$SOLR_INDEX_USER" ]; then | ||
echo " \"${SOLR_INDEX_USER}\":\"indexer\"," >> $secruity_json | ||
fi | ||
|
||
if [ -n "$SOLR_ADMIN_USER" ]; then | ||
echo " \"${SOLR_ADMIN_USER}\":\"admin\"" >> $secruity_json | ||
fi | ||
|
||
echo " }" >> $secruity_json | ||
echo " }" >> $secruity_json | ||
echo "}" >> $secruity_json | ||
|
||
(/opt/docker-solr/scripts/wait-for-solr.sh;/opt/solr/bin/solr zk cp $secruity_json zk:security.json -z localhost:9983)& | ||
/opt/docker-solr/scripts/solr-foreground -c; |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"authentication": { | ||
"blockUnknown": true, | ||
"class": "solr.BasicAuthPlugin", | ||
"credentials": { | ||
"searcher": "0QWhQdOGUMTkjxqE0rPodHKa2gUEnRZnZ837YP/L4aw= 7A==", | ||
"indexer": "0QWhQdOGUMTkjxqE0rPodHKa2gUEnRZnZ837YP/L4aw= 7A==", | ||
"admin": "0QWhQdOGUMTkjxqE0rPodHKa2gUEnRZnZ837YP/L4aw= 7A==" | ||
yagee-de marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
"realm": "My Solr users", | ||
"forwardCredentials": false | ||
}, | ||
"authorization": { | ||
"class": "solr.RuleBasedAuthorizationPlugin", | ||
"permissions": [ | ||
{ | ||
"name": "read", | ||
"role": [ | ||
"searcher", | ||
"indexer", | ||
"admin" | ||
] | ||
}, | ||
{ | ||
"name": "update", | ||
"role": [ | ||
"indexer", | ||
"admin" | ||
] | ||
}, | ||
{ | ||
"name": "all", | ||
"role": "admin" | ||
} | ||
], | ||
"user-role": { | ||
"searcher": "searcher", | ||
"indexer": "indexer", | ||
"admin": "admin" | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.