简体   繁体   中英

How to create solr password hash

From solr documentation to create a user I need to add following lines to security.json config file:

"authentication":{
  "class":"solr.BasicAuthPlugin",
  "credentials":{
    "solr":"IV0EHq1OnNrj6gvRCwvFwTrZ1+z1oBbnQdiVC3otuq0= Ndd7LKvVBAaZIF0QAVi1ekCfAJXr1GGfLtRUXhgrF8c="
  }
},

I know that under authentication.credentials the key solr is the username and value IV0EHq1OnNrj6gvRCwvFwTrZ1+z1oBbnQdiVC3otuq0= Ndd7LKvVBAaZIF0QAVi1ekCfAJXr1GGfLtRUXhgrF8c= is the hash of password SolrRocks .

But my question is, how can I generate that hash?
The documentation does not mention it anywhere,
It does not look like md5 , sha1 , argon nor any hash known to me.
After decoding the base64 it seems to be stored as some binary data.

What kind of hash is that, and how can I create it from bash?

You'd usually (use set-user in the Authentication API to add the user)[https://solr.apache.org/guide/solr/latest/deployment-guide/basic-authentication-plugin.html#add-a-user-or-edit-a-password].

rmalchow on GitHub has created a standalone version for bash :

#!/bin/bash
PW=$1
SALT=$(pwgen 48 -1)
echo "hash    : $(echo -n "$SALT$PW" | sha256sum -b | xxd -r -p | sha256sum -b | xxd -r -p | base64 -w 1024) $(echo -n "$SALT" | base64 -w1024)"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM