[英]How to create solr password hash
From solr documentation to create a user I need to add following lines to security.json
config file:从 solr 文档创建一个用户,我需要将以下行添加到security.json
配置文件:
"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
.我知道在authentication.credentials
下,密钥solr
是用户名,值IV0EHq1OnNrj6gvRCwvFwTrZ1+z1oBbnQdiVC3otuq0= Ndd7LKvVBAaZIF0QAVi1ekCfAJXr1GGfLtRUXhgrF8c=
是密码SolrRocks
。
But my question is, how can I generate that hash?但我的问题是,如何生成 hash?
The documentation does not mention it anywhere,该文档没有在任何地方提及它,
It does not look like md5
, sha1
, argon
nor any hash known to me.它看起来不像md5
、 sha1
、 argon
,也不像我所知的任何 hash 。
After decoding the base64 it seems to be stored as some binary data.在解码 base64 之后,它似乎被存储为一些二进制数据。
What kind of hash is that, and how can I create it from bash?那是什么样的 hash,我如何从 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].您通常(在身份验证 API 中使用set-user
添加用户)[https://solr.apache.org/guide/solr/latest/deployment-guide/basic-authentication-plugin.html#add-a -用户或编辑密码]。
rmalchow on GitHub has created a standalone version for bash : GitHub 上的 rmalchow 为 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)"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.